Skip to content

Commit

Permalink
TransformDisplayClassUsage: Fix #3233 by ignoring nullability annotat…
Browse files Browse the repository at this point in the history
…ions, when trying to find a variable to reuse/propagate.
  • Loading branch information
siegfriedpammer committed Jul 27, 2024
1 parent 8e7e4ba commit 2e7991e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ ILVariable ResolveVariableToPropagate(ILInstruction value, IType expectedType =
// "dc.field = v; v = 42; use(dc.field)" cannot turn to "v = 42; use(v);"
return null;
}
if (!(expectedType == null || v.Kind == VariableKind.StackSlot || v.Type.Equals(expectedType)))
if (!(expectedType == null || v.Kind == VariableKind.StackSlot || NormalizeTypeVisitor.IgnoreNullability.EquivalentTypes(v.Type, expectedType)))
return null;
return v;
case LdObj ldfld:
Expand Down

0 comments on commit 2e7991e

Please sign in to comment.