Skip to content

Fix curly brace and interpolated string#57751

Merged
CyrusNajmabadi merged 33 commits intodotnet:mainfrom
bernd5:fix_CurlyBraceAndInterpolatedString
Dec 4, 2021
Merged

Fix curly brace and interpolated string#57751
CyrusNajmabadi merged 33 commits intodotnet:mainfrom
bernd5:fix_CurlyBraceAndInterpolatedString

Conversation

@bernd5
Copy link
Copy Markdown
Contributor

@bernd5 bernd5 commented Nov 13, 2021

fixes: #57750

@bernd5 bernd5 requested a review from a team as a code owner November 13, 2021 11:41
@ghost ghost added Community The pull request was submitted by a contributor who is not a Microsoft employee. Area-Compilers labels Nov 13, 2021
@bernd5 bernd5 marked this pull request as draft November 13, 2021 11:41
@bernd5 bernd5 marked this pull request as ready for review November 13, 2021 15:01
@jcouv jcouv requested a review from CyrusNajmabadi November 15, 2021 23:01
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@bernd5 We've discussed this and are going to take this change.

@jcouv
Copy link
Copy Markdown
Member

jcouv commented Nov 17, 2021

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@dotnet/roslyn-compiler For eyes on this. LDM approved us changing the behavior here as this is the behavior the runtime already changed to in .net core3.0. This is now an impact when we emit interpolated string handlers.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@jcouv Agreed. Does that go in with the PR, or is it a separate process?

@333fred
Copy link
Copy Markdown
Member

333fred commented Nov 17, 2021

@jcouv Agreed. Does that go in with the PR, or is it a separate process?

With this PR

333fred
333fred previously approved these changes Nov 18, 2021
Copy link
Copy Markdown
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

Compiler changes LGTM (commit 13)

@333fred
Copy link
Copy Markdown
Member

333fred commented Nov 29, 2021

Hopefully final question is: do we need to make a change in VB parsing as well?

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

My feeling is that vb is likely fine. Since it doesn't support interpolated string handlers right? So it will still emit string. Format and will be ok.

@333fred
Copy link
Copy Markdown
Member

333fred commented Nov 29, 2021

My feeling is that vb is likely fine. Since it doesn't support interpolated string handlers right? So it will still emit string. Format and will be ok.

It doesn't, but it will still parse differently, right? If we're ok with that, then ok. Just wanted a check on whether we think that parsing difference is ok.

@333fred
Copy link
Copy Markdown
Member

333fred commented Nov 29, 2021

@bernd5 looks like there's a couple of nullable issues:

D:\a_work\1\s\src\EditorFeatures\CSharpTest\Classification\SemanticClassifierTests.cs(2609,31): error CS8602: Dereference of a possibly null reference. [D:\a_work\1\s\src\EditorFeatures\CSharpTest\Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj]
D:\a_work\1\s\src\EditorFeatures\CSharpTest\Classification\SemanticClassifierTests.cs(2623,32): error CS8600: Converting null literal or possible null value to non-nullable type. [D:\a_work\1\s\src\EditorFeatures\CSharpTest\Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj]

@bernd5
Copy link
Copy Markdown
Contributor Author

bernd5 commented Nov 29, 2021

Yes Cyrus removed #nullable disable.
Should we leave it as it was?

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Sorry, will fix.

@333fred
Copy link
Copy Markdown
Member

333fred commented Nov 29, 2021

It doesn't, but it will still parse differently, right? If we're ok with that, then ok. Just wanted a check on whether we think that parsing difference is ok.

Before I sign off I'd like @AlekseyTs's thoughts on this as well. Note that this won't change runtime semantics, only the parse tree.

@bernd5
Copy link
Copy Markdown
Contributor Author

bernd5 commented Nov 29, 2021

In my eyes VB should be changed, too. But in a separate PR.

@333fred
Copy link
Copy Markdown
Member

333fred commented Nov 30, 2021

I spoke with @AlekseyTs offline about this. We're fine with not changing VB in this PR, and I filed #58043 as a help-wanted issue if someone wants to correct VB parsing in the future.

Copy link
Copy Markdown
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM (commit 33). @dotnet/roslyn-compiler for a second review.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@RikkiGibson can you look at this community PR as well? It will impact the raw-string-literal work as well, so it would be good to have your eyes on it.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@RikkiGibson @chsienki can you ptal here? thanks!

}
}";
CreateCompilationWithMscorlib45(source).VerifyDiagnostics(
// (6,33): error CS1056: Unerwartetes Zeichen "{".
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: should this be English to be consistent?

(Although I quite like the idea of having different languages in the code base 😊)

@CyrusNajmabadi CyrusNajmabadi merged commit b5d359b into dotnet:main Dec 4, 2021
@ghost ghost added this to the Next milestone Dec 4, 2021
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

THanks @bernd5 ! I'll make sure the raw-string-literals work picks this up as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid parsing of interpolated strings with curly braces followed after interpolation with format specifier

6 participants