[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.
This commit is contained in:
Svyatoslav Kuzmich
2023-03-17 18:10:44 +01:00
committed by Space Team
parent e99b453816
commit 1b7c63bd49
4 changed files with 71 additions and 27 deletions
@@ -0,0 +1,11 @@
// 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"
}