-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Unescape interpolated string literal components #54706
Conversation
Fixes dotnet#54703. Spec change is at dotnet/csharplang#4910. Note that there is an interesting wrinkle here in that, for an interpolated string used as a string, the change in constant value makes the lowering mechanism an observable side effect. While doing this step during lowering instead of initial binding is technically feasible, it would be quite complex as there are several different ways an AppendLiteral call could get to lowering (dynamic, conversion to object, regular literal, passed by in, etc). For now, I'm opting for simple strategy of accepting this observable side-effect, and if we want to try and make that side effect invisble we can look at doing so at a later point.
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.
LGTM Thanks (iteration 1)
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.
Minor feedback on the length being passed to handler ctor. Don't think that should be blocking though.
Thanks for getting this done!
src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Binder/Binder_InterpolatedString.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jared Parsons <jaredpparsons@gmail.com>
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.
Thank you!
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.
LGTM Thanks (iteration 4)
Fixes #54703. Spec change is at dotnet/csharplang#4910.
Note that there is an interesting wrinkle here in that, for an interpolated string used as a string, the change in constant value makes the lowering mechanism an observable side effect. While doing this step during lowering instead of initial binding is technically feasible, it would be quite complex as there are several different ways an AppendLiteral call could get to lowering (dynamic, conversion to object, regular literal, passed by in, etc). For now, I'm opting for simple strategy of accepting this observable side-effect, and if we want to try and make that side effect invisible we can look at doing so at a later point.
Test plan #51499