Bind switch expression with checked-aware binder#61890
Conversation
|
It would probably be worth checking other binder flags as well: is |
That's beyond the scope of this fix, but nothing jumps out from cursory glance at other flags (including |
|
|
||
| public override void VisitCheckedExpression(CheckedExpressionSyntax node) | ||
| { | ||
| Binder binder = _enclosing.WithCheckedOrUncheckedRegion(@checked: node.Kind() == SyntaxKind.CheckedExpression); |
There was a problem hiding this comment.
For example, speculating inside a checked expression should use the context, which should be observable through operators used. That should fix #60419, I think.
There was a problem hiding this comment.
Thanks for the pointer. I'll look at fixing #60419 together with this.
There was a problem hiding this comment.
I think the tests for #60419 are already checked in.
|
Done with review pass (commit 1) In reply to: 1156511984 |
| { | ||
| binder = rootBinder.GetBinder(current); | ||
| } | ||
| else if (current is CheckedExpressionSyntax) |
There was a problem hiding this comment.
|
Done with review pass (commit 3) |
AlekseyTs
left a comment
There was a problem hiding this comment.
LGTM (commit 4), assuming CI is passing
|
@dotnet/roslyn-compiler for second review. Thanks |
|
/azp run |
|
Azure Pipelines successfully started running 4 pipeline(s). |
333fred
left a comment
There was a problem hiding this comment.
LGTM (commit 4), assuming tests are passing.
This reverts commit 0730214.
Fixes #61843
Fixes #60419
The issue is that
Binder.BindSwitchExpressionis dropping the binderFlags, so we're losing theOverflowChecks.Enabledflag set byBinder.BindCheckedExpression.