Files
kotlin-fork/compiler/testData/codegen/boxWasmJsInterop/lambdaAdapterNameClash.kt
T
Svyatoslav Kuzmich 1b7c63bd49 [Wasm] Fix js interop closure signature
Before we used IrType.render() which is not unique.
This changes adds a proper serialization of adapter signature to string.
2023-03-20 15:16:00 +00:00

11 lines
377 B
Kotlin
Vendored

// TARGET_BACKEND: WASM
// Type of functions `(T) -> T` are rendered the same way in IrType::render
fun <T : JsAny?> foo(f: (T) -> T, x: Int): Int = js("f(x)")
fun <T : JsAny?> foo(f: (T) -> T, x: String): String = js("f(x)")
fun box(): String {
if (foo<JsAny>({ it }, 10) != 10) return "Fail 1"
if (foo<JsAny>({ it }, "20") != "20") return "Fail 2"
return "OK"
}