Skip to content

Commit 7ed49a2

Browse files
Ignore nullability when comparing backing field and property type of auto properties
1 parent 3eaab7f commit 7ed49a2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ICSharpCode.Decompiler/CSharp/Transforms/PatternStatementTransform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ internal static bool TryGetBackingField(IProperty property, [NotNullWhen(true)]
949949
// structurally; arbitrary accessor bodies do not. A field of a different
950950
// type is not this property's storage, and removing it while printing
951951
// `field` would substitute storage of the property's type instead.
952-
&& candidate.Type.Equals(propertyType)
952+
&& NormalizeTypeVisitor.IgnoreNullability.EquivalentTypes(candidate.ReturnType, propertyType)
953953
&& NameCouldBeBackingFieldOfAutomaticProperty(candidate.Name, out var propertyName)
954954
&& propertyName == property.Name)
955955
{

0 commit comments

Comments
 (0)