Allow CE return
and type annotations to play well together without needing parentheses
#15788
Labels
Milestone
Is your feature request related to a problem? Please describe.
I was surprised to learn that the parser doesn't like it when you use a type annotation with
return
in a CE:Describe the solution you'd like
It would be nice if this didn't result in a compile error. I understand that it's pretty low-impact (because workarounds are very easy here), and that the error probably has to do with parser precedence rules, but it would be a nice-to-have if the fix turns out to be simple. Otherwise, I'm not too broken up about it.
Describe alternatives you've considered
I was also surprised that
:>
(the upcast operator) works in the same situation:Other workarounds:
Additional context
Related: #11481
The text was updated successfully, but these errors were encountered: