-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/compile: misleading error message when using type parameter in typeset #50420
Comments
This is specified in https://tip.golang.org/ref/spec#Interface_types
[edit], Aha, you mean the message is not clear. Okay, it is some of. |
@griesemer per owners. Personally I think "cannot use type parameter in typeset" is perfectly clear as it is. |
I'm not sure if the word(s) 'type set' (or typeset) are appropriate here, since it refers to the entire type set of the interface type. Maybe "cannot use a type parameter in a union", which is the phrasing currently used in the spec. |
...though it may also be confusing that
Maybe |
Some off-topic, should "union" be replaced with "intersection"? |
It's true that because an operation is supported if it is supported by all types in the type set, one can view operations as going by the intersection. But from a type set perspective it is definitely a union operator. See #45346. |
Change https://go.dev/cl/396874 mentions this issue: |
Change https://go.dev/cl/396915 mentions this issue: |
Be clear that the type of a term (not the term itself, which may be of the form ~P) cannot be a type parameter. For #50420. Change-Id: I388d57be0618393d7ebe2c74ec04c1ebe3f33f7d Reviewed-on: https://go-review.googlesource.com/c/go/+/396915 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
What version of Go are you using (
go version
)?What did you do?
https://go.dev/play/p/v-8zaOs_d3r?v=gotip
What did you expect to see?
"cannot use type parameter in typeset"
What did you see instead?
"cannot embed a type parameter"
The text was updated successfully, but these errors were encountered: