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
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

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

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 3, 2020
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Aug 3, 2020
@gopherbot
Copy link

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

Fixed by https://golang.org/cl/247258.

@gopherbot
Copy link

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>
@golang golang locked and limited conversation to collaborators Aug 12, 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

3 participants