[FIR2IR] Don't create f/o symbols on smartcasted Nothing in dispatch receiver
^KT-63525 Fixed
This commit is contained in:
committed by
Space Team
parent
62e9c944fe
commit
5c632bc78e
@@ -277,7 +277,10 @@ fun FirCallableSymbol<*>.toSymbolForCall(
|
||||
}
|
||||
// Member fake override or bound callable reference
|
||||
dispatchReceiver != null -> {
|
||||
val callSiteDispatchReceiverType = dispatchReceiver.resolvedType
|
||||
val callSiteDispatchReceiverType = when (dispatchReceiver) {
|
||||
is FirSmartCastExpression -> dispatchReceiver.smartcastTypeWithoutNullableNothing?.coneType ?: dispatchReceiver.resolvedType
|
||||
else -> dispatchReceiver.resolvedType
|
||||
}
|
||||
val declarationSiteDispatchReceiverType = dispatchReceiverType
|
||||
val type = if (callSiteDispatchReceiverType is ConeDynamicType && declarationSiteDispatchReceiverType != null) {
|
||||
declarationSiteDispatchReceiverType
|
||||
|
||||
+6
@@ -11907,6 +11907,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
+6
@@ -11907,6 +11907,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
+6
@@ -11907,6 +11907,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-63525
|
||||
|
||||
fun box(): String {
|
||||
var b: String? = "abc"
|
||||
b = null
|
||||
var x = 0
|
||||
if (b != null) {
|
||||
x += b.length
|
||||
}
|
||||
return when (x) {
|
||||
0 -> "OK"
|
||||
else -> "Fail: $x"
|
||||
}
|
||||
}
|
||||
+6
@@ -11907,6 +11907,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
+6
@@ -11595,6 +11595,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
+6
@@ -11907,6 +11907,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
+6
@@ -11907,6 +11907,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
+6
@@ -11907,6 +11907,12 @@ public class FirBlackBoxCodegenTestWithInlineScopesGenerated extends AbstractFir
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
|
||||
+5
@@ -9527,6 +9527,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/controlflow/break1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("callOnSmarcastedNothing.kt")
|
||||
public void testCallOnSmarcastedNothing() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/callOnSmarcastedNothing.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("for_loops.kt")
|
||||
public void testFor_loops() {
|
||||
runTest("compiler/testData/codegen/box/controlflow/for_loops.kt");
|
||||
|
||||
Reference in New Issue
Block a user