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: unhelpful error message with generic map key type #40551

Closed
ianlancetaylor opened this issue Aug 3, 2020 · 3 comments
Closed

cmd/go2go: unhelpful error message with generic map key type #40551

ianlancetaylor opened this issue Aug 3, 2020 · 3 comments
Labels
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 3, 2020

For this test case:

package p

type Set[type T] map[T]bool

var V Set[func()]

the type checker reports

foo.go2:3:22: invalid map key type T

This is accurate but cryptic. It would be better if the error message said something like map key type T does not have comparable constraint.

CC @griesemer

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 6, 2020

Change https://golang.org/cl/247258 mentions this issue: [dev.go2go] go/types: add special case report for generic map key type

gopherbot pushed a commit that referenced this issue Aug 11, 2020
Fixes #40551.

Change-Id: Ifc10dbdcdbee6af5bdbfc36ec78e1a4361672acc
GitHub-Last-Rev: 8d373de
GitHub-Pull-Request: #40628
Reviewed-on: https://go-review.googlesource.com/c/go/+/247258
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
@griesemer
Copy link
Contributor

@griesemer griesemer commented Aug 11, 2020

@griesemer griesemer closed this Aug 11, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Aug 12, 2020

Change https://golang.org/cl/248057 mentions this issue: [dev.go2go] cmd/compile/internal/types2: add special case report for generic map key type

gopherbot pushed a commit that referenced this issue Aug 12, 2020
…generic map key type

Port of go/types CL https://golang.org/cl/247258. (The typeparamsB.go2
version of typeparams.go2 doesn't exist yet for types2.)

Updates #40551.

Change-Id: If2b329372bd4d160b4def8b66cc87f25ed4823fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/248057
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
3 participants
You can’t perform that action at this time.