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

Open
mdempsky opened this issue Nov 13, 2019 · 6 comments
Labels
Milestone

Comments

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Nov 13, 2019

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 label Nov 13, 2019
@mdempsky mdempsky added this to the Go1.15 milestone Nov 13, 2019
@cuonglm

This comment has been minimized.

Copy link
Contributor

@cuonglm cuonglm commented Nov 14, 2019

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

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 14, 2019

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

@ALTree

This comment has been minimized.

Copy link
Member

@ALTree ALTree commented Nov 14, 2019

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

@mdempsky

This comment has been minimized.

Copy link
Member Author

@mdempsky mdempsky commented Nov 14, 2019

@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

This comment has been minimized.

Copy link
Member

@ALTree ALTree commented Nov 14, 2019

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

@mdempsky

This comment has been minimized.

Copy link
Member Author

@mdempsky mdempsky commented Nov 14, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.