IR: do not infer array element types for non-annotation constants

While annotations restrict the set of allowed types to a few final
built-ins, in arbitrary constants we can have array elements that are
some subtype of the array's element type.

 #KT-48671 Fixed
This commit is contained in:
pyos
2021-09-09 14:50:35 +02:00
committed by Alexander Udalov
parent 51c85e7f86
commit 23420ecf7a
12 changed files with 86 additions and 24 deletions
@@ -323,6 +323,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/arrays/collectionGetMultiIndex.kt");
}
@TestMetadata("constantArrayOfAny.kt")
public void testConstantArrayOfAny() throws Exception {
runTest("compiler/testData/codegen/box/arrays/constantArrayOfAny.kt");
}
@TestMetadata("forEachBooleanArray.kt")
public void testForEachBooleanArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forEachBooleanArray.kt");
@@ -323,6 +323,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/arrays/collectionGetMultiIndex.kt");
}
@TestMetadata("constantArrayOfAny.kt")
public void testConstantArrayOfAny() throws Exception {
runTest("compiler/testData/codegen/box/arrays/constantArrayOfAny.kt");
}
@TestMetadata("forEachBooleanArray.kt")
public void testForEachBooleanArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forEachBooleanArray.kt");
@@ -303,6 +303,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/arrays/collectionGetMultiIndex.kt");
}
@TestMetadata("constantArrayOfAny.kt")
public void testConstantArrayOfAny() throws Exception {
runTest("compiler/testData/codegen/box/arrays/constantArrayOfAny.kt");
}
@TestMetadata("forEachBooleanArray.kt")
public void testForEachBooleanArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forEachBooleanArray.kt");
@@ -85,6 +85,11 @@ public class JsLegacyPrimitiveArraysBoxTestGenerated extends AbstractJsLegacyPri
runTest("compiler/testData/codegen/box/arrays/collectionGetMultiIndex.kt");
}
@TestMetadata("constantArrayOfAny.kt")
public void testConstantArrayOfAny() throws Exception {
runTest("compiler/testData/codegen/box/arrays/constantArrayOfAny.kt");
}
@TestMetadata("forEachBooleanArray.kt")
public void testForEachBooleanArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forEachBooleanArray.kt");
@@ -293,6 +293,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/arrays/arrayPlusAssign.kt");
}
@TestMetadata("constantArrayOfAny.kt")
public void testConstantArrayOfAny() throws Exception {
runTest("compiler/testData/codegen/box/arrays/constantArrayOfAny.kt");
}
@TestMetadata("forEachBooleanArray.kt")
public void testForEachBooleanArray() throws Exception {
runTest("compiler/testData/codegen/box/arrays/forEachBooleanArray.kt");