diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/AbstractClassTypeConstructor.java b/core/descriptors/src/org/jetbrains/jet/lang/types/AbstractClassTypeConstructor.java index 81a30ff3347..6bb5ffe86e0 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/AbstractClassTypeConstructor.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/AbstractClassTypeConstructor.java @@ -36,9 +36,16 @@ public abstract class AbstractClassTypeConstructor implements TypeConstructor { public static boolean equals(@NotNull TypeConstructor me, Object other) { if (!(other instanceof TypeConstructor)) return false; + ClassifierDescriptor myDescriptor = me.getDeclarationDescriptor(); ClassifierDescriptor otherDescriptor = ((TypeConstructor) other).getDeclarationDescriptor(); + // All error types have the same descriptor + if (myDescriptor != null && ErrorUtils.isError(myDescriptor) + || otherDescriptor != null && ErrorUtils.isError(otherDescriptor)) { + return me == other; + } + if (myDescriptor == otherDescriptor) return true; if (myDescriptor instanceof ClassDescriptor && otherDescriptor instanceof ClassDescriptor) { @@ -51,8 +58,9 @@ public abstract class AbstractClassTypeConstructor implements TypeConstructor { } public static int hashCode(@NotNull TypeConstructor me) { - if (me.getDeclarationDescriptor() instanceof ClassDescriptor) { - ClassDescriptor classDescriptor = (ClassDescriptor) me.getDeclarationDescriptor(); + ClassifierDescriptor descriptor = me.getDeclarationDescriptor(); + if (descriptor instanceof ClassDescriptor && !ErrorUtils.isError(descriptor)) { + ClassDescriptor classDescriptor = (ClassDescriptor) descriptor; return DescriptorUtils.getFqName(classDescriptor).hashCode(); } return System.identityHashCode(me);