FIR: make override resolve in use-site session (and module)

Related to KT-24078
This commit is contained in:
Mikhail Glukhikh
2019-01-30 10:54:27 +03:00
parent 84b3a17e2b
commit b3c8e83c58
11 changed files with 191 additions and 9 deletions
@@ -0,0 +1,5 @@
expect class MyList {
fun get(i: Int): Int
}
open class Wrapper(val list: MyList)
@@ -0,0 +1,14 @@
FILE: common.kt
public final expect class MyList {
public constructor(): super<R|kotlin/Any|>()
public final function get(i: R|kotlin/Int|): R|kotlin/Int|
}
public open class Wrapper {
public constructor(list: R|MyList|): super<R|kotlin/Any|>()
public final property list(val): R|MyList|
public get(): R|MyList|
}
+26
View File
@@ -0,0 +1,26 @@
actual class MyList {
actual fun get(i: Int): Int = i
fun set(i: Int, v: Int) {}
}
class DerivedList : MyList() {
fun useMember() {
get(1)
set(2, 3)
}
}
fun useList(list: MyList) {
// We should deal with receiver to resolve this
list.get(1)
list.set(2, 3)
}
class DerivedWrapper : Wrapper() {
fun use() {
// We should deal with receiver to resolve this
list.get(1)
list.set(2, 3)
}
}
+34
View File
@@ -0,0 +1,34 @@
FILE: jvm.kt
public final actual class MyList {
public constructor(): super<R|kotlin/Any|>()
public final actual function get(i: R|kotlin/Int|): R|kotlin/Int| {
return@@@get <Unresolved name: i>#
}
public final function set(i: R|kotlin/Int|, v: R|kotlin/Int|): R|kotlin/Unit| {
}
}
public final class DerivedList : R|MyList| {
public constructor(): super<R|MyList|>()
public final function useMember(): R|kotlin/Unit| {
R|/MyList.get|(Int(1))
R|/MyList.set|(Int(2), Int(3))
}
}
public final function useList(list: R|MyList|): R|kotlin/Unit| {
<Unresolved name: list>#.<Unresolved name: get>#(Int(1))
<Unresolved name: list>#.<Unresolved name: set>#(Int(2), Int(3))
}
public final class DerivedWrapper : R|Wrapper| {
public constructor(): super<R|Wrapper|>()
public final function use(): R|kotlin/Unit| {
<Unresolved name: list>#.<Unresolved name: get>#(Int(1))
<Unresolved name: list>#.<Unresolved name: set>#(Int(2), Int(3))
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ FILE: jvm.kt
public final function test(): R|kotlin/Unit| {
R|/A.foo|()
<Unresolved name: bar>#()
R|/A.bar|()
}
}
@@ -0,0 +1,5 @@
expect open class A() {
fun foo()
}
open class B : A()
@@ -0,0 +1,11 @@
FILE: common.kt
public open expect class A {
public constructor(): super<R|kotlin/Any|>()
public final function foo(): R|kotlin/Unit|
}
public open class B : R|A| {
public constructor(): super<R|A|>()
}
+30
View File
@@ -0,0 +1,30 @@
abstract class X {
fun bar() {}
}
interface Y {
fun baz() {}
}
actual open class A : X(), Y {
actual fun foo() {}
}
class C : B() {
fun test() {
foo()
// This cannot be resolved yet due to lack of search symbols / projections
bar()
// This cannot be resolved yet due to lack of interface lookup
baz()
}
}
class D : A() {
fun test() {
foo()
bar()
// This cannot be resolved yet due to lack of interface lookup
baz()
}
}
+40
View File
@@ -0,0 +1,40 @@
FILE: jvm.kt
public abstract class X {
public constructor(): super<R|kotlin/Any|>()
public final function bar(): R|kotlin/Unit| {
}
}
public abstract interface Y {
public open function baz(): R|kotlin/Unit| {
}
}
public open actual class A : R|X|, R|Y| {
public constructor(): super<R|X|>()
public final actual function foo(): R|kotlin/Unit| {
}
}
public final class C : R|B| {
public constructor(): super<R|B|>()
public final function test(): R|kotlin/Unit| {
R|/A.foo|()
<Unresolved name: bar>#()
<Unresolved name: baz>#()
}
}
public final class D : R|A| {
public constructor(): super<R|A|>()
public final function test(): R|kotlin/Unit| {
R|/A.foo|()
R|/X.bar|()
<Unresolved name: baz>#()
}
}