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/go2go: error message for mismatched arguments does not reference both arguments' types #39725

Closed
dpinela opened this issue Jun 20, 2020 · 2 comments
Assignees
Milestone

Comments

@dpinela
Copy link
Contributor

@dpinela dpinela commented Jun 20, 2020

Does this issue reproduce with the latest release?

This occurs in the playground at the time of writing.

What did you do?

Try to run the following program:

https://go2goplay.golang.org/p/1NaVjWeT2xW

What did you expect to see?

The error message explicitly points out that two different types were substituted for T in the call to Any (and what the types were), perhaps like this:
type func(f []byte) bool of (func(f []byte) bool literal) does not match func(string) bool

What did you see instead?

type func(f []byte) bool of (func(f []byte) bool literal) does not match func(T) bool

This message is unhelpful as, unlike in non-generic code, it doesn't tell us which type we should have used, and does not reveal the fundamental problem - the mismatch between string and []byte.

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 1, 2020

Change https://golang.org/cl/240523 mentions this issue: [dev.go2go] go/types: report inferred type when a type argument doesn't match

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jul 1, 2020

Fixed on dev.go2go.

@griesemer griesemer closed this Jul 1, 2020
gopherbot pushed a commit that referenced this issue Jul 1, 2020
…'t match

Fixes #39725.

Change-Id: I48248283ae0eb635d489d8661512f32b98700c1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/240523
Reviewed-by: Robert Griesemer <gri@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.