You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Allow CE return and type annotations to play well together without needing parentheses #15788
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:
@jwosty thanks for reporting this, I think as this is a change to the language, this has to follow suggestion -> RFC before considering changing the parser.
To me, the current behaviour makes sense, because the type annotation is not the same as a cast operator (or anything that expands the expression), there are other similar cases:
leta=async{// not oklet!b:int = Unchecked.defaultof<int Async>()}
Activity
smoothdeveloper commentedon Nov 12, 2023
@jwosty thanks for reporting this, I think as this is a change to the language, this has to follow suggestion -> RFC before considering changing the parser.
To me, the current behaviour makes sense, because the type annotation is not the same as a cast operator (or anything that expands the expression), there are other similar cases: