[FIR] Properly handle callable references which were resolved with error

This commit is contained in:
Dmitriy Novozhilov
2021-04-15 14:06:30 +03:00
parent 450fb5e915
commit e869f8091a
74 changed files with 377 additions and 312 deletions
@@ -0,0 +1,25 @@
FILE: leakedImplicitType.kt
public final class Foo : R|kotlin/Any| {
public constructor(): R|Foo| {
super<R|kotlin/Any|>()
}
public final fun bar(): R|kotlin/Unit| {
}
public final fun f(): R|ERROR CLASS: Unresolved reference: bar| {
^f <Unresolved name: Unresolved>#()::<Unresolved reference: bar>#
}
}
public abstract interface IA : R|kotlin/Any| {
}
public abstract interface IB : R|IA| {
}
public final fun R|IA|.extFun(x: R|IB|): R|kotlin/Unit| {
}
public final fun R|IB|.extFun(x: R|IA|): R|kotlin/Unit| {
}
public final fun testWithExpectedType(): R|kotlin/Unit| {
lval extFun_AA_B: R|IA.(IA) -> kotlin/Unit| = Q|IB|::<Unresolved reference: extFun>#
}
@@ -0,0 +1,18 @@
// ISSUE: KT-46072
// Case 1
class Foo {
fun bar() {}
fun f() = <!UNRESOLVED_REFERENCE!>Unresolved<!>()::bar // Type of Unresolved()::bar is implicit
}
// Case 2
interface IA
interface IB : IA
fun IA.extFun(x: IB) {}
fun IB.extFun(x: IA) {}
fun testWithExpectedType() {
val extFun_AA_B: IA.(IA) -> Unit = IB::<!UNRESOLVED_REFERENCE!>extFun<!> // extFun is unresolved, type of IB::extFun is implicit
}
@@ -40,8 +40,8 @@ FILE: referenceToExtension.kt
}
public final fun test_2(): R|kotlin/Unit| {
lval extensionValRef: <ERROR TYPE REF: No result type for initializer> = Q|GenericTest.B|::<Unresolved name: extensionVal>#
lval extensionFunRef: <ERROR TYPE REF: No result type for initializer> = Q|GenericTest.B|::<Unresolved name: extensionFun>#
lval extensionValRef: R|ERROR CLASS: Unresolved reference: extensionVal| = Q|GenericTest.B|::<Unresolved reference: extensionVal>#
lval extensionFunRef: R|ERROR CLASS: Unresolved reference: extensionFun| = Q|GenericTest.B|::<Unresolved reference: extensionFun>#
}
}
@@ -0,0 +1,13 @@
FILE: referenceToField.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final val x: R|kotlin/Int| = Int(1)
public get(): R|kotlin/Int| {
::F|/A.x|
^ this@R|/A|.F|/A.x|
}
}
@@ -0,0 +1,7 @@
class A {
val x: Int = 1
get() {
::<!UNSUPPORTED!>field<!>
return field
}
}