Files
kotlin-fork/compiler/testData/ir/irText/expressions/callableReferences/constructorWithAdaptedArguments.kt.txt
T
Dmitriy Novozhilov b454fcc1e0 [FIR] Save IR dumps to .ir.txt files instead of .txt in tests
This is needed to avoid clashes between different dumps from different
  handlers
2021-10-12 17:26:36 +03:00

61 lines
936 B
Plaintext
Vendored

fun use(fn: Function1<Int, Any>): Any {
return fn.invoke(p1 = 42)
}
class C {
constructor(vararg xs: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
}
class Outer {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
inner class Inner {
constructor(vararg xs: Int) /* primary */ {
super/*Any*/()
/* <init>() */
}
}
}
fun testConstructor(): Any {
return use(fn = { // BLOCK
local fun <init>(p0: Int): C {
return C(xs = [p0])
}
::<init>
})
}
fun testInnerClassConstructor(outer: Outer): Any {
return use(fn = { // BLOCK
local fun Outer.<init>(p0: Int): Inner {
return receiver.Inner(xs = [p0])
}
outer::<init>
})
}
fun testInnerClassConstructorCapturingOuter(): Any {
return use(fn = { // BLOCK
local fun Outer.<init>(p0: Int): Inner {
return receiver.Inner(xs = [p0])
}
Outer()::<init>
})
}