Files
kotlin-fork/compiler/testData/ir/irText/expressions/callableReferences/unboundMemberReferenceWithAdaptedArguments.fir.kt.txt
T
Vladimir Sukharev ff174dbad9 [FIR2IR] Provide reflection target to adapted function references
^KT-60259 Fixed

Merge-request: KT-MR-11182
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-07-26 19:08:11 +00:00

63 lines
788 B
Kotlin
Vendored

fun use1(fn: Function2<A, Int, Unit>) {
}
fun use2(fn: Function1<Int, Unit>) {
}
open class A {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
open fun foo(vararg xs: Int): Int {
return 1
}
}
object Obj : A {
private constructor() /* primary */ {
super/*A*/()
/* <init>() */
}
override fun foo(vararg xs: Int): Int {
return 1
}
}
fun testUnbound() {
use1(fn = { // BLOCK
local fun foo(p0: A, p1: Int) {
p0.foo(xs = [p1])
}
::foo
})
}
fun testBound(a: A) {
use2(fn = { // BLOCK
local fun A.foo(p0: Int) {
receiver.foo(xs = [p0])
}
a::foo
})
}
fun testObject() {
use2(fn = { // BLOCK
local fun Obj.foo(p0: Int) {
receiver.foo(xs = [p0])
}
Obj::foo
})
}