Files
kotlin-fork/compiler/testData/codegen/box/funInterface/funInterfaceInheritance.kt
T
2020-11-09 16:04:43 +03:00

31 lines
631 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SAM_CONVERSIONS
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface Base {
fun doStuff(): String
}
fun interface I : Base
fun interface Proxy : I {
override fun doStuff(): String = doStuffInt().toString()
fun doStuffInt(): Int
}
fun runBase(b: Base) = b.doStuff()
fun runI(i: I) = i.doStuff()
fun runProxy(p: Proxy) = p.doStuff()
fun box(): String {
if (runI { "i" } != "i") return "fail1"
if (runProxy { 10 } != "10") return "fail2"
return runBase { "OK" }
}