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
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dpinela
Copy link
Contributor

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.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 20, 2020
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Jun 20, 2020
@gopherbot
Copy link

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

Fixed on dev.go2go.

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>
@golang golang locked and limited conversation to collaborators Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants