[FIR2IR] Don't create f/o symbols on smartcasted Nothing in dispatch receiver

^KT-63525 Fixed
This commit is contained in:
Dmitriy Novozhilov
2024-02-27 11:06:01 +02:00
committed by Space Team
parent 62e9c944fe
commit 5c632bc78e
23 changed files with 143 additions and 1 deletions
@@ -11966,6 +11966,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
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() {
@@ -11966,6 +11966,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
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() {
@@ -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
@@ -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() {
@@ -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() {
@@ -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"
}
}
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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");
@@ -8643,6 +8643,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
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() {
@@ -8643,6 +8643,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
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() {
@@ -8643,6 +8643,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
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() {
@@ -8643,6 +8643,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
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() {
@@ -9536,6 +9536,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
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() {
@@ -9742,6 +9742,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
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() {
@@ -9330,6 +9330,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
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() {
@@ -9537,6 +9537,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
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() {
@@ -8619,6 +8619,12 @@ public class FirWasmJsCodegenBoxTestGenerated extends AbstractFirWasmJsCodegenBo
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() {
@@ -8619,6 +8619,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
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() {