Files
kotlin-fork/compiler/testData/ir/irText/expressions/funInterface/partialSam.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

67 lines
1.3 KiB
Plaintext
Vendored

fun interface Fn<T : Any?, R : Any?> {
abstract fun run(s: String, i: Int, t: T): R
}
class J {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
fun runConversion(f1: Fn<String, Int>, f2: Fn<Int, String>): Int {
return f1.run(s = "Bar", i = 1, t = f2.run(s = "Foo", i = 42, t = 239))
}
}
val fsi: Fn<String, Int>
field = { // BLOCK
local class <no name provided> : Fn<String, Int> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun run(s: String, i: Int, t: String): Int {
return 1
}
}
<no name provided>()
}
get
val fis: Fn<Int, String>
field = { // BLOCK
local class <no name provided> : Fn<Int, String> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
override fun run(s: String, i: Int, t: Int): String {
return ""
}
}
<no name provided>()
}
get
fun test(j: J) {
j.runConversion(f1 = <get-fsi>(), f2 = local fun <anonymous>(s: String, i: Int, ti: Int): String {
return ""
}
/*-> Fn<Int, String> */) /*~> Unit */
j.runConversion(f1 = local fun <anonymous>(s: String, i: Int, ts: String): Int {
return 1
}
/*-> Fn<String, Int> */, f2 = <get-fis>()) /*~> Unit */
}