Browse Source

Fixed bug that could cause SharpDevelop to treat two overloads as equal if they had the same parameter names but different parameter types.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2493 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
cbd6e0765c
  1. 13
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultParameter.cs

13
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultParameter.cs

@ -146,11 +146,16 @@ namespace ICSharpCode.SharpDevelop.Dom
// two parameters are equal if they have the same return type // two parameters are equal if they have the same return type
// (they may have different names) // (they may have different names)
if (object.Equals(ReturnType, value.ReturnType)) if (object.Equals(ReturnType, value.ReturnType)) {
return 0; return 0;
else } else {
return string.Compare(this.Name, value.Name); // if the parameters are not equal, use the parameter name to provide the ordering
// if the parameters are not equal, use the parameter name to provide the ordering int r = string.Compare(this.Name, value.Name);
if (r != 0)
return r;
else
return -1; // but equal names don't make parameters of different return types equal
}
} }
int IComparable.CompareTo(object value) int IComparable.CompareTo(object value)

Loading…
Cancel
Save