28 lines
734 B
Kotlin
Vendored
28 lines
734 B
Kotlin
Vendored
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
|
// TARGET_BACKEND: JVM
|
|
// IGNORE_BACKEND: JVM_IR
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// WITH_RUNTIME
|
|
|
|
fun interface Fn<T, R> {
|
|
fun run(s: String, i: Int, t: T): R
|
|
}
|
|
|
|
class J {
|
|
fun runConversion(f1: Fn<String, Int>, f2: Fn<Int, String>): Int {
|
|
return f1.run("Bar", 1, f2.run("Foo", 42, 239))
|
|
}
|
|
}
|
|
|
|
val fsi = object : Fn<String, Int> {
|
|
override fun run(s: String, i: Int, t: String): Int = 1
|
|
}
|
|
|
|
val fis = object : Fn<Int, String> {
|
|
override fun run(s: String, i: Int, t: Int): String = ""
|
|
}
|
|
|
|
fun test(j: J) {
|
|
j.runConversion(fsi) { s, i, ti -> ""}
|
|
j.runConversion({ s, i, ts -> 1 }, fis)
|
|
} |