Skip to content

Commit

Permalink
Adjust an assert in EmitArgument (#75067)
Browse files Browse the repository at this point in the history
Fixes #75035.
  • Loading branch information
AlekseyTs committed Sep 13, 2024
1 parent 214d43a commit 483c6ad
Show file tree
Hide file tree
Showing 2 changed files with 414 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Compilers/CSharp/Portable/CodeGen/EmitExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,8 @@ private void EmitArgument(BoundExpression argument, RefKind refKind)
if (unexpectedTemp != null)
{
// interestingly enough "ref dynamic" sometimes is passed via a clone
Debug.Assert(argument.Type.IsDynamic(), "passing args byref should not clone them into temps");
// receiver of a ref field can be cloned too
Debug.Assert(argument.Type.IsDynamic() || argument is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None }, "passing args byref should not clone them into temps");
AddExpressionTemp(unexpectedTemp);
}

Expand Down
Loading

0 comments on commit 483c6ad

Please sign in to comment.