diff --git a/ICSharpCode.NRefactory/TypeSystem/IType.cs b/ICSharpCode.NRefactory/TypeSystem/IType.cs
index 0a77c83650..a4bb020688 100644
--- a/ICSharpCode.NRefactory/TypeSystem/IType.cs
+++ b/ICSharpCode.NRefactory/TypeSystem/IType.cs
@@ -23,6 +23,9 @@ namespace ICSharpCode.NRefactory.TypeSystem
///
/// Gets the element type of array or pointer types.
///
+ ///
+ /// This type is not an array or pointer type.
+ ///
IType GetElementType();
///
diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs
index ca2cad3b4e..b421aeb4f6 100644
--- a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs
+++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs
@@ -386,10 +386,15 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
if (other == null)
return false;
if (declaringTypeDefinition != null) {
- return declaringTypeDefinition.Equals(other.DeclaringTypeDefinition) && this.Name == other.Name && this.TypeParameterCount == other.TypeParameterCount;
+ return declaringTypeDefinition.Equals(other.DeclaringTypeDefinition)
+ && this.Name == other.Name
+ && this.TypeParameterCount == other.TypeParameterCount;
} else {
- return other.DeclaringTypeDefinition == null && this.ProjectContent == other.ProjectContent
- && this.Namespace == other.Namespace && this.Name == other.Name && this.TypeParameterCount == other.TypeParameterCount;
+ return other.DeclaringTypeDefinition == null
+ && this.ProjectContent == other.ProjectContent
+ && this.Namespace == other.Namespace
+ && this.Name == other.Name
+ && this.TypeParameterCount == other.TypeParameterCount;
}
}
diff --git a/ICSharpCode.NRefactory/TypeSystem/SharedTypes.cs b/ICSharpCode.NRefactory/TypeSystem/SharedTypes.cs
index 9b28835582..c30988d05b 100644
--- a/ICSharpCode.NRefactory/TypeSystem/SharedTypes.cs
+++ b/ICSharpCode.NRefactory/TypeSystem/SharedTypes.cs
@@ -22,5 +22,23 @@ namespace ICSharpCode.NRefactory.TypeSystem
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "It's immutable")]
public readonly static IType Null = new NullType();
+
+ /*
+ * I'd like to define static instances for common types like
+ * void, int, etc.; but there are two problems with this:
+ *
+ * SharedTypes.Void.GetDefinition().ProjectContent should return mscorlib, but
+ * we can't do that without providing a context.
+ * Assuming we add a context parameter to GetDefinition():
+ *
+ * SharedType.Void.Equals(SharedType.Void.GetDefinition(x))
+ * SharedType.Void.GetDefinition(y).Equals(SharedType.Void)
+ * should both return true.
+ * But if the type can have multiple definitions (multiple mscorlib versions loaded),
+ * then this is not possible without violating transitivity of Equals():
+ *
+ * SharedType.Void.GetDefinition(x).Equals(SharedType.Void.GetDefinition(y))
+ * would have to return true even though these are two distinct definitions.
+ */
}
}