FIR checker: report AMBIGUOUS_SUPER

This commit is contained in:
Tianyu Geng
2021-07-19 15:13:39 -07:00
committed by Ivan Kochurkin
parent 5b9ce7e823
commit 06ee84f809
20 changed files with 59 additions and 27 deletions
@@ -1,6 +1,6 @@
enum class E : Cloneable {
A;
<!OVERRIDING_FINAL_MEMBER!>override<!> fun clone(): Any {
return super.<!UNRESOLVED_REFERENCE!>clone<!>()
return <!AMBIGUOUS_SUPER!>super<!>.clone()
}
}
@@ -13,7 +13,7 @@ class GenericDerivedClass<T> : GenericBaseClass<T>(), GenericBaseInterface<T> {
override fun bar(x: T): T = super.bar(x)
override fun ambiguous(x: T): T =
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>(x)
<!AMBIGUOUS_SUPER!>super<!>.ambiguous(x)
}
class SpecializedDerivedClass : GenericBaseClass<Int>(), GenericBaseInterface<String> {
@@ -21,9 +21,9 @@ class SpecializedDerivedClass : GenericBaseClass<Int>(), GenericBaseInterface<St
override fun bar(x: String): String = super.bar(x)
override fun ambiguous(x: String): String =
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>(x)
<!AMBIGUOUS_SUPER!>super<!>.ambiguous(x)
override fun ambiguous(x: Int): Int =
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>(x)
<!AMBIGUOUS_SUPER!>super<!>.ambiguous(x)
}
class MixedDerivedClass<T> : GenericBaseClass<Int>(), GenericBaseInterface<T> {
@@ -31,7 +31,7 @@ class MixedDerivedClass<T> : GenericBaseClass<Int>(), GenericBaseInterface<T> {
override fun bar(x: T): T = super.bar(x)
override fun ambiguous(x: Int): Int =
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>(x)
<!AMBIGUOUS_SUPER!>super<!>.ambiguous(x)
override fun ambiguous(x: T): T =
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>(x)
<!AMBIGUOUS_SUPER!>super<!>.ambiguous(x)
}
@@ -45,13 +45,13 @@ class Derived : Base(), Interface {
super.prop
fun getAmbiguousSuperProp(): Int =
super.<!UNRESOLVED_REFERENCE!>ambiguousProp<!>
<!AMBIGUOUS_SUPER!>super<!>.ambiguousProp
fun callsFunFromSuperInterface() {
super.bar()
}
fun callsAmbiguousSuperFun() {
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>()
<!AMBIGUOUS_SUPER!>super<!>.ambiguous()
}
}
@@ -34,6 +34,6 @@ class B : A(), I {
}
override fun qux() {
super.<!UNRESOLVED_REFERENCE!>qux<!>()
<!AMBIGUOUS_SUPER!>super<!>.qux()
}
}
@@ -13,7 +13,7 @@ interface InterfaceWithFun {
class DerivedUsingFun : BaseWithCallableProp(), InterfaceWithFun {
fun foo(): String =
super.<!UNRESOLVED_REFERENCE!>fn<!>()
<!AMBIGUOUS_SUPER!>super<!>.fn()
override fun bar(): String =
super.bar()
@@ -31,4 +31,4 @@ class C : A(), B {
super@D.qux()
}
}
}
}
@@ -20,9 +20,9 @@ interface AnotherInterface {
interface DerivedInterface: Interface, AnotherInterface {
override fun foo() { super.foo() }
override fun ambiguous() {
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>()
<!AMBIGUOUS_SUPER!>super<!>.ambiguous()
}
override val ambiguousProp: Int
get() = super.<!UNRESOLVED_REFERENCE!>ambiguousProp<!>
get() = <!AMBIGUOUS_SUPER!>super<!>.ambiguousProp
}
@@ -41,13 +41,13 @@ class ClassDerivedFromUnresolved : Base(), Interface, <!UNRESOLVED_REFERENCE!>Un
super.prop
fun getAmbiguousSuperProp(): Int =
super.<!UNRESOLVED_REFERENCE!>ambiguousProp<!>
<!AMBIGUOUS_SUPER!>super<!>.ambiguousProp
fun callsFunFromSuperInterface() {
super.bar()
}
fun callsAmbiguousSuperFun() {
super.<!UNRESOLVED_REFERENCE!>ambiguous<!>()
<!AMBIGUOUS_SUPER!>super<!>.ambiguous()
}
}