Browse Source

TransformDisplayClassUsage: Fix #3233 by ignoring nullability annotations, when trying to find a variable to reuse/propagate.

pull/3244/head
Siegfried Pammer 11 months ago
parent
commit
2e7991eee3
  1. 2
      ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs

2
ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs

@ -549,7 +549,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -549,7 +549,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// "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:

Loading…
Cancel
Save