mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
The SAM adapter is generate on declaration site. This is different from the JVM approach. `external fun interface` is banned for now. Reusing interface declaration for the adapter is a hack which reduces code size and makes importing/exporting the adapter effortless.
13 lines
291 B
Kotlin
Vendored
13 lines
291 B
Kotlin
Vendored
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// SKIP_DCE_DRIVEN
|
|
|
|
fun interface Foo {
|
|
fun invoke(): String
|
|
}
|
|
|
|
fun foo(f: Foo) = f.invoke()
|
|
|
|
fun box(): String {
|
|
return foo { "OK" }
|
|
} |