[Wasm] Add K2 diagnostic tests (KT-56849)
This commit is contained in:
committed by
Space Team
parent
1ddcdb95bd
commit
0da9cf8159
@@ -0,0 +1,58 @@
|
||||
import kotlin.wasm.WasmExport
|
||||
|
||||
@WasmExport("a")
|
||||
external fun foo0(): Unit
|
||||
|
||||
@WasmExport("a")
|
||||
fun foo1(): Int = js("42")
|
||||
|
||||
class C() {
|
||||
@WasmExport("a")
|
||||
fun foo2(): Int = 42
|
||||
}
|
||||
|
||||
@WasmExport("a")
|
||||
fun foo3(): Int = 42
|
||||
|
||||
@WasmExport()
|
||||
fun foo4(): Int = 42
|
||||
|
||||
@OptIn(kotlin.js.ExperimentalJsExport::class)
|
||||
@JsExport()
|
||||
@WasmExport()
|
||||
fun foo6(): Int = 42
|
||||
|
||||
val p1 = (@WasmExport("a") fun () {})
|
||||
|
||||
@WasmExport("a")
|
||||
fun foo7(
|
||||
p0: Unit,
|
||||
p1: String,
|
||||
p2: Any,
|
||||
p3: Int?,
|
||||
p4: Boolean?
|
||||
): Unit {
|
||||
p0.toString()
|
||||
p1.toString()
|
||||
p2.toString()
|
||||
p3.toString()
|
||||
p4.toString()
|
||||
}
|
||||
|
||||
@WasmExport("a")
|
||||
fun returnNullableUnit(): Unit? { return null }
|
||||
|
||||
@WasmExport("a")
|
||||
fun returnNullableBoolean(): Boolean? { return null }
|
||||
|
||||
@WasmExport("a")
|
||||
fun returnNullableAny(): Any? { return null }
|
||||
|
||||
@WasmExport("a")
|
||||
fun <T> fooGeneric(x: T): T { return x }
|
||||
|
||||
@WasmExport("a")
|
||||
fun fooDeafultAndVararg(
|
||||
a: Int = definedExternally,
|
||||
vararg b: Int
|
||||
): Unit { b.toString() }
|
||||
@@ -0,0 +1,49 @@
|
||||
import kotlin.wasm.WasmImport
|
||||
|
||||
@WasmImport("a", "b")
|
||||
external fun foo0(): Unit
|
||||
|
||||
@WasmImport("a", "b")
|
||||
fun foo1() {
|
||||
}
|
||||
|
||||
external class C {
|
||||
@WasmImport("a", "b")
|
||||
fun memberFunction()
|
||||
}
|
||||
|
||||
fun foo2() {
|
||||
@WasmImport("a", "b")
|
||||
fun localFun() {
|
||||
}
|
||||
}
|
||||
|
||||
val p1 = (@WasmImport("a", "b") fun () {})
|
||||
|
||||
@WasmImport("a", "b")
|
||||
external fun foo3(
|
||||
p0: Unit,
|
||||
p1: String,
|
||||
p2: Any,
|
||||
p3: Int?,
|
||||
p4: Boolean?
|
||||
): Unit
|
||||
|
||||
|
||||
@WasmImport("a", "b")
|
||||
external fun returnNullableUnit(): Unit?
|
||||
|
||||
@WasmImport("a", "b")
|
||||
external fun returnNullableBoolean(): Boolean?
|
||||
|
||||
@WasmImport("a", "b")
|
||||
external fun returnNullableAny(): Any?
|
||||
|
||||
@WasmImport("a", "b")
|
||||
external fun <T> fooGeneric(x: T): T
|
||||
|
||||
@WasmImport("a", "b")
|
||||
external fun fooDeafultAndVararg(
|
||||
a: Int = definedExternally,
|
||||
vararg b: Int
|
||||
): Unit
|
||||
Reference in New Issue
Block a user