diff --git a/jso/impl/src/main/java/org/teavm/jso/impl/JSValueMarshaller.java b/jso/impl/src/main/java/org/teavm/jso/impl/JSValueMarshaller.java index f32e000b8..b3c5e590c 100644 --- a/jso/impl/src/main/java/org/teavm/jso/impl/JSValueMarshaller.java +++ b/jso/impl/src/main/java/org/teavm/jso/impl/JSValueMarshaller.java @@ -34,6 +34,7 @@ import org.teavm.model.ReferenceCache; import org.teavm.model.TextLocation; import org.teavm.model.ValueType; import org.teavm.model.Variable; +import org.teavm.model.instructions.CastInstruction; import org.teavm.model.instructions.ClassConstantInstruction; import org.teavm.model.instructions.InvocationType; import org.teavm.model.instructions.InvokeInstruction; @@ -472,11 +473,19 @@ class JSValueMarshaller { insn = new InvokeInstruction(); insn.setMethod(JSMethods.UNMAP_ARRAY); insn.setArguments(cls, var, function); - insn.setReceiver(var); + insn.setReceiver(program.createVariable()); insn.setType(InvocationType.SPECIAL); insn.setLocation(location.getSourceLocation()); replacement.add(insn); + var cast = new CastInstruction(); + cast.setTargetType(ValueType.arrayOf(ValueType.arrayOf(type))); + cast.setWeak(true); + cast.setValue(insn.getReceiver()); + cast.setReceiver(var); + cast.setLocation(location.getSourceLocation()); + replacement.add(cast); + return var; } diff --git a/tests/src/test/java/org/teavm/jso/test/ConversionTest.java b/tests/src/test/java/org/teavm/jso/test/ConversionTest.java index c828a6f33..d1c9bed71 100644 --- a/tests/src/test/java/org/teavm/jso/test/ConversionTest.java +++ b/tests/src/test/java/org/teavm/jso/test/ConversionTest.java @@ -65,7 +65,6 @@ public class ConversionTest { } @Test - @SkipPlatform(TestPlatform.WEBASSEMBLY_GC) public void convertsPrimitiveArraysToJava() { PrimitiveArrays arrays = getPrimitiveArrays(); @@ -90,7 +89,6 @@ public class ConversionTest { } @Test - @SkipPlatform(TestPlatform.WEBASSEMBLY_GC) public void convertsPrimitiveArrays2ToJava() { PrimitiveArrays2 arrays = getPrimitiveArrays2(); @@ -117,7 +115,6 @@ public class ConversionTest { } @Test - @SkipPlatform(TestPlatform.WEBASSEMBLY_GC) public void convertsPrimitiveArrays4ToJava() { PrimitiveArrays4 arrays = getPrimitiveArrays4(); diff --git a/tests/src/test/java/org/teavm/jso/test/FunctorTest.java b/tests/src/test/java/org/teavm/jso/test/FunctorTest.java index 921ed1f37..3745386b1 100644 --- a/tests/src/test/java/org/teavm/jso/test/FunctorTest.java +++ b/tests/src/test/java/org/teavm/jso/test/FunctorTest.java @@ -26,7 +26,6 @@ import org.teavm.jso.JSProperty; import org.teavm.junit.EachTestCompiledSeparately; import org.teavm.junit.OnlyPlatform; import org.teavm.junit.SkipJVM; -import org.teavm.junit.SkipPlatform; import org.teavm.junit.TeaVMTestRunner; import org.teavm.junit.TestPlatform; @@ -90,7 +89,6 @@ public class FunctorTest { } @Test - @SkipPlatform(TestPlatform.WEBASSEMBLY_GC) public void castToFunctor() { JSBiFunction f = getBiFunctionAsObject().cast(); assertEquals(23042, f.foo(23, 42));