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

go/types, types2: report better errors when type sets are empty #51525

Closed
griesemer opened this issue Mar 7, 2022 · 3 comments
Closed

go/types, types2: report better errors when type sets are empty #51525

griesemer opened this issue Mar 7, 2022 · 3 comments
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

Error messages are confusing when type sets are empty. For instance, for:

func _[T interface{comparable; ~int; ~string}](x T) {
        _ = x == x // ERROR cannot compare x == x
}

the error doesn't say why the comparison is not possible. The root cause is that T's type set is empty.

The same applies to other operations, such as + in this case.

cc: @findleyr

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 7, 2022
@griesemer griesemer added this to the Go1.19 milestone Mar 7, 2022
@griesemer griesemer self-assigned this Mar 7, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/413934 mentions this issue: go/types, types2: better errors for == when type sets are empty

@griesemer
Copy link
Contributor Author

Addressed for == in 1.19. Moving to 1.20 for the rest.

@griesemer griesemer modified the milestones: Go1.19, Go1.20 Jun 24, 2022
gopherbot pushed a commit that referenced this issue Jun 24, 2022
For #51525.

Change-Id: I3762bc4a48a1aaab3b006b1ad1400f866892243c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413934
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
For golang#51525.

Change-Id: I3762bc4a48a1aaab3b006b1ad1400f866892243c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413934
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/452535 mentions this issue: go/types, types2: report empty type sets in operand descriptions

felixge pushed a commit to felixge/go that referenced this issue Nov 21, 2022
This leads to better error messages where operations are not
permitted because of empty type sets.

Fixes golang#51525.

Change-Id: I8d15645e2aff5145e458bdf9aaa4d2bee28d37fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/452535
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
@golang golang locked and limited conversation to collaborators Nov 21, 2023
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
Status: Done
Development

No branches or pull requests

2 participants