Skip to content
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

Parse-Error: new-line in string interpolation expressions #50799

Closed
wants to merge 3 commits into from
Closed

Parse-Error: new-line in string interpolation expressions #50799

wants to merge 3 commits into from

Conversation

bernd5
Copy link
Contributor

@bernd5 bernd5 commented Jan 26, 2021

See: #50742

@bernd5 bernd5 requested a review from a team as a code owner January 26, 2021 20:24
@333fred
Copy link
Member

333fred commented Jan 26, 2021

The C# specification does not allow this today. https://github.com/dotnet/csharplang/blob/master/spec/lexical-structure.md#interpolated-string-literals

The grammar explicitly forbids newlines in the regular_balanced_text section. In fact, allowing the example you pointed out here is a spec violation, as by the spec verbatim strings shouldn't be allowed inside interpolated strings. Breaking that is almost certainly a backcompat change we wouldn't take, but I don't believe we're interested in breaking the spec further. If you would like to see a language change to accommodate this use case, you'll need to open a proposal on dotnet/csharplang and get a member of the LDT to champion it.

@333fred 333fred closed this Jan 26, 2021
@bernd5
Copy link
Contributor Author

bernd5 commented Nov 13, 2021

Implemented via #56853

bernd5 added a commit to bernd5/roslyn that referenced this pull request Nov 13, 2021
333fred pushed a commit that referenced this pull request Dec 13, 2021
* Add test "TestInterpolatedStringWithNewLinesInExpression()" which was implemented as part of #50799 and later realized via #56853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants