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

Allow newlines in the holes inside interpolated strings #56853

Merged

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Sep 29, 2021

Fixes dotnet/csharplang#4935 (approved by LDM).

Review with whitespace changes off.

Relates to test plan #57154

@RikkiGibson
Copy link
Contributor

It looks like the PR doesn't include any modified or new tests. Are those coming as part of this PR?

Diagnostic(ErrorCode.ERR_NewlinesAreNotAllowedInsideANonVerbatimInterpolatedString, "").WithLocation(5, 77),
// (7,2): error CS1035: End-of-file found, '*/' expected
// }
Diagnostic(ErrorCode.ERR_OpenEndedComment, "").WithLocation(7, 2),
Copy link
Member Author

@CyrusNajmabadi CyrusNajmabadi Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getting a duplicated error. investigating. #Closed

@CyrusNajmabadi
Copy link
Member Author

@RikkiGibson yes. lots of test updates here :)

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@CyrusNajmabadi
Copy link
Member Author

Note: i still need to make the specification change doc on this.

@jcouv
Copy link
Member

jcouv commented Oct 14, 2021

Kindly reminder to document the feature (with link to test plan and spec) in https://github.com/dotnet/roslyn/blob/main/docs/Language%20Feature%20Status.md
This helps us keep track of all the features and also communicate with partners and users.


In reply to: 943600359

{
var text = node.SyntaxTree.GetText();
if (text.Lines.GetLineFromPosition(interpolation.OpenBraceToken.SpanStart).LineNumber !=
text.Lines.GetLineFromPosition(interpolation.CloseBraceToken.SpanStart).LineNumber)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: i can also do this by just walking the tree. up to you if want me to go that route or not. this is def the easiest and most fool proof mechanism to determine this though.

@@ -137,7 +137,7 @@ private ExpressionSyntax ParseInterpolatedStringToken()
}
Copy link
Member Author

@CyrusNajmabadi CyrusNajmabadi Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view PR with whitespace changes off.

@jcouv jcouv requested a review from chsienki October 19, 2021 18:09
@CyrusNajmabadi
Copy link
Member Author

@chsienki PTAL. Thanks! :)

Copy link
Contributor

@chsienki chsienki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM minus a couple of spelling nits

CyrusNajmabadi and others added 4 commits October 25, 2021 12:33
Co-authored-by: Chris Sienkiewicz <chsienki@microsoft.com>
Co-authored-by: Chris Sienkiewicz <chsienki@microsoft.com>
Co-authored-by: Chris Sienkiewicz <chsienki@microsoft.com>
@CyrusNajmabadi CyrusNajmabadi enabled auto-merge (squash) October 25, 2021 18:46
@CyrusNajmabadi
Copy link
Member Author

As this just touched comments/loc-string, i made the chnage and set to auto-merge. LMK if there's an issue with that.

text.Lines.GetLineFromPosition(interpolation.CloseBraceToken.SpanStart).LineNumber)
{
diagnostics.Add(
ErrorCode.ERR_NewlinesAreNotAllowedInsideANonVerbatimInterpolatedString,
Copy link
Member

@jcouv jcouv Oct 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remembered... We'll need to add this error code the the UpgradeProject fixer. That's the fixer that handles diagnostics that include a CSharpRequiredLanguageVersion.
This can be tracked by a follow-up issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure.

Co-authored-by: Julien Couvreur <jcouv@users.noreply.github.com>
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 21). IDE portion can be a follow-up

@CyrusNajmabadi CyrusNajmabadi merged commit 35546d0 into dotnet:main Oct 25, 2021
@ghost ghost modified the milestones: Compiler.Next, Next Oct 25, 2021
@CyrusNajmabadi CyrusNajmabadi deleted the features/verbatim-hole-newline branch October 25, 2021 20:40
@RikkiGibson RikkiGibson modified the milestones: Next, 17.1.P1 Oct 25, 2021
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
4 participants