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

Improve parser recovery around nullable types in patterns #72805

Merged

Conversation

DoctorKrolic
Copy link
Contributor

Closes: #72720

@DoctorKrolic DoctorKrolic requested a review from a team as a code owner March 29, 2024 17:55
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 29, 2024
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Mar 29, 2024
@DoctorKrolic DoctorKrolic force-pushed the nullable-type-in-pattern-recovery branch from 41d70bf to c058b16 Compare March 29, 2024 17:59
@CyrusNajmabadi
Copy link
Member

Done with pass. Overall approve of the high level idea. Def wary of the actual code change (i don't understand it yet), and def think we need to beef up tests to ensure that things that are now legal to parse give proper diagnostics.

@DoctorKrolic
Copy link
Contributor Author

@333fred Can I have a review here?

Copy link
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.

Done review pass, only a couple of minor things. @dotnet/roslyn-compiler for a second review.

src/Compilers/CSharp/Portable/Parser/LanguageParser.cs Outdated Show resolved Hide resolved
src/Compilers/CSharp/Portable/Parser/LanguageParser.cs Outdated Show resolved Hide resolved
DoctorKrolic and others added 4 commits June 13, 2024 13:46
Co-authored-by: Fred Silberberg <fred@silberberg.xyz>
Co-authored-by: Fred Silberberg <fred@silberberg.xyz>
Copy link
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.

@dotnet/roslyn-compiler for a second review

@DoctorKrolic
Copy link
Contributor Author

@333fred I noticed that there was a regression of parsing an async simple lambda in a conditional expression after pattern. Need another look from you yo approve the change

@RikkiGibson RikkiGibson self-assigned this Jun 27, 2024
@DoctorKrolic
Copy link
Contributor Author

@RikkiGibson You self-assigned here, can you please take a look then?

@RikkiGibson RikkiGibson self-requested a review July 8, 2024 16:22
{
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "Type");
Copy link
Contributor

@RikkiGibson RikkiGibson Jul 8, 2024

Choose a reason for hiding this comment

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

I am confused by this parse :). It seems reasonable for => to end a pattern. But it seems like we're turning the => into a skipped token? Not sure why. Pausing here till I get back from lunch.

Copy link
Contributor

@RikkiGibson RikkiGibson left a comment

Choose a reason for hiding this comment

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

Some of the parses confuse me a bit especially around where I left the comment. But, it seems fine to me, these are error cases anyway, and we're just doing a best effort to come up with a parse that will hopefully result in the most useful errors.

@RikkiGibson RikkiGibson merged commit 21fd45b into dotnet:main Jul 8, 2024
24 checks passed
@RikkiGibson
Copy link
Contributor

Thanks @DoctorKrolic!

@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jul 8, 2024
@DoctorKrolic DoctorKrolic deleted the nullable-type-in-pattern-recovery branch July 9, 2024 09:22
333fred added a commit to 333fred/roslyn that referenced this pull request Jul 9, 2024
…solution-priority

* upstream/main: (184 commits)
  Disable BuildWithNetFrameworkHostedCompiler (dotnet#74299)
  Avoid using constants for large string literals (dotnet#74305)
  Adjust lowering of a string interpolation in an expression lambda to not use expanded non-array `params` collection in Format/Create calls. (dotnet#74274)
  Consolidate test Span sources (dotnet#74281)
  Allow Document.FilePath to be set to null (dotnet#74290)
  Update Directory.Build.rsp
  Remove fallback options from IdeAnalyzerOptions (dotnet#74235)
  Fix msbuild issue
  Improve parser recovery around nullable types in patterns (dotnet#72805)
  Syntax formatting options (dotnet#74223)
  Localized file check-in by OneLocBuild Task: Build definition ID 327: Build ID 2490585 (dotnet#74287)
  fix (dotnet#74276)
  Remove more
  fix (dotnet#74237)
  Fix scenario where lightbulbs weren't being displayed
  Reduce closures allocated during invocation of CapturedSymbolReplacement.Replacement (dotnet#74258)
  Reduce allocations in SymbolDeclaredCompilationEvent (dotnet#74250)
  remove type that now serves no purpose
  Remove uncalled method
  Remove more unused code
  ...
@RikkiGibson RikkiGibson modified the milestones: Next, 17.12 P1 Jul 29, 2024
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. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler has poor error recovery when encountering nullable types in pattern locations
4 participants