Fix merging two reference values
In this case, make the result of value type Object instead of unknown.
This commit is contained in:
+7
-4
@@ -37,10 +37,6 @@ internal open class SpilledVariableFieldTypeValue(open var type: Type?, val insn
|
|||||||
private class MergedSpilledVariableFieldTypeValue(
|
private class MergedSpilledVariableFieldTypeValue(
|
||||||
val values: Set<SpilledVariableFieldTypeValue>
|
val values: Set<SpilledVariableFieldTypeValue>
|
||||||
) : SpilledVariableFieldTypeValue(null, null) {
|
) : SpilledVariableFieldTypeValue(null, null) {
|
||||||
init {
|
|
||||||
require(values.none { it is MergedSpilledVariableFieldTypeValue })
|
|
||||||
}
|
|
||||||
|
|
||||||
override var type: Type?
|
override var type: Type?
|
||||||
get() = values.first().type
|
get() = values.first().type
|
||||||
set(newType) {
|
set(newType) {
|
||||||
@@ -159,6 +155,13 @@ private class SpilledVariableFieldTypesInterpreter(
|
|||||||
v != null && v.type == null -> w
|
v != null && v.type == null -> w
|
||||||
w != null && w.type == null -> v
|
w != null && w.type == null -> v
|
||||||
v?.type == w?.type -> v
|
v?.type == w?.type -> v
|
||||||
|
v?.type?.sort == Type.OBJECT && w?.type?.sort == Type.OBJECT -> {
|
||||||
|
when {
|
||||||
|
v.type == AsmTypes.OBJECT_TYPE -> v
|
||||||
|
w.type == AsmTypes.OBJECT_TYPE -> w
|
||||||
|
else -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, v.insn)
|
||||||
|
}
|
||||||
|
}
|
||||||
else -> SpilledVariableFieldTypeValue(null, v?.insn ?: w?.insn)
|
else -> SpilledVariableFieldTypeValue(null, v?.insn ?: w?.insn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
+5
@@ -7495,6 +7495,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||||
|
public void testListThrowablePairInOneSlot() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loadFromBooleanArray.kt")
|
@TestMetadata("loadFromBooleanArray.kt")
|
||||||
public void testLoadFromBooleanArray_1_3() throws Exception {
|
public void testLoadFromBooleanArray_1_3() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
// WITH_RUNTIME
|
||||||
|
// WITH_COROUTINES
|
||||||
|
// FULL_RUNTIME
|
||||||
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
|
||||||
|
class JarFile {
|
||||||
|
fun entries() = listOf<String>()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun scriptTemplatesDiscoverySequence(): Sequence<String> {
|
||||||
|
return sequence<String> {
|
||||||
|
for (dep in listOf<String>()) {
|
||||||
|
try {
|
||||||
|
val jar = JarFile()
|
||||||
|
try {
|
||||||
|
jar.entries().map { it }
|
||||||
|
val (loadedDefinitions, notFoundClasses) = listOf<String>() to listOf<String>()
|
||||||
|
listOf<String>().forEach {
|
||||||
|
yield(it)
|
||||||
|
}
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
e.message
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yield("OK")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return scriptTemplatesDiscoverySequence().first()
|
||||||
|
}
|
||||||
+5
@@ -8300,6 +8300,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||||
|
public void testListThrowablePairInOneSlot() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loadFromBooleanArray.kt")
|
@TestMetadata("loadFromBooleanArray.kt")
|
||||||
public void testLoadFromBooleanArray_1_2() throws Exception {
|
public void testLoadFromBooleanArray_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
+5
@@ -8300,6 +8300,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||||
|
public void testListThrowablePairInOneSlot() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loadFromBooleanArray.kt")
|
@TestMetadata("loadFromBooleanArray.kt")
|
||||||
public void testLoadFromBooleanArray_1_2() throws Exception {
|
public void testLoadFromBooleanArray_1_2() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines.experimental");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines.experimental");
|
||||||
|
|||||||
+5
@@ -7495,6 +7495,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||||
|
public void testListThrowablePairInOneSlot() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loadFromBooleanArray.kt")
|
@TestMetadata("loadFromBooleanArray.kt")
|
||||||
public void testLoadFromBooleanArray_1_3() throws Exception {
|
public void testLoadFromBooleanArray_1_3() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
||||||
|
|||||||
Generated
+5
@@ -6390,6 +6390,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||||
|
public void testListThrowablePairInOneSlot() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loadFromBooleanArray.kt")
|
@TestMetadata("loadFromBooleanArray.kt")
|
||||||
public void testLoadFromBooleanArray_1_3() throws Exception {
|
public void testLoadFromBooleanArray_1_3() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
||||||
|
|||||||
Generated
+5
@@ -6400,6 +6400,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||||
|
public void testListThrowablePairInOneSlot() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loadFromBooleanArray.kt")
|
@TestMetadata("loadFromBooleanArray.kt")
|
||||||
public void testLoadFromBooleanArray_1_3() throws Exception {
|
public void testLoadFromBooleanArray_1_3() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
||||||
|
|||||||
+5
@@ -6400,6 +6400,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||||
|
public void testListThrowablePairInOneSlot() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("loadFromBooleanArray.kt")
|
@TestMetadata("loadFromBooleanArray.kt")
|
||||||
public void testLoadFromBooleanArray_1_3() throws Exception {
|
public void testLoadFromBooleanArray_1_3() throws Exception {
|
||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
||||||
|
|||||||
Reference in New Issue
Block a user