-
Notifications
You must be signed in to change notification settings - Fork 822
Property initialization doesn't work without space before interpolated string #16696
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
It is not really related to property initialization, simpler repro: > let x =$"123";;
let x =$"123";;
------^^
stdin(2,7): error FS0035: This construct is deprecated: '$' is not permitted as a character in operator names and is reserved for future use and not so much to interpolated strings either: > let x =-1;;
let x =-1;;
------^^
stdin(3,7): error FS0010: Unexpected infix operator in binding. Expected '=' or other token. |
Well, the last one I think is a different thing, and correctly reported as error. |
@Martin521 it is kind of the same thing, because in both cases lexer thinks it sees And yeah, not quite sure if this is a bug tbh. |
@abonie Property initialisation is a case where skipping spaces around |
I think this can be fixed following the same approach than https://github.com/dotnet/fsharp/pull/15923/files |
Easier said than done. It is lexed and parsed like an operator, so it needs be "special cased" for binding, fields and properties assignments (also, how should One possible solution is for us to "deprecate" @auduchinok thoughts? |
Never said it was easy 😅. I played around locally with a similar approach than https://github.com/dotnet/fsharp/pull/15923/files and it "works". But now shows that |
We could try to special-case this in the parser: do a check after successfully parsing it as an operator and rewrite the resulting tree if it matches this pattern. We do a similar thing in some other cases already. |
It should be relatively safe, since we don't allow defining |
Repro steps
Sharplab
Expected behavior
All three cases should work
Actual behavior
Second case doesn't work
Known workarounds
Add space before value
Related information
.NET 8
F# 8
The text was updated successfully, but these errors were encountered: