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

Classify pattern-matching temp as long-lived #18756

Merged
merged 6 commits into from
Apr 19, 2017
Merged

Conversation

gafter
Copy link
Member

@gafter gafter commented Apr 17, 2017

Customer scenario

Use a switch in an async method, where the switch uses any new features introduced in C# 7.0.

Bugs this fixes:

Fixes #18257

Workarounds, if any

None known.

Risk

Small, as there is no change to code generation, but rather the classification of variables affecting the PDB.

Performance impact

Tiny, if any. Thee is only a slight change to which (existing) compiler code path is taken for these scenarios.

Is this a regression from a previous update?

No, the pattern-matching switch was new in C# 7.0.

Root cause analysis:

We did not test the interaction of pattern-matching with async.

How was the bug found?

Customer reported.

@gafter
Copy link
Member Author

gafter commented Apr 17, 2017

@agocke @AlekseyTs May I please have a review?

@gafter gafter added the 4 - In Review A fix for the issue is submitted for review. label Apr 17, 2017
@jaredpar
Copy link
Member

Approved pending sign offs.

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM

gafter added a commit to gafter/roslyn that referenced this pull request Apr 18, 2017
…ameters.

Fixes dotnet#16195
This is a language change for 7.1. See dotnet/csharplang#154.
Some tests may fail until dotnet#18756 is integrated.
<entry offset=""0xbe"" hidden=""true"" />
<entry offset=""0xc8"" startLine=""30"" startColumn=""17"" endLine=""30"" endColumn=""23"" />
<entry offset=""0xca"" startLine=""32"" startColumn=""5"" endLine=""32"" endColumn=""6"" />
<entry offset=""0xba"" startLine=""23"" startColumn=""17"" endLine=""23"" endColumn=""23"" />
Copy link
Member

Choose a reason for hiding this comment

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

The changes in sequence points suggest there are changes in IL. Seems like no other test covers the difference in IL. It would be good to have one.

@@ -207,6 +204,11 @@ internal enum SynthesizedLocalKind
InstrumentationPayload = 34,

/// <summary>
/// Temp created for pattern matching by type.
/// </summary>
PatternMatchingTemp = 35,
Copy link
Member

Choose a reason for hiding this comment

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

I'd remove "Temp" from the name. "Temp" suggests it's temporary, not long lived.
It would also be useful to mention in the comment what value is specifically stored in this variable. Is it the type object we are switching on?

@gafter
Copy link
Member Author

gafter commented Apr 19, 2017

@tmat Thanks for the suggestions. I've modified the PR to address both.

@gafter gafter closed this Apr 19, 2017
@gafter gafter reopened this Apr 19, 2017
@gafter gafter merged commit 831f266 into dotnet:master Apr 19, 2017
@gafter gafter added Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented and removed 4 - In Review A fix for the issue is submitted for review. labels Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved to merge Area-Compilers Bug cla-already-signed Feature - Pattern Matching Pattern Matching Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pattern switch in async method causes compiler crash
6 participants