FIR: partially implement invoke resolution
This commit is contained in:
+2
-2
@@ -13,8 +13,8 @@ FILE: explicitReceiver.kt
|
||||
^invoke this#
|
||||
}
|
||||
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
^bar R|/x|()
|
||||
public final fun bar(): R|Foo| {
|
||||
^bar R|/Foo.x|.R|/Foo.invoke|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ FILE: explicitReceiver2.kt
|
||||
public final val x: R|Bar| = R|/Bar.Bar|()
|
||||
public get(): R|Bar|
|
||||
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
^bar R|/x|()
|
||||
public final fun bar(): R|Foo| {
|
||||
^bar R|/Foo.x|.R|/Bar.invoke|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@ class Foo {
|
||||
|
||||
val x = 0
|
||||
|
||||
fun foo() = x()
|
||||
fun foo() = x() // should resolve to invoke
|
||||
}
|
||||
+1
-1
@@ -8,5 +8,5 @@ class Foo {
|
||||
|
||||
val x = 0
|
||||
|
||||
fun foo() = x()
|
||||
fun foo() = x() // should resolve to fun x
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
class A {
|
||||
fun bar() = foo()
|
||||
fun bar() = foo() // should resolve to invoke
|
||||
|
||||
fun invoke() = this
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ FILE: implicitTypeOrder.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun bar(): <ERROR TYPE REF: Unresolved name: foo> {
|
||||
^bar <Unresolved name: foo>#()
|
||||
public final fun bar(): R|A| {
|
||||
^bar R|/foo|.R|/A.invoke|()
|
||||
}
|
||||
|
||||
public final fun invoke(): R|A| {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class Simple {
|
||||
operator fun invoke(): String = "invoke"
|
||||
}
|
||||
|
||||
fun test(s: Simple) {
|
||||
val result = s()
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
FILE: simple.kt
|
||||
public final class Simple : R|kotlin/Any| {
|
||||
public constructor(): R|Simple| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final operator fun invoke(): R|kotlin/String| {
|
||||
^invoke String(invoke)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(s: R|Simple|): R|kotlin/Unit| {
|
||||
lval result: R|kotlin/String| = R|<local>/s|.R|/Simple.invoke|()
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
fun <T> simpleRun(f: (T) -> Unit): Unit = f()
|
||||
fun <T> simpleRun(f: (T) -> Unit): Unit = f(return)
|
||||
|
||||
fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
FILE: functionTypes.kt
|
||||
public final fun <T> simpleRun(f: R|kotlin/Function1<T, kotlin/Unit>|): R|kotlin/Unit| {
|
||||
^simpleRun <Unresolved name: f>#()
|
||||
^simpleRun R|<local>/f|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(^simpleRun Unit)
|
||||
}
|
||||
public final fun <T, R> R|kotlin/collections/List<T>|.simpleMap(f: R|kotlin/Function1<T, R>|): R|R| {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user