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: unclear error message for type parameter #40047
Comments
Possibly related to #39670 (comment) |
Taking Robert's type conversion example from that comment, here is a quick attempt to adapt his example to the situation in this issue: |
@crawshaw The problem here is that Now, in "type context", we know that it cannot be a conversion and we can do the right thing. For instance, Arguably, in the This, and many other problems would go away if our keyboards had one more style of easily accessible parentheses... |
Thanks for the detailed explanation. That is indeed a sticky situation. It seems unlikely I have any novel thoughts about syntax given the effort you have put into this, but I would point out that the Go spec has some unused characters that could be used to prefix type parentheses: |
A type parameter on the RHS of a type definition is not permitted anymore. Closing. |
Fails to compile with:
Presumably there is an unresolvable ambiguity (though honestly I haven't figured out what it is yet). An extra pair of parentheses makes it work:
Assuming this is working as intended, a clearer error message would be nice.
The text was updated successfully, but these errors were encountered: