JS: fix class of object created by multianewarray instruction

This commit is contained in:
Alexey Andreev 2021-04-01 12:05:18 +03:00
parent c89bc11d02
commit 7058a195b7
2 changed files with 13 additions and 1 deletions

View File

@ -1479,7 +1479,7 @@ public class StatementRenderer implements ExprVisitor, StatementVisitor {
}
} else {
writer.append("$rt_createMultiArray(");
context.typeToClsString(writer, expr.getType());
context.typeToClsString(writer, type);
writer.append(",").ws();
}
writer.append("[");

View File

@ -579,4 +579,16 @@ public class VMTest {
array.wait(1);
}
}
@Test
public void castMultiArray() {
Object o = new String[0][0];
assertEquals(0, ((String[][]) o).length);
o = new String[0][];
assertEquals(0, ((String[][]) o).length);
o = new int[0][0];
assertEquals(0, ((int[][]) o).length);
o = new int[0][];
assertEquals(0, ((int[][]) o).length);
}
}