Files
kotlin-fork/compiler/testData/codegen/box/invokedynamic/sam/genericFunInterfaceWithPrimitive.kt
T
Dmitry Petrov 1f16b96796 JVM_IR indy-SAM conversions: inline classes
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:46 +03:00

26 lines
428 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
fun interface IFoo<T> {
fun foo(x: T): T
}
fun interface IBar<T : Any> {
fun bar(x: T): T
}
fun foo1(foo: IFoo<Int>) = foo.foo(1)
fun bar1(bar: IBar<Int>) = bar.bar(1)
fun box(): String {
val t = foo1 { it + 41 }
if (t != 42) return "Failed: t=$t"
val tt = bar1 { it + 41 }
if (tt != 42) return "Failed: tt=$tt"
return "OK"
}