JVM IR: fix inheritance from mutable collections of Int
For subclasses of `AbstractMutableList<Int>` which are not inline classes, the special bridge `remove` had a parameter of type `Int` (mapped to JVM primitive int) before this fix. The hack in `MethodSignatureMapper` changed this type to `Int?`, yet the body of the special bridge still loaded it as non-nullable, which resulted in incorrect bytecode. It looks like a part of this hack in `BridgeLowering` was made only for inline classes which are subclasses of mutable collections. Supposedly it should be extended to non-inline classes, so that `remove` special bridge would have consistent IR by the time it reaches codegen. #KT-46516 Fixed
This commit is contained in:
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -4171,6 +4171,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritFromAbstractMutableListInt.kt")
|
||||
public void testInheritFromAbstractMutableListInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalRemove.kt")
|
||||
public void testInternalRemove() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/internalRemove.kt");
|
||||
|
||||
Generated
+5
@@ -4171,6 +4171,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritFromAbstractMutableListInt.kt")
|
||||
public void testInheritFromAbstractMutableListInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalRemove.kt")
|
||||
public void testInternalRemove() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/internalRemove.kt");
|
||||
|
||||
Generated
+5
@@ -4171,6 +4171,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritFromAbstractMutableListInt.kt")
|
||||
public void testInheritFromAbstractMutableListInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalRemove.kt")
|
||||
public void testInternalRemove() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/internalRemove.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -2992,6 +2992,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/collections"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inheritFromAbstractMutableListInt.kt")
|
||||
public void testInheritFromAbstractMutableListInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalRemove.kt")
|
||||
public void testInternalRemove() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/collections/internalRemove.kt");
|
||||
|
||||
Reference in New Issue
Block a user