-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Proposal (Question?): Allow decl literals in ==
and !=
peer-type resolution (PTR)
#21800
Comments
cc @mlugg |
Decl literals don't have baked-in support for specific syntax forms; rather, they are based on result types. As such, this could only work if |
@mlugg Noted, thanks for the quick answer!
Seeing as you want a proposal, I assume there is something wrong with the approach of improving this scenario in isolation. |
The result type for the RHS of
|
Now that I've frequently used decl literals, I've come across the irregularity that
==
and!=
expressions don't seem to support them:The intent behind the usage seems perfectly clear to me, therefore I'm surprised this isn't be supported.
Since general PTR via multi-argument
@TypeOf
accepts them, the only explanation I have is that there is special code for==
and!=
(that might be for providing the enum literal name as part of the compile error message if I had to guess)
that simply wasn't updated when decl literals were introduced.
I didn't see any special mention of
==
and!=
in the "accepted" variant of the proposal, nor in the PR implementing it.If this usage was simply overlooked, then adding support should be fairly uncontroversial. (IMO it removes a special case and simplifies the language.)
The text was updated successfully, but these errors were encountered: