FIR resolve: add extra test & comments to multiple receiver resolve

This commit is contained in:
Mikhail Glukhikh
2019-04-18 10:57:23 +03:00
parent d1b8ca31c0
commit ab258767f8
6 changed files with 58 additions and 2 deletions
@@ -10,15 +10,21 @@ class Foo {
class Bar {
val x = ""
// NB: unused
fun Foo.abc() = x
fun bar(): Bar = this
// NB: unused
operator fun String.plus(bar: Bar): String {
return ""
}
// NB! abc() here is resolved to member Foo.abc(), and not to extension member of Bar
fun Foo.check() = abc() + bar()
// NB! + here is resolved to member String.plus (not to extension member above)
fun Foo.check2() = "" + bar()
}
fun Foo.ext() = x
@@ -40,6 +40,10 @@ FILE: access.kt
^check R|/Foo.abc|().<Inapplicable(INAPPLICABLE): [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(R|/bar|())
}
public final fun R|Foo|.check2(): R|kotlin/String| {
^check2 String().R|kotlin/String.plus|(R|/bar|())
}
}
public final fun R|Foo|.ext(): R|kotlin/Int| {
^ext R|/Foo.x|
@@ -0,0 +1,15 @@
class Foo {
fun bar(arg: Bar) {
arg.foo()
}
}
fun Bar.foo() {}
class Bar {
fun Foo.foo() {}
fun bar(arg: Foo) {
arg.foo()
}
}
@@ -0,0 +1,26 @@
FILE: memberExtension.kt
public final class Foo : R|kotlin/Any| {
public constructor(): R|Foo| {
super<R|kotlin/Any|>()
}
public final fun bar(arg: R|Bar|): R|kotlin/Unit| {
R|<local>/arg|.R|/foo|()
}
}
public final fun R|Bar|.foo(): R|kotlin/Unit| {
}
public final class Bar : R|kotlin/Any| {
public constructor(): R|Bar| {
super<R|kotlin/Any|>()
}
public final fun R|Foo|.foo(): R|kotlin/Unit| {
}
public final fun bar(arg: R|Foo|): R|kotlin/Unit| {
R|<local>/arg|.R|/Bar.foo|()
}
}