Escape curly braces in string literals when converting concatenation to interpolated string#23589
Merged
mavasani merged 2 commits intodotnet:masterfrom May 9, 2018
rik-smeets:escape-curly-braces-in-interpolated-string-refactoring
Merged
Escape curly braces in string literals when converting concatenation to interpolated string#23589mavasani merged 2 commits intodotnet:masterfrom rik-smeets:escape-curly-braces-in-interpolated-string-refactoring
mavasani merged 2 commits intodotnet:masterfrom
rik-smeets:escape-curly-braces-in-interpolated-string-refactoring
Conversation
Contributor
There was a problem hiding this comment.
can you add tests with verbatim literals as well? Thanks!
Contributor
Author
There was a problem hiding this comment.
Thanks for your review. I added two unit tests for verbatim literals as well.
jmarolf
approved these changes
Dec 6, 2017
Contributor
jmarolf
left a comment
There was a problem hiding this comment.
Looks great! I would just add the tests Cyrus suggested.
Contributor
|
test windows_debug_vs-integration_prtest |
mavasani
approved these changes
May 2, 2018
Contributor
|
@jinujoseph for approval |
Contributor
|
Approved to merge for 15.8.Preview2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Customer scenario
Customer has a string concatenation where the string literal contains curly braces. For example:
Using the "Convert to interpolated string" refactoring does not escape the curly braces in the string literal(s). When applying the refactoring, this can lead to compile errors or unmeant escapes:
Bugs this fixes
#23536
Workarounds, if any
Escape the braces manually in the string literal(s) before or after applying the refactoring.
Risk
The scope of the fix is limited to this specific refactoring.
Performance impact
Low, the fix only adds two extra string operations (which are only executed if necessary).
Is this a regression from a previous update?
I don't know.
Root cause analysis
This specific situation was not covered by unit tests yet. I added these tests now.
How was the bug found?
Customer reported, see #23536.
Test documentation updated?
No impact on test documentation.