-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fix circularity issue with binding const local #75371
Conversation
ef825d8
to
dd9a999
Compare
8fde573
to
7aeabe9
Compare
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.
Just one minor question, otherwise looks good
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.
Consider adding a test for a collection expression like [x]
. #Resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs
Outdated
Show resolved
Hide resolved
Consider opening an issue to check for other binders that are created on the fly, which could be "lost" in similar scenarios. #Closed |
Done with review pass (commit 1) #Closed |
if (node.Initializer is { } initializer) | ||
{ | ||
var oldEnclosing = _enclosing; | ||
var localInProgressBinder = new LocalInProgressBinder(initializer, _enclosing); |
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.
@@ -536,7 +536,25 @@ public LocalWithInitializer( | |||
Debug.Assert(initializer != null); | |||
|
|||
_initializer = initializer; | |||
_initializerBinder = initializerBinder; | |||
_initializerBinder = initializerBinder.GetBinder(initializer) ?? new LocalInProgressBinder(_initializer, initializerBinder); |
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.
Done with review pass (commit 3) |
@@ -536,7 +536,26 @@ public LocalWithInitializer( | |||
Debug.Assert(initializer != null); | |||
|
|||
_initializer = initializer; | |||
_initializerBinder = initializerBinder; | |||
_initializerBinder = initializerBinder.GetBinder(initializer); |
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.
Done with review pass (commit 4) |
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 (commit 5)
Fixes #75353
Opened issue #75416 (wrong binder used in
switch
expression binding)Opened issue #75437 (injected binders may get dropped by
GetBinder
)