Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: allow println(f()) where f() is multi-valued #35576

Closed
mdempsky opened this issue Nov 13, 2019 · 6 comments
Closed

cmd/compile: allow println(f()) where f() is multi-valued #35576

mdempsky opened this issue Nov 13, 2019 · 6 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
Member

This program builds with go/types and gccgo, but fails to typecheck with cmd/compile:

package main

func f() (int, int) { return 0, 0 }

func main() {
	println(f())
}
@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 13, 2019
@mdempsky mdempsky added this to the Go1.15 milestone Nov 13, 2019
@cuonglm
Copy link
Member

cuonglm commented Nov 14, 2019

This also happens with print, seems that typecheckargs is not called for OPRINT and OPRINTN.

@gopherbot
Copy link

Change https://golang.org/cl/207118 mentions this issue: cmd/compile: allow print/println(f()) where f() is multi-value

@ALTree
Copy link
Member

ALTree commented Nov 14, 2019

Note: this is a dup of #20656, which at the time was closed as WONTFIX.

@mdempsky
Copy link
Member Author

@ALTree Thanks for pointing that out.

I agree with @griesemer that spec-compliance doesn't strictly require println(f()) to work. But it does work with gccgo and go/types, and it's easy enough to support (e.g., CL 207118 is just a one-line change), so I think it's worth doing for consistency.

@ALTree
Copy link
Member

ALTree commented Nov 14, 2019

@mdempsky yep, I just linked the old thread for reference. I have no opinion on this.

@mdempsky
Copy link
Member Author

@ALTree Understood. I struggle with GitHub issue search, so I always appreciate folks helping cross-reference old issues. :)

@golang golang locked and limited conversation to collaborators Feb 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants