-
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
'with' on anonymous type needs to lower values #54086
Conversation
@@ -183,7 +183,8 @@ public override BoundNode VisitWithExpression(BoundWithExpression withExpr) | |||
Debug.Assert(left.MemberSymbol is not null); | |||
|
|||
// We evaluate the values provided in source first | |||
BoundLocal valueTemp = _factory.StoreToTemp(assignment.Right, out BoundAssignmentOperator boundAssignmentToTemp); | |||
var rewrittenRight = (BoundExpression)Visit(assignment.Right)!; |
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 using LocalRewriter.VisitExpression
which should make the cast and the !
unnecessary
System.Console.WriteLine(adjusted); | ||
"; | ||
var comp = CreateCompilation(src, parseOptions: TestOptions.RegularPreview); | ||
comp.VerifyEmitDiagnostics(); |
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.
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 2)
Fixing an embarrassing bug (forgot to lower the sub-expressions in this case)...
Fixes #53849
Relates to record structs feature: #51199 (test plan)