Keep track of array types in OptimizationBasicInterpreter

Merging array types with different element types, for example
`[Lj/l/String;` and `[Lj/l/Object;`, now produces `[Lj/l/Object;`
(instead of `Lj/l/Object;`), which allows for more precise tracking of
null values because we assume that AALOAD on a non-array typed value is
possible only if that value is null.

 #KT-54802 Fixed
This commit is contained in:
Alexander Udalov
2022-11-05 12:12:33 +01:00
parent a79927742c
commit d7a58a7c6c
11 changed files with 105 additions and 20 deletions
@@ -3958,11 +3958,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Casts extends AbstractLightAnalysisModeTest {
@TestMetadata("kt54707.kt")
public void ignoreKt54707() throws Exception {
runTest("compiler/testData/codegen/box/casts/kt54707.kt");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@@ -4096,6 +4091,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/casts/kt54581.kt");
}
@TestMetadata("kt54707.kt")
public void testKt54707() throws Exception {
runTest("compiler/testData/codegen/box/casts/kt54707.kt");
}
@TestMetadata("kt54802.kt")
public void testKt54802() throws Exception {
runTest("compiler/testData/codegen/box/casts/kt54802.kt");
}
@TestMetadata("lambdaToUnitCast.kt")
public void testLambdaToUnitCast() throws Exception {
runTest("compiler/testData/codegen/box/casts/lambdaToUnitCast.kt");