KT-156 Fix the this<Super> syntax
This commit is contained in:
+3
-1
@@ -365,7 +365,9 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
context.trace.report(AMBIGUOUS_SUPER.on(expression));
|
context.trace.report(AMBIGUOUS_SUPER.on(expression));
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
if (result != null) {
|
||||||
|
|||||||
+15
@@ -60,3 +60,18 @@ class CG : G<Int> {
|
|||||||
super<<!NOT_A_SUPERTYPE!>G<String><!>>.foo() // Error
|
super<<!NOT_A_SUPERTYPE!>G<String><!>>.foo() // Error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The case when no supertype is resolved
|
||||||
|
class ERROR<E>() : <!UNRESOLVED_REFERENCE!>UR<!> {
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
super.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No supertype at all
|
||||||
|
class A1 {
|
||||||
|
fun test() {
|
||||||
|
super.equals(null)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user