diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java index 6828fada9ce..74466a6e266 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java @@ -365,7 +365,9 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { context.trace.report(AMBIGUOUS_SUPER.on(expression)); } else { - result = substitutor.substitute(supertypes.iterator().next(), Variance.INVARIANT); + // supertypes may be empty when all the supertypes are error types (are not resolved, for example) + JetType type = supertypes.isEmpty() ? JetStandardClasses.getAnyType() : supertypes.iterator().next(); + result = substitutor.substitute(type, Variance.INVARIANT); } } if (result != null) { diff --git a/idea/testData/checkerWithErrorTypes/quick/Super.jet b/compiler/testData/checkerWithErrorTypes/quick/Super.jet similarity index 86% rename from idea/testData/checkerWithErrorTypes/quick/Super.jet rename to compiler/testData/checkerWithErrorTypes/quick/Super.jet index 65087a0a4d4..5ec4cfdcb00 100644 --- a/idea/testData/checkerWithErrorTypes/quick/Super.jet +++ b/compiler/testData/checkerWithErrorTypes/quick/Super.jet @@ -60,3 +60,18 @@ class CG : G { super<G>.foo() // Error } } + +// The case when no supertype is resolved +class ERROR() : UR { + + fun test() { + super.foo() + } +} + +// No supertype at all +class A1 { + fun test() { + super.equals(null) + } +} \ No newline at end of file