-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types, types2: better error message for invalid use of constraint interface #42881
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
Comments
This isn't permitted, because it would require the type to have a method But the error message could be better. CC @griesemer. |
As an aside, the two programs you (@voldyman) are comparing are not the same: The first one has a different interface type for the |
Got it, in that case the error message while trying to create a implementation is also not clear. https://go2goplay.golang.org/p/-knY7KsfF67
related question: Is there a way to express "the type should have methods a & b, and also be allowed in the key of a map " with the current generics proposal? |
@voldyman Interfaces that contain type lists or embed |
Thanks for the detailed answer! (I'll leave this issue open for the compiler error message but feel free to close it if not required) |
Change https://go.dev/cl/410954 mentions this issue: |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go2 playground (https://go2goplay.golang.org/)
go env
OutputWhat did you do?
https://go2goplay.golang.org/p/LGpaCLkA31a
What did you expect to see?
Successful compilation, since it's the same as the following code which compiles
https://go2goplay.golang.org/p/f2Lpuv-3JKl
What did you see instead?
The text was updated successfully, but these errors were encountered: