-
Notifications
You must be signed in to change notification settings - Fork 832
Fix handling of curly braces in FormattableStrings #14399
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
Fix handling of curly braces in FormattableStrings #14399
Conversation
a082089 to
79b114c
Compare
79b114c to
5fc1054
Compare
psfinaki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the bug, nevertheless I'd appreciate some meaningful examples in tests, like more or less real usecases for all this quite specific topic.
Also, since you've become a guru in the F# interpolated strings, consider checking correctness and completeness of our docs. Also, I guess it's worth adding a note about F# to the docs here and here.
Thanks for the comment, somehow it made me take another look at this change and realize it will be broken again if we implement this extended interpolated strings RFC. I'll turn this PR back to draft and give this some more thought, because it doesn't make sense to introduce a hacky fix if we already see how it will break again. Regarding request for more tests, I actually don't think we should extensively test |
|
Actually, I might have too hastily proclaimed that this will be broken by extended interpolation syntax - I think it happens to work fine, because whatever But it is now more apparent to me, that this is a hacky fix, because it implicitly couples this part of checking to some behavior of the lexer. On the other hand, it seems to me that they are already somewhat coupled together... edit: Did some thinking and some testing - it will be fine after all, even with extended string interpolation syntax. Marking as "ready for review" :) |
3a70148 to
0562991
Compare
Interpolation expressions have already been replaced by %P() at this point, so it should be safe and should only undo the opposite transformation done by lexer.
0562991 to
551aeac
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
psfinaki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same feedback - thanks for the fix, some clearer examples in tests and maybe some docs would be also helpful :)
Fixes #11782
The problem was, that in interpolated strings we turn
{{into{(and}}into}) during lexing.This fixes it by converting it back to
{{(and}}) before callingFormattableStringFactory.Create(after interpolation expressions ({expr}) have already been processed).