[FIR] Support several super-related diagnostics

This commit is contained in:
Nick
2020-03-27 03:18:03 +03:00
committed by Mikhail Glukhikh
parent 5570a5fe74
commit b38d30bab0
23 changed files with 456 additions and 27 deletions
@@ -0,0 +1,10 @@
class A {
fun f() {}
}
class B : A {
fun g() {
<!NOT_A_SUPERTYPE!>super<String><!>.<!UNRESOLVED_REFERENCE!>f<!>()
super<A>.f()
}
}
@@ -0,0 +1,21 @@
FILE: notASupertype.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun f(): R|kotlin/Unit| {
}
}
public final class B : R|A| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
public final fun g(): R|kotlin/Unit| {
super<R|kotlin/String|>.<Unresolved name: f>#()
super<R|A|>.R|/A.f|()
}
}
@@ -0,0 +1,20 @@
fun String.f() {
<!NO_SUPERTYPE, NO_SUPERTYPE, SUPER_NOT_AVAILABLE!>super@f<!>.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
<!NO_SUPERTYPE, NO_SUPERTYPE, SUPER_NOT_AVAILABLE!>super<!>.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
}
fun foo() {
<!NO_SUPERTYPE, NO_SUPERTYPE, SUPER_NOT_AVAILABLE!>super<!>
<!NO_SUPERTYPE, NO_SUPERTYPE, SUPER_NOT_AVAILABLE!>super<!>.<!UNRESOLVED_REFERENCE!>foo<!>()
<!SUPER_NOT_AVAILABLE!>super<Nothing><!>.<!UNRESOLVED_REFERENCE!>foo<!>()
}
class A {
fun act() {
<!UNRESOLVED_REFERENCE!>println<!>("Test")
}
fun String.fact() {
<!UNRESOLVED_REFERENCE!>println<!>("Fest")
}
}
@@ -0,0 +1,24 @@
FILE: superNotAvailable.kt
public final fun R|kotlin/String|.f(): R|kotlin/Unit| {
super<<ERROR TYPE REF: No super type>>.<Unresolved name: compareTo>#(String())
super<<ERROR TYPE REF: No super type>>.<Unresolved name: compareTo>#(String())
}
public final fun foo(): R|kotlin/Unit| {
super<<ERROR TYPE REF: No super type>>
super<<ERROR TYPE REF: No super type>>.<Unresolved name: foo>#()
super<R|kotlin/Nothing|>.<Unresolved name: foo>#()
}
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun act(): R|kotlin/Unit| {
<Unresolved name: println>#(String(Test))
}
public final fun R|kotlin/String|.fact(): R|kotlin/Unit| {
<Unresolved name: println>#(String(Fest))
}
}
@@ -0,0 +1,9 @@
open class A {
open fun foo() {}
}
interface ATrait : A {
override fun foo() {
<!SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE!>super<A><!>.foo()
}
}
@@ -0,0 +1,16 @@
FILE: superclassNotAccessibleFromInterface.kt
public open class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public open fun foo(): R|kotlin/Unit| {
}
}
public abstract interface ATrait : R|A| {
public open override fun foo(): R|kotlin/Unit| {
super<R|A|>.R|/A.foo|()
}
}