diff --git a/ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs b/ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs index 037de43a3..aafccba14 100644 --- a/ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs @@ -663,6 +663,10 @@ namespace ICSharpCode.Decompiler.CSharp // virtual bool Equals(R? other) { // return other != null && EqualityContract == other.EqualityContract && EqualityComparer.Default.Equals(A, other.A) && ...; // } + // Starting with Roslyn 3.10, it's: + // virtual bool Equals(R? other) { + // return this == other || other != null && EqualityContract == other.EqualityContract && EqualityComparer.Default.Equals(A, other.A) && ...; + // } Debug.Assert(method.Name == "Equals" && method.Parameters.Count == 1); if (method.Parameters.Count != 1) return false; @@ -680,6 +684,17 @@ namespace ICSharpCode.Decompiler.CSharp var variables = body.Ancestors.OfType().Single().Variables; var other = variables.Single(v => v.Kind == VariableKind.Parameter && v.Index == 0); Debug.Assert(IsRecordType(other.Type)); + if (returnValue.MatchLogicOr(out var lhs, out var rhs)) + { + // this == other || ... + if (!lhs.MatchCompEquals(out var compLeft, out var compRight)) + return false; + if (!compLeft.MatchLdThis()) + return false; + if (!compRight.MatchLdLoc(other)) + return false; + returnValue = rhs; + } var conditions = UnpackLogicAndChain(returnValue); Debug.Assert(conditions.Count >= 1); int pos = 0; diff --git a/packages.props b/packages.props index eb8beb3ed..3db4af6a5 100644 --- a/packages.props +++ b/packages.props @@ -10,7 +10,7 @@ 5.0.0 5.0.1 5.0.0 - 3.9.0 + 3.10.0-3.final 0.11.3 6.1.1 3.12.0