From 5776fec84c58bf9494cb4d788921998ae9e994b8 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Wed, 28 Mar 2012 18:57:52 +0400 Subject: [PATCH] EA-34595 - ISE: MutableClassDescriptorLite.addSupertype --- .../descriptors/MutableClassDescriptorLite.java | 14 +++++++------- .../regressions/TypeParameterAsASupertype.jet | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.jet diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java index 30310236120..62b9c75a7ac 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java @@ -17,13 +17,15 @@ package org.jetbrains.jet.lang.descriptors; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.resolve.BindingTrace; -import org.jetbrains.jet.lang.resolve.scopes.*; +import org.jetbrains.jet.lang.resolve.scopes.InnerClassesScopeWrapper; +import org.jetbrains.jet.lang.resolve.scopes.JetScope; +import org.jetbrains.jet.lang.resolve.scopes.SubstitutingScope; +import org.jetbrains.jet.lang.resolve.scopes.WritableScope; import org.jetbrains.jet.lang.resolve.scopes.receivers.ClassReceiver; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.jetbrains.jet.lang.types.*; @@ -277,10 +279,10 @@ public class MutableClassDescriptorLite extends MutableDeclarationDescriptor imp public void addSupertype(@NotNull JetType supertype) { if (!ErrorUtils.isErrorType(supertype)) { - if (!(supertype.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) { - throw new IllegalStateException(); + if (TypeUtils.getClassDescriptor(supertype) != null) { + // See the Errors.SUPERTYPE_NOT_A_CLASS_OR_TRAIT + supertypes.add(supertype); } - supertypes.add(supertype); } } @@ -301,7 +303,6 @@ public class MutableClassDescriptorLite extends MutableDeclarationDescriptor imp } } - @NotNull @Override public ReceiverDescriptor getImplicitReceiver() { @@ -311,7 +312,6 @@ public class MutableClassDescriptorLite extends MutableDeclarationDescriptor imp return implicitReceiver; } - @Override public String toString() { try { diff --git a/compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.jet b/compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.jet new file mode 100644 index 00000000000..7ec391494ae --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/TypeParameterAsASupertype.jet @@ -0,0 +1 @@ +class A : T {} \ No newline at end of file