Replace some REFERENCE_TARGET calls with RESOLVED_CALL
Also don't do unnecessary and failing casts in CodegenAnnotatingVisitor for SAM adapters #KT-3173 Fixed #KT-3999 Fixed #KT-4682 Fixed
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
fun box(): String {
|
||||
val sum = {Int.(other: Int) -> this + other }
|
||||
return if (1 sum 2 == 3) "OK" else "Fail"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
class A() {
|
||||
fun A.invoke(a: A) = "$this ${this@A} $a"
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
val a = A()
|
||||
val b = A()
|
||||
val c = A()
|
||||
a.b(c)
|
||||
a b c
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val a: ExtensionFunction1<*, *, *>.(ExtensionFunction1<*, *, *>)->Unit = {}
|
||||
val b: ExtensionFunction1<*, *, *>.(ExtensionFunction1<*, *, *>)->Unit = {"$this $it"}
|
||||
val c: ExtensionFunction1<*, *, *>.(ExtensionFunction1<*, *, *>)->Unit = {}
|
||||
a.b(c)
|
||||
a b c
|
||||
}
|
||||
|
||||
fun Int.foo(a: Int) = this * a
|
||||
val boo = {Int.(a: Int): Int -> this + a}
|
||||
|
||||
fun box(): String {
|
||||
test1()
|
||||
test2()
|
||||
1 foo 2
|
||||
3 boo 4
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fun foo(compareTo: Any.(p: Function0<Int>) -> Int, p: () -> Int) {
|
||||
p < p
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo({ it() }, { 42 })
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class A
|
||||
|
||||
fun foo(plusAssign: A.(A) -> Unit) {
|
||||
A() += A()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo { }
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user