[Wasm] Imporove external interface support
* Support boxing/unboxing when casting to Any * Support ===, equals, hashCode, toString * Support adapting String in interop boundary
This commit is contained in:
@@ -195,7 +195,7 @@ abstract class BasicWasmBoxTest(
|
||||
|
||||
wasmInstance.exports.startUnitTests?.();
|
||||
|
||||
const actualResult = importStringFromWasm(wasmInstance.exports.$testFunction());
|
||||
const actualResult = wasmInstance.exports.$testFunction();
|
||||
if (actualResult !== "OK")
|
||||
throw `Wrong box result '${'$'}{actualResult}'; Expected "OK"`;
|
||||
""".trimIndent()
|
||||
|
||||
+6
@@ -23,3 +23,9 @@ abstract class AbstractIrJsCodegenInlineTest : BasicIrBoxTest(
|
||||
"compiler/testData/codegen/boxInline/",
|
||||
"codegen/irBoxInline/"
|
||||
)
|
||||
|
||||
|
||||
abstract class AbstractIrCodegenWasmJsInteropJsTest : BasicIrBoxTest(
|
||||
"compiler/testData/codegen/wasmJsInterop",
|
||||
"codegen/wasmJsInteropJs"
|
||||
)
|
||||
|
||||
-5
@@ -24,11 +24,6 @@ abstract class AbstractJsCodegenInlineTest : BasicBoxTest(
|
||||
"codegen/boxInline"
|
||||
)
|
||||
|
||||
abstract class AbstractIrCodegenWasmJsInteropJsTest : BasicBoxTest(
|
||||
"compiler/testData/codegen/wasmJsInterop",
|
||||
"codegen/wasmJsInteropWasm"
|
||||
)
|
||||
|
||||
|
||||
abstract class AbstractJsLegacyPrimitiveArraysBoxTest : BasicBoxTest(
|
||||
"compiler/testData/codegen/box/arrays/",
|
||||
|
||||
+11
-1
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
package org.jetbrains.kotlin.js.test.ir.semantics;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
@@ -30,6 +30,11 @@ public class IrCodegenWasmJsInteropJsTestGenerated extends AbstractIrCodegenWasm
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxWasmJsInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("externalTypeOperators.kt")
|
||||
public void testExternalTypeOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externalTypeOperators.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("externals.kt")
|
||||
public void testExternals() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externals.kt");
|
||||
@@ -39,4 +44,9 @@ public class IrCodegenWasmJsInteropJsTestGenerated extends AbstractIrCodegenWasm
|
||||
public void testJsExport() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/jsExport.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("types.kt")
|
||||
public void testTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/types.kt");
|
||||
}
|
||||
}
|
||||
+15
@@ -30,6 +30,11 @@ public class IrCodegenWasmJsInteropWasmTestGenerated extends AbstractIrCodegenWa
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxWasmJsInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("externalTypeOperators.kt")
|
||||
public void testExternalTypeOperators() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externalTypeOperators.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("externals.kt")
|
||||
public void testExternals() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/externals.kt");
|
||||
@@ -39,4 +44,14 @@ public class IrCodegenWasmJsInteropWasmTestGenerated extends AbstractIrCodegenWa
|
||||
public void testJsExport() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/jsExport.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableExternRefs.kt")
|
||||
public void testNullableExternRefs() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/nullableExternRefs.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("types.kt")
|
||||
public void testTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxWasmJsInterop/types.kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user