-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Conversation
@agocke @AlekseyTs May I please have a review? |
Approved pending sign offs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…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"" /> |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
@tmat Thanks for the suggestions. I've modified the PR to address both. |
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.