diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/AbstractReturnType.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/AbstractReturnType.cs index bdbc2dc4ab..fc6ea82afb 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/AbstractReturnType.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/AbstractReturnType.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Dom { IReturnType rt = o as IReturnType; if (rt == null) return false; - return rt.IsDefaultReturnType && this.FullyQualifiedName == rt.FullyQualifiedName && this.TypeParameterCount == rt.TypeParameterCount; + return rt.IsDefaultReturnType && DefaultReturnType.Equals(this, rt); } public override int GetHashCode() diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs index 4939a89dfb..986887abaa 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs @@ -17,6 +17,11 @@ namespace ICSharpCode.SharpDevelop.Dom /// public class DefaultReturnType : AbstractReturnType { + public static bool Equals(IReturnType rt1, IReturnType rt2) + { + return rt1.FullyQualifiedName == rt2.FullyQualifiedName && rt1.TypeParameterCount == rt2.TypeParameterCount; + } + IClass c; public DefaultReturnType(IClass c) diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/GetClassReturnType.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/GetClassReturnType.cs index 2ee45cdf5c..18c283ce73 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/GetClassReturnType.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/GetClassReturnType.cs @@ -41,15 +41,11 @@ namespace ICSharpCode.SharpDevelop.Dom public override bool Equals(object o) { - GetClassReturnType rt = o as GetClassReturnType; - if (rt == null) { - IReturnType rt2 = o as IReturnType; - if (rt2 != null && rt2.IsDefaultReturnType) - return rt2.FullyQualifiedName == fullName && rt2.TypeParameterCount == this.TypeParameterCount; - else - return false; - } - return fullName == rt.fullName && typeParameterCount == rt.typeParameterCount && content == rt.content; + IReturnType rt = o as IReturnType; + if (rt != null && rt.IsDefaultReturnType) + return DefaultReturnType.Equals(this, rt); + else + return false; } public override int GetHashCode() diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/SearchClassReturnType.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/SearchClassReturnType.cs index b63108d3eb..c3f222b0ab 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/SearchClassReturnType.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/SearchClassReturnType.cs @@ -49,21 +49,9 @@ namespace ICSharpCode.SharpDevelop.Dom public override bool Equals(object o) { - SearchClassReturnType rt = o as SearchClassReturnType; - if (rt != null) { - if (name != rt.name) - return false; - if (declaringClass.FullyQualifiedName == rt.declaringClass.FullyQualifiedName - && typeParameterCount == rt.typeParameterCount - && caretLine == rt.caretLine - && caretColumn == rt.caretColumn) - { - return true; - } - } IReturnType rt2 = o as IReturnType; if (rt2 != null && rt2.IsDefaultReturnType) - return rt2.FullyQualifiedName == this.FullyQualifiedName && rt2.TypeParameterCount == this.TypeParameterCount; + return DefaultReturnType.Equals(this, rt2); else return false; }