From 513af2dfbcc411be42aa33b13e9fc8bd126ba0ef Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Tue, 2 Aug 2022 00:49:24 +0200 Subject: [PATCH] FIR. Refactor smart-cast representation in FIR tree Make smart-casts non-transparent expression without delegation to underlying FirQualifiedAccessExpression, as children delegation in fir tree has unclear semantics Remove two different kinds of tree nodes for smart-casts --- ...sSourceModuleResolveCallTestGenerated.java | 6 + ...rceModuleHLSmartCastInfoTestGenerated.java | 6 + ...ceModuleReferenceResolveTestGenerated.java | 12 + .../api/fir/components/KtFirCallResolver.kt | 7 +- .../components/KtFirExpressionTypeProvider.kt | 11 +- .../fir/components/KtFirSmartcastProvider.kt | 16 +- .../references/FirReferenceResolveHelper.kt | 8 +- ...sSourceModuleResolveCallTestGenerated.java | 6 + ...rceModuleHLSmartCastInfoTestGenerated.java | 6 + ...rceModuleHLSmartCastInfoTestGenerated.java | 6 + ...ceModuleReferenceResolveTestGenerated.java | 12 + ...ceModuleReferenceResolveTestGenerated.java | 12 + ...ceModuleReferenceResolveTestGenerated.java | 12 + .../AbstractHLSmartCastInfoTest.kt | 6 + ...sSourceModuleResolveCallTestGenerated.java | 6 + ...rceModuleHLSmartCastInfoTestGenerated.java | 6 + ...ceModuleReferenceResolveTestGenerated.java | 12 + .../resolveCall/whenSelectorSmartCast.kt | 7 + .../resolveCall/whenSelectorSmartCast.txt | 14 + .../bothImplicitReceiversSmartCast.kt | 18 + .../bothImplicitReceiversSmartCast.txt | 7 + .../referenceResolve/smartCastExpression.kt | 9 + .../referenceResolve/smartCastExpression.txt | 2 + .../smartCastInvokeReceiver.kt | 9 + .../smartCastInvokeReceiver.txt | 2 + .../fir/file/structure/FirElementsRecorder.kt | 6 +- ...nosisCompilerFirTestdataTestGenerated.java | 6 + ...TouchedTilContractsPhaseTestGenerated.java | 5 + .../testData/resolve/cfg/complex.dot | 176 +- .../resolve/cfg/flowFromInplaceLambda.dot | 616 +++--- .../resolve/cfg/flowFromInplaceLambda2.dot | 892 ++++----- .../resolve/cfg/flowFromInplaceLambda3.dot | 324 ++-- .../resolve/cfg/flowFromTwoInplaceLambdas.dot | 542 +++--- .../testData/resolve/cfg/jumps.dot | 522 ++--- .../testData/resolve/cfg/lambdas.dot | 236 +-- .../resolve/cfg/localClassesWithImplicit.dot | 398 ++-- .../testData/resolve/cfg/when.dot | 38 +- .../testData/resolve/elvisReturnSimple.dot | 52 +- .../testData/resolve/smartcasts/bangbang.dot | 492 ++--- .../smartcasts/booleans/booleanOperators.dot | 1298 +++++++------ .../smartcasts/booleans/equalsToBoolean.dot | 658 +++---- .../booleans/jumpFromRhsOfOperator.dot | 630 +++--- .../boundSmartcasts/boundSmartcasts.dot | 612 +++--- .../boundSmartcastsInBranches.dot | 1398 +++++++------- .../boundSmartcasts/functionCallBound.dot | 24 +- .../testData/resolve/smartcasts/casts.dot | 434 +++-- .../smartcasts/controlStructures/elvis.dot | 140 +- .../smartcasts/controlStructures/returns.dot | 562 +++--- .../smartcasts/controlStructures/simpleIf.dot | 162 +- .../smartcastFromArgument.dot | 18 +- .../smartcasts/controlStructures/when.dot | 898 +++++---- .../whenSubjectExpression.dot | 136 +- .../resolve/smartcasts/equalsAndIdentity.dot | 298 +-- .../incorrectSmartcastToNothing.dot | 122 +- .../smartcasts/lambdas/inPlaceLambdas.dot | 160 +- .../smartcasts/lambdas/lambdaInWhenBranch.dot | 42 +- .../loops/dataFlowInfoFromWhileCondition.dot | 20 +- .../resolve/smartcasts/loops/endlessLoops.dot | 646 ++++--- .../resolve/smartcasts/multipleCasts.dot | 94 +- .../resolve/smartcasts/nullability.dot | 1712 +++++++++-------- .../implicitReceiverAsWhenSubject.dot | 138 +- .../receivers/implicitReceivers.dot | 562 +++--- .../receivers/thisOfExtensionProperty.dot | 20 +- .../smartcasts/safeCalls/assignSafeCall.dot | 340 ++-- .../safeCalls/safeCallAndEqualityToBool.dot | 238 +-- .../smartcasts/safeCalls/safeCalls.dot | 320 +-- ...nstableSmartCastOnSafeCallArgument.fir.txt | 38 + .../unstableSmartCastOnSafeCallArgument.kt | 21 + .../resolve/smartcasts/smartCastInInit.dot | 24 +- .../smartcasts/smartcastInByClause.dot | 144 +- .../resolve/smartcasts/smartcastToNothing.dot | 74 +- .../smartcasts/stability/overridenOpenVal.dot | 70 +- .../variables/delayedAssignment.dot | 20 +- .../variables/smartcastAfterReassignment.dot | 98 +- .../fromLibrary/conditionalEffects.dot | 424 ++-- .../runners/FirDiagnosticTestGenerated.java | 6 + ...DiagnosticsWithLightTreeTestGenerated.java | 6 + .../FirDestructuringDeclarationChecker.kt | 2 +- .../FirInlineDeclarationChecker.kt | 2 +- .../expression/FirCastOperatorsChecker.kt | 8 +- .../FirConventionFunctionCallChecker.kt | 7 +- .../FirFunctionReturnTypeMismatchChecker.kt | 7 +- ...irReassignmentAndInvisibleSetterChecker.kt | 6 +- .../expression/FirWhenConditionChecker.kt | 3 +- .../kotlin/fir/backend/ConversionUtils.kt | 4 - .../fir/backend/Fir2IrImplicitCastInserter.kt | 34 +- .../kotlin/fir/backend/Fir2IrVisitor.kt | 32 +- .../generators/CallAndReferenceGenerator.kt | 6 +- .../generators/OperatorExpressionGenerator.kt | 2 +- .../runners/ir/Fir2IrTextTestGenerated.java | 12 +- .../ir/LightTreeFir2IrTextTestGenerated.java | 12 +- .../kotlin/fir/resolve/ScopeUtils.kt | 10 +- .../kotlin/fir/resolve/calls/FirReceivers.kt | 16 +- .../kotlin/fir/resolve/ResolveUtils.kt | 43 +- .../kotlin/fir/resolve/calls/Arguments.kt | 5 +- .../fir/resolve/calls/ResolutionStages.kt | 4 +- .../fir/resolve/calls/VisibilityUtils.kt | 29 +- .../tower/FirInvokeResolveTowerExtension.kt | 4 +- .../fir/resolve/calls/tower/TowerLevels.kt | 6 +- .../fir/resolve/dfa/FirDataFlowAnalyzer.kt | 9 +- .../dfa/cfg/ControlFlowGraphBuilder.kt | 11 + .../dfa/cfg/ControlFlowGraphNodeBuilder.kt | 3 + ...rCallCompletionResultsWriterTransformer.kt | 4 + .../FirExpressionsResolveTransformer.kt | 8 +- .../contracts/ConeEffectExtractor.kt | 14 +- .../fir/resolve/calls/ResolutionDiagnostic.kt | 4 +- .../fir/resolve/dfa/VariableStorageImpl.kt | 2 +- .../kotlin/fir/resolve/dfa/cfg/CFGNode.kt | 9 + .../fir/resolve/dfa/cfg/CFGNodeRenderer.kt | 1 + .../dfa/cfg/ControlFlowGraphVisitor.kt | 4 + .../jetbrains/kotlin/fir/resolve/dfa/util.kt | 3 +- .../expressions/FirExpressionWithSmartcast.kt | 70 - .../FirExpressionWithSmartcastToNothing.kt | 71 - ...Smartcast.kt => FirSmartCastExpression.kt} | 26 +- ...SubjectExpressionWithSmartcastToNothing.kt | 43 - .../FirWrappedExpressionWithSmartcast.kt | 37 - ...WrappedExpressionWithSmartcastToNothing.kt | 38 - .../builder/FirSmartCastExpressionBuilder.kt | 61 + .../impl/FirSmartCastExpressionImpl.kt | 66 + .../kotlin/fir/visitors/FirDefaultVisitor.kt | 9 +- .../fir/visitors/FirDefaultVisitorVoid.kt | 9 +- .../kotlin/fir/visitors/FirTransformer.kt | 55 +- .../kotlin/fir/visitors/FirVisitor.kt | 19 +- .../kotlin/fir/visitors/FirVisitorVoid.kt | 55 +- .../fir/expressions/FirExpressionUtil.kt | 1 + .../FirExpressionWithSmartcastBuilder.kt | 20 - ...FirExpressionWithSmartcastToNullBuilder.kt | 26 - ...enSubjectExpressionWithSmartcastBuilder.kt | 20 - ...ectExpressionWithSmartcastToNullBuilder.kt | 26 - ...irWrappedExpressionWithSmartcastBuilder.kt | 24 - .../impl/FirExpressionWithSmartcastImpl.kt | 104 - .../FirExpressionWithSmartcastToNullImpl.kt | 105 - ...rWhenSubjectExpressionWithSmartcastImpl.kt | 51 - ...ubjectExpressionWithSmartcastToNullImpl.kt | 52 - .../kotlin/fir/renderer/FirRenderer.kt | 4 +- .../kotlin/fir/types/FirTypeUtils.kt | 11 +- .../fir/tree/generator/BuilderConfigurator.kt | 3 + .../fir/tree/generator/FirTreeBuilder.kt | 8 +- .../generator/ImplementationConfigurator.kt | 16 +- .../fir/tree/generator/NodeConfigurator.kt | 29 +- .../org/jetbrains/kotlin/KtSourceElement.kt | 6 +- .../ir/irText/firProblems/JCTree.fir.ir.txt | 52 - .../ir/irText/firProblems/JCTree.fir.kt.txt | 22 - .../ir/irText/firProblems/JCTree.ir.txt | 53 - .../testData/ir/irText/firProblems/JCTree.kt | 25 - .../ir/irText/firProblems/JCTree.kt.txt | 24 - .../ir/irText/firProblems/OutBox.fir.ir.txt | 52 + .../ir/irText/firProblems/OutBox.fir.kt.txt | 21 + .../ir/irText/firProblems/OutBox.ir.txt | 53 + .../testData/ir/irText/firProblems/OutBox.kt | 25 + .../ir/irText/firProblems/OutBox.kt.txt | 24 + .../test/runners/ir/IrTextTestGenerated.java | 12 +- .../fir/handlers/FirDiagnosticsHandler.kt | 5 +- .../kotlin/fir/AbstractFirDiagnosticTest.kt | 4 +- 154 files changed, 9573 insertions(+), 9320 deletions(-) create mode 100644 analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.kt create mode 100644 analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.txt create mode 100644 analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt create mode 100644 analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.txt create mode 100644 analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt create mode 100644 analysis/analysis-api/testData/referenceResolve/smartCastExpression.txt create mode 100644 analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt create mode 100644 analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.txt create mode 100644 compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.kt delete mode 100644 compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcast.kt delete mode 100644 compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcastToNothing.kt rename compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/{FirWhenSubjectExpressionWithSmartcast.kt => FirSmartCastExpression.kt} (56%) delete mode 100644 compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWhenSubjectExpressionWithSmartcastToNothing.kt delete mode 100644 compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcast.kt delete mode 100644 compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcastToNothing.kt create mode 100644 compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/builder/FirSmartCastExpressionBuilder.kt create mode 100644 compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/impl/FirSmartCastExpressionImpl.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastBuilder.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastToNullBuilder.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastBuilder.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastToNullBuilder.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWrappedExpressionWithSmartcastBuilder.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastImpl.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastToNullImpl.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastImpl.kt delete mode 100644 compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastToNullImpl.kt delete mode 100644 compiler/testData/ir/irText/firProblems/JCTree.fir.ir.txt delete mode 100644 compiler/testData/ir/irText/firProblems/JCTree.fir.kt.txt delete mode 100644 compiler/testData/ir/irText/firProblems/JCTree.ir.txt delete mode 100644 compiler/testData/ir/irText/firProblems/JCTree.kt delete mode 100644 compiler/testData/ir/irText/firProblems/JCTree.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/OutBox.fir.ir.txt create mode 100644 compiler/testData/ir/irText/firProblems/OutBox.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/OutBox.ir.txt create mode 100644 compiler/testData/ir/irText/firProblems/OutBox.kt create mode 100644 compiler/testData/ir/irText/firProblems/OutBox.kt.txt diff --git a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/callResolver/Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated.java b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/callResolver/Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated.java index dbde5bbcb0d..c0eb735845c 100644 --- a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/callResolver/Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated.java +++ b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/callResolver/Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated.java @@ -832,6 +832,12 @@ public class Fe10IdeNormalAnalysisSourceModuleResolveCallTestGenerated extends A runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithMemberInvoke.kt"); } + @Test + @TestMetadata("whenSelectorSmartCast.kt") + public void testWhenSelectorSmartCast() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.kt"); + } + @Nested @TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments") @TestDataPath("$PROJECT_ROOT") diff --git a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/smartCastProvider/Fe10IdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/smartCastProvider/Fe10IdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java index e571203375d..f01827a006c 100644 --- a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/smartCastProvider/Fe10IdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java +++ b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/components/smartCastProvider/Fe10IdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java @@ -46,6 +46,12 @@ public class Fe10IdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated exten KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("bothImplicitReceiversSmartCast.kt") + public void testBothImplicitReceiversSmartCast() throws Exception { + runTest("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt"); + } + @Test @TestMetadata("multiSmartcastAsReceiver_stable.kt") public void testMultiSmartcastAsReceiver_stable() throws Exception { diff --git a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java index 0e1153b5082..f50d704afc8 100644 --- a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -460,6 +460,18 @@ public class Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exte runTest("analysis/analysis-api/testData/referenceResolve/SeveralOverrides.kt"); } + @Test + @TestMetadata("smartCastExpression.kt") + public void testSmartCastExpression() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt"); + } + + @Test + @TestMetadata("smartCastInvokeReceiver.kt") + public void testSmartCastInvokeReceiver() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt"); + } + @Test @TestMetadata("SuperTypePrimaryConstructor.kt") public void testSuperTypePrimaryConstructor() throws Exception { diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirCallResolver.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirCallResolver.kt index 1f89ded2970..11646a8066d 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirCallResolver.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirCallResolver.kt @@ -201,6 +201,9 @@ internal class KtFirCallResolver( resolveCalleeExpressionOfFunctionCall, resolveFragmentOfCall ) + is FirSmartCastExpression -> originalExpression.toKtCallInfo( + psi, resolveCalleeExpressionOfFunctionCall, resolveFragmentOfCall + ) else -> null } } @@ -465,7 +468,7 @@ internal class KtFirCallResolver( isImplicitInvoke ) } - is FirExpressionWithSmartcast -> createKtCall(psi, fir.originalExpression, candidate, resolveFragmentOfCall) + is FirSmartCastExpression -> (fir.originalExpression as? FirResolvable)?.let { createKtCall(psi, it, candidate, resolveFragmentOfCall) } else -> null } } @@ -707,7 +710,7 @@ internal class KtFirCallResolver( private fun FirExpression.toKtReceiverValue(): KtReceiverValue? { val psi = psi return when (this) { - is FirExpressionWithSmartcast -> { + is FirSmartCastExpression -> { val result = originalExpression.toKtReceiverValue() if (result != null && isStable) { KtSmartCastedReceiverValue(result, smartcastType.coneType.asKtType()) diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirExpressionTypeProvider.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirExpressionTypeProvider.kt index 33f49aaa38d..caeb3623fac 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirExpressionTypeProvider.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirExpressionTypeProvider.kt @@ -231,11 +231,12 @@ internal class KtFirExpressionTypeProvider( } when (val fir = expression.getOrBuildFir(analysisSession.firResolveSession)) { - is FirExpressionWithSmartcastToNothing -> if (fir.isStable) { - return DefiniteNullability.DEFINITELY_NULL - } - is FirExpressionWithSmartcast -> if (fir.isStable && fir.isNotNullable()) { - return DefiniteNullability.DEFINITELY_NOT_NULL + is FirSmartCastExpression -> if (fir.isStable) { + if (fir.smartcastTypeWithoutNullableNothing != null) { + return DefiniteNullability.DEFINITELY_NULL + } else if (fir.isNotNullable()) { + return DefiniteNullability.DEFINITELY_NOT_NULL + } } is FirExpression -> if (fir.isNotNullable()) { return DefiniteNullability.DEFINITELY_NOT_NULL diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSmartcastProvider.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSmartcastProvider.kt index 43db18f2362..78cf5dc8bc3 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSmartcastProvider.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSmartcastProvider.kt @@ -12,10 +12,7 @@ import org.jetbrains.kotlin.analysis.api.components.KtSmartCastProvider import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFir -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirImplicitInvokeCall -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression -import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.coneTypeSafe import org.jetbrains.kotlin.fir.types.isStableSmartcast @@ -45,15 +42,15 @@ internal class KtFirSmartcastProvider( this is KtParenthesizedExpression } - private fun getMatchingFirExpressionWithSmartCast(expression: KtExpression): FirExpressionWithSmartcast? { + private fun getMatchingFirExpressionWithSmartCast(expression: KtExpression): FirSmartCastExpression? { if (!expression.isExplicitSmartCastInfoTarget) return null val possibleFunctionCall = expression.getPossiblyQualifiedCallExpressionForCallee() ?: expression return when (val firExpression = possibleFunctionCall.getOrBuildFir(analysisSession.firResolveSession)) { - is FirExpressionWithSmartcast -> firExpression - is FirSafeCallExpression -> firExpression.selector as? FirExpressionWithSmartcast - is FirImplicitInvokeCall -> firExpression.explicitReceiver as? FirExpressionWithSmartcast + is FirSmartCastExpression -> firExpression + is FirSafeCallExpression -> firExpression.selector as? FirSmartCastExpression + is FirImplicitInvokeCall -> firExpression.explicitReceiver as? FirSmartCastExpression else -> null } } @@ -63,7 +60,7 @@ internal class KtFirSmartcastProvider( return getSmartCastedInfo(firSmartCastExpression) } - private fun getSmartCastedInfo(expression: FirExpressionWithSmartcast): KtSmartCastInfo? { + private fun getSmartCastedInfo(expression: FirSmartCastExpression): KtSmartCastInfo? { val type = expression.smartcastType.coneTypeSafe()?.asKtType() ?: return null return KtSmartCastInfo(type, expression.isStable, token) } @@ -82,6 +79,7 @@ internal class KtFirSmartcastProvider( return when (val firExpression = wholeExpression.getOrBuildFir(analysisSession.firResolveSession)) { is FirQualifiedAccessExpression -> firExpression is FirSafeCallExpression -> firExpression.selector as? FirQualifiedAccessExpression + is FirSmartCastExpression -> firExpression.originalExpression as? FirQualifiedAccessExpression else -> null } } diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/references/FirReferenceResolveHelper.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/references/FirReferenceResolveHelper.kt index b0df480a3f8..f21db0ac6d2 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/references/FirReferenceResolveHelper.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/references/FirReferenceResolveHelper.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.resolve.dfa.unwrapSmartcastExpression import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName @@ -188,7 +189,10 @@ internal object FirReferenceResolveHelper { if (expression.isSyntheticOperatorReference()) return emptyList() val symbolBuilder = analysisSession.firSymbolBuilder val adjustedResolutionExpression = adjustResolutionExpression(expression) - val fir = adjustedResolutionExpression.getOrBuildFir(analysisSession.firResolveSession) + val fir = when (val baseFir = adjustedResolutionExpression.getOrBuildFir(analysisSession.firResolveSession)) { + is FirSmartCastExpression -> baseFir.originalExpression + else -> baseFir + } val session = analysisSession.firResolveSession.useSiteFirSession return when (fir) { is FirResolvedTypeRef -> getSymbolsForResolvedTypeRef(fir, expression, session, symbolBuilder) @@ -361,7 +365,7 @@ internal object FirReferenceResolveHelper { return listOfNotNull((fir.dispatchReceiver.typeRef as? FirResolvedTypeRef)?.toTargetSymbol(session, symbolBuilder)) } val implicitInvokeReceiver = if (fir is FirImplicitInvokeCall) { - fir.explicitReceiver as? FirQualifiedAccessExpression + fir.explicitReceiver?.unwrapSmartcastExpression() as? FirQualifiedAccessExpression } else { null } diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/callResolver/FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/callResolver/FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated.java index 3781140d7cf..d2e7aed7392 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/callResolver/FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/callResolver/FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated.java @@ -832,6 +832,12 @@ public class FirIdeNormalAnalysisSourceModuleResolveCallTestGenerated extends Ab runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithMemberInvoke.kt"); } + @Test + @TestMetadata("whenSelectorSmartCast.kt") + public void testWhenSelectorSmartCast() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.kt"); + } + @Nested @TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments") @TestDataPath("$PROJECT_ROOT") diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeDependentAnalysisSourceModuleHLSmartCastInfoTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeDependentAnalysisSourceModuleHLSmartCastInfoTestGenerated.java index 770c3dbd30f..48a9186b472 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeDependentAnalysisSourceModuleHLSmartCastInfoTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeDependentAnalysisSourceModuleHLSmartCastInfoTestGenerated.java @@ -46,6 +46,12 @@ public class FirIdeDependentAnalysisSourceModuleHLSmartCastInfoTestGenerated ext KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("bothImplicitReceiversSmartCast.kt") + public void testBothImplicitReceiversSmartCast() throws Exception { + runTest("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt"); + } + @Test @TestMetadata("multiSmartcastAsReceiver_stable.kt") public void testMultiSmartcastAsReceiver_stable() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java index 2ab62b4b646..d846ad8f161 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/components/smartCastProvider/FirIdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java @@ -46,6 +46,12 @@ public class FirIdeNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated extend KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("bothImplicitReceiversSmartCast.kt") + public void testBothImplicitReceiversSmartCast() throws Exception { + runTest("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt"); + } + @Test @TestMetadata("multiSmartcastAsReceiver_stable.kt") public void testMultiSmartcastAsReceiver_stable() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java index 87547377659..30730a46c5c 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -460,6 +460,18 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex runTest("analysis/analysis-api/testData/referenceResolve/SeveralOverrides.kt"); } + @Test + @TestMetadata("smartCastExpression.kt") + public void testSmartCastExpression() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt"); + } + + @Test + @TestMetadata("smartCastInvokeReceiver.kt") + public void testSmartCastInvokeReceiver() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt"); + } + @Test @TestMetadata("SuperTypePrimaryConstructor.kt") public void testSuperTypePrimaryConstructor() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java index e8f54a2a6d4..80252f1acfc 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java @@ -460,6 +460,18 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/SeveralOverrides.kt"); } + @Test + @TestMetadata("smartCastExpression.kt") + public void testSmartCastExpression() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt"); + } + + @Test + @TestMetadata("smartCastInvokeReceiver.kt") + public void testSmartCastInvokeReceiver() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt"); + } + @Test @TestMetadata("SuperTypePrimaryConstructor.kt") public void testSuperTypePrimaryConstructor() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java index 48b888ceb52..aedd81b4d90 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -460,6 +460,18 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten runTest("analysis/analysis-api/testData/referenceResolve/SeveralOverrides.kt"); } + @Test + @TestMetadata("smartCastExpression.kt") + public void testSmartCastExpression() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt"); + } + + @Test + @TestMetadata("smartCastInvokeReceiver.kt") + public void testSmartCastInvokeReceiver() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt"); + } + @Test @TestMetadata("SuperTypePrimaryConstructor.kt") public void testSuperTypePrimaryConstructor() throws Exception { diff --git a/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/smartCastProvider/AbstractHLSmartCastInfoTest.kt b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/smartCastProvider/AbstractHLSmartCastInfoTest.kt index c56907802e1..8b73149a13d 100644 --- a/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/smartCastProvider/AbstractHLSmartCastInfoTest.kt +++ b/analysis/analysis-api-impl-base/tests/org/jetbrains/kotlin/analysis/api/impl/base/test/cases/components/smartCastProvider/AbstractHLSmartCastInfoTest.kt @@ -24,6 +24,12 @@ abstract class AbstractHLSmartCastInfoTest : AbstractAnalysisApiSingleFileTest() appendLine("expression: ${expression.text}") appendLine("isStable: ${smartCastInfo?.isStable}") appendLine("smartCastType: ${smartCastInfo?.smartCastType?.render()}") + + val receiverSmartCasts = expression.getImplicitReceiverSmartCast() + for (receiverSmartCast in receiverSmartCasts) { + appendLine("receiver: ${receiverSmartCast.kind}") + appendLine(" smartCastType: ${receiverSmartCast.type.render()}") + } } } } diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/callResolver/FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/callResolver/FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated.java index 728fe220ee4..d445956c0f7 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/callResolver/FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/callResolver/FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated.java @@ -832,6 +832,12 @@ public class FirStandaloneNormalAnalysisSourceModuleResolveCallTestGenerated ext runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithMemberInvoke.kt"); } + @Test + @TestMetadata("whenSelectorSmartCast.kt") + public void testWhenSelectorSmartCast() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.kt"); + } + @Nested @TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall/assignments") @TestDataPath("$PROJECT_ROOT") diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/smartCastProvider/FirStandaloneNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/smartCastProvider/FirStandaloneNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java index 95270ca87fb..334ebf35510 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/smartCastProvider/FirStandaloneNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/components/smartCastProvider/FirStandaloneNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated.java @@ -46,6 +46,12 @@ public class FirStandaloneNormalAnalysisSourceModuleHLSmartCastInfoTestGenerated KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("bothImplicitReceiversSmartCast.kt") + public void testBothImplicitReceiversSmartCast() throws Exception { + runTest("analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt"); + } + @Test @TestMetadata("multiSmartcastAsReceiver_stable.kt") public void testMultiSmartcastAsReceiver_stable() throws Exception { diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java index 47b7cf6cdb8..129d757eec2 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -460,6 +460,18 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/SeveralOverrides.kt"); } + @Test + @TestMetadata("smartCastExpression.kt") + public void testSmartCastExpression() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt"); + } + + @Test + @TestMetadata("smartCastInvokeReceiver.kt") + public void testSmartCastInvokeReceiver() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt"); + } + @Test @TestMetadata("SuperTypePrimaryConstructor.kt") public void testSuperTypePrimaryConstructor() throws Exception { diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.kt b/analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.kt new file mode 100644 index 00000000000..22400b33507 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.kt @@ -0,0 +1,7 @@ +fun test(obj: Any): String { + return when { + obj !is Iterable<*> -> "not iterable" + obj !is Collection<*> -> "not collection" + else -> "unknown" + } +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.txt new file mode 100644 index 00000000000..523499063ab --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/whenSelectorSmartCast.txt @@ -0,0 +1,14 @@ +KtSuccessCallInfo: + call = KtSimpleVariableAccessCall: + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtVariableLikeSignature: + name = obj + receiverType = null + returnType = kotlin.Any + symbol = obj: kotlin.Any + callableIdIfNonLocal = null + simpleAccess = Read: + + typeArgumentsMapping = {} diff --git a/analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt b/analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt new file mode 100644 index 00000000000..05ecf12d2a6 --- /dev/null +++ b/analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.kt @@ -0,0 +1,18 @@ +interface Foo { + fun Bar.foo() +} + +interface Bar {} + +inline fun myWith(argument: T, lambda: T.() -> R): R { + argument.lambda() +} + +fun Any.action(other: Any) { + if (this is Foo) { + with(other) { + this as Bar + foo() + } + } +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.txt b/analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.txt new file mode 100644 index 00000000000..2dceb5aae2f --- /dev/null +++ b/analysis/analysis-api/testData/components/smartCastProvider/smartCastInfo/bothImplicitReceiversSmartCast.txt @@ -0,0 +1,7 @@ +expression: foo +isStable: null +smartCastType: null +receiver: DISPATCH + smartCastType: Foo +receiver: EXTENSION + smartCastType: Bar diff --git a/analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt b/analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt new file mode 100644 index 00000000000..0dcb954a3cd --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/smartCastExpression.kt @@ -0,0 +1,9 @@ +interface Foo { + fun function() +} + +fun foo(parameter: Any) { + if (parameter is Foo) { + parameter.function() + } +} diff --git a/analysis/analysis-api/testData/referenceResolve/smartCastExpression.txt b/analysis/analysis-api/testData/referenceResolve/smartCastExpression.txt new file mode 100644 index 00000000000..b699b35b911 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/smartCastExpression.txt @@ -0,0 +1,2 @@ +Resolved to: +0: parameter: kotlin.Any diff --git a/analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt b/analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt new file mode 100644 index 00000000000..16cf4809d22 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.kt @@ -0,0 +1,9 @@ +interface WithInvoke { + operator fun invoke() {} +} + +fun foo(parameter: Any) { + if (parameter is WithInvoke) { + parameter() + } +} diff --git a/analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.txt b/analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.txt new file mode 100644 index 00000000000..b699b35b911 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/smartCastInvokeReceiver.txt @@ -0,0 +1,2 @@ +Resolved to: +0: parameter: kotlin.Any diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FirElementsRecorder.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FirElementsRecorder.kt index 9a33f38a682..4d120f810b7 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FirElementsRecorder.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FirElementsRecorder.kt @@ -9,10 +9,7 @@ import org.jetbrains.kotlin.* import org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.DuplicatedFirSourceElementsException import org.jetbrains.kotlin.analysis.low.level.api.fir.util.isErrorElement import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.expressions.FirConstExpression -import org.jetbrains.kotlin.fir.expressions.FirFunctionCall -import org.jetbrains.kotlin.fir.expressions.FirPropertyAccessExpression -import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.buildConstExpression import org.jetbrains.kotlin.fir.references.* import org.jetbrains.kotlin.fir.types.FirErrorTypeRef @@ -115,6 +112,7 @@ internal open class FirElementsRecorder : FirVisitor { } ==(R|/cause|, Null(null)) -> { @@ -117,10 +118,10 @@ digraph complex_kt { } } "]; - 48 [label="Stub" style="filled" fillcolor=gray]; - 49 [label="Exit block" style="filled" fillcolor=gray]; + 49 [label="Stub" style="filled" fillcolor=gray]; + 50 [label="Exit block" style="filled" fillcolor=gray]; } - 50 [label="Exit function closeFinally" style="filled" fillcolor=red]; + 51 [label="Exit function closeFinally" style="filled" fillcolor=red]; } 4 -> {5}; 5 -> {6}; @@ -129,12 +130,12 @@ digraph complex_kt { 8 -> {9}; 9 -> {10}; 10 -> {11}; - 11 -> {42 12}; + 11 -> {43 12}; 12 -> {13}; 13 -> {14}; 14 -> {15}; 15 -> {16}; - 16 -> {37 17}; + 16 -> {38 17}; 17 -> {18}; 18 -> {19}; 19 -> {20}; @@ -144,9 +145,9 @@ digraph complex_kt { 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {34 27}; + 26 -> {35 27}; 27 -> {28}; - 27 -> {50} [label=onUncaughtException]; + 27 -> {51} [label=onUncaughtException]; 28 -> {29}; 29 -> {30}; 30 -> {31}; @@ -155,92 +156,93 @@ digraph complex_kt { 33 -> {34}; 34 -> {35}; 35 -> {36}; - 36 -> {46}; - 37 -> {38}; + 36 -> {37}; + 37 -> {47}; 38 -> {39}; 39 -> {40}; 40 -> {41}; - 41 -> {46}; - 42 -> {43}; + 41 -> {42}; + 42 -> {47}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {50}; - 47 -> {48} [style=dotted]; + 47 -> {48}; + 48 -> {51}; 48 -> {49} [style=dotted]; 49 -> {50} [style=dotted]; + 50 -> {51} [style=dotted]; subgraph cluster_16 { color=red - 51 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red]; + 52 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red]; subgraph cluster_17 { color=blue - 52 [label="Enter block"]; + 53 [label="Enter block"]; subgraph cluster_18 { color=blue - 53 [label="Enter block"]; - 54 [label="Access variable this@R|/firstIsInstanceOrNull|"]; - 55 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride|>|()"]; - 56 [label="Variable declaration: lval : R|kotlin/collections/Iterator|"]; + 54 [label="Enter block"]; + 55 [label="Access variable this@R|/firstIsInstanceOrNull|"]; + 56 [label="Function call: this@R|/firstIsInstanceOrNull|.R|SubstitutionOverride|>|()"]; + 57 [label="Variable declaration: lval : R|kotlin/collections/Iterator|"]; subgraph cluster_19 { color=blue - 57 [label="Enter while loop"]; + 58 [label="Enter while loop"]; subgraph cluster_20 { color=blue - 58 [label="Enter loop condition"]; - 59 [label="Access variable R|/|"]; - 60 [label="Function call: R|/|.R|SubstitutionOverride|()"]; - 61 [label="Exit loop condition"]; + 59 [label="Enter loop condition"]; + 60 [label="Access variable R|/|"]; + 61 [label="Function call: R|/|.R|SubstitutionOverride|()"]; + 62 [label="Exit loop condition"]; } subgraph cluster_21 { color=blue - 62 [label="Enter loop block"]; + 63 [label="Enter loop block"]; subgraph cluster_22 { color=blue - 63 [label="Enter block"]; - 64 [label="Access variable R|/|"]; - 65 [label="Function call: R|/|.R|SubstitutionOverride|()"]; - 66 [label="Variable declaration: lval element: R|kotlin/Any?|"]; + 64 [label="Enter block"]; + 65 [label="Access variable R|/|"]; + 66 [label="Function call: R|/|.R|SubstitutionOverride|()"]; + 67 [label="Variable declaration: lval element: R|kotlin/Any?|"]; subgraph cluster_23 { color=blue - 67 [label="Enter when"]; + 68 [label="Enter when"]; subgraph cluster_24 { color=blue - 68 [label="Enter when branch condition "]; - 69 [label="Access variable R|/element|"]; - 70 [label="Type operator: (R|/element| is R|T|)"]; - 71 [label="Exit when branch condition"]; + 69 [label="Enter when branch condition "]; + 70 [label="Access variable R|/element|"]; + 71 [label="Type operator: (R|/element| is R|T|)"]; + 72 [label="Exit when branch condition"]; } - 72 [label="Synthetic else branch"]; - 73 [label="Enter when branch result"]; + 73 [label="Synthetic else branch"]; + 74 [label="Enter when branch result"]; subgraph cluster_25 { color=blue - 74 [label="Enter block"]; - 75 [label="Access variable R|/element|"]; - 76 [label="Jump: ^firstIsInstanceOrNull R|/element|"]; - 77 [label="Stub" style="filled" fillcolor=gray]; - 78 [label="Exit block" style="filled" fillcolor=gray]; + 75 [label="Enter block"]; + 76 [label="Access variable R|/element|"]; + 77 [label="Smart cast: R|/element|"]; + 78 [label="Jump: ^firstIsInstanceOrNull R|/element|"]; + 79 [label="Stub" style="filled" fillcolor=gray]; + 80 [label="Exit block" style="filled" fillcolor=gray]; } - 79 [label="Exit when branch result" style="filled" fillcolor=gray]; - 80 [label="Exit when"]; + 81 [label="Exit when branch result" style="filled" fillcolor=gray]; + 82 [label="Exit when"]; } - 81 [label="Exit block"]; + 83 [label="Exit block"]; } - 82 [label="Exit loop block"]; + 84 [label="Exit loop block"]; } - 83 [label="Exit whileloop"]; + 85 [label="Exit whileloop"]; } - 84 [label="Exit block"]; + 86 [label="Exit block"]; } - 85 [label="Const: Null(null)"]; - 86 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; - 87 [label="Stub" style="filled" fillcolor=gray]; - 88 [label="Exit block" style="filled" fillcolor=gray]; + 87 [label="Const: Null(null)"]; + 88 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; + 89 [label="Stub" style="filled" fillcolor=gray]; + 90 [label="Exit block" style="filled" fillcolor=gray]; } - 89 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; + 91 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; } - 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; @@ -250,8 +252,8 @@ digraph complex_kt { 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {83 62}; - 62 -> {63}; + 61 -> {62}; + 62 -> {85 63}; 63 -> {64}; 64 -> {65}; 65 -> {66}; @@ -260,25 +262,27 @@ digraph complex_kt { 68 -> {69}; 69 -> {70}; 70 -> {71}; - 71 -> {73 72}; - 72 -> {80}; - 73 -> {74}; + 71 -> {72}; + 72 -> {74 73}; + 73 -> {82}; 74 -> {75}; 75 -> {76}; - 76 -> {89}; - 76 -> {77} [style=dotted]; - 77 -> {78} [style=dotted]; + 76 -> {77}; + 77 -> {78}; + 78 -> {91}; 78 -> {79} [style=dotted]; 79 -> {80} [style=dotted]; - 80 -> {81}; - 81 -> {82}; - 82 -> {58} [color=green style=dashed]; + 80 -> {81} [style=dotted]; + 81 -> {82} [style=dotted]; + 82 -> {83}; 83 -> {84}; - 84 -> {85}; + 84 -> {59} [color=green style=dashed]; 85 -> {86}; - 86 -> {89}; - 86 -> {87} [style=dotted]; - 87 -> {88} [style=dotted]; + 86 -> {87}; + 87 -> {88}; + 88 -> {91}; 88 -> {89} [style=dotted]; + 89 -> {90} [style=dotted]; + 90 -> {91} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot index a07048b2eb1..feb3cbcb778 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda.dot @@ -118,117 +118,122 @@ digraph flowFromInplaceLambda_kt { 38 [label="Postponed enter to lambda"]; subgraph cluster_12 { color=blue - 46 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 47 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_13 { color=blue - 47 [label="Enter block"]; - 48 [label="Access variable R|/x|"]; - 49 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - 50 [label="Exit block"]; + 48 [label="Enter block"]; + 49 [label="Access variable R|/x|"]; + 50 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + 51 [label="Exit block"]; } - 51 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 52 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 39 [label="Call arguments union" style="filled" fillcolor=yellow]; 40 [label="Postponed exit from lambda"]; 41 [label="Function call: R|kotlin/run|(...)"]; 42 [label="Access variable R|/x|"]; - 43 [label="Function call: R|/takeInt|(...)"]; - 44 [label="Exit block"]; + 43 [label="Smart cast: R|/x|"]; + 44 [label="Function call: R|/takeInt|(...)"]; + 45 [label="Exit block"]; } - 45 [label="Exit function test_1" style="filled" fillcolor=red]; + 46 [label="Exit function test_1" style="filled" fillcolor=red]; } 36 -> {37}; 37 -> {38}; - 38 -> {46}; + 38 -> {47}; 38 -> {40} [color=red]; - 38 -> {46} [style=dashed]; + 38 -> {47} [style=dashed]; 39 -> {41} [color=red]; 40 -> {41} [color=green]; 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; - 46 -> {47}; + 45 -> {46}; 47 -> {48}; 48 -> {49}; 49 -> {50}; 50 -> {51}; - 51 -> {39} [color=red]; - 51 -> {40} [color=green]; + 51 -> {52}; + 52 -> {39} [color=red]; + 52 -> {40} [color=green]; subgraph cluster_14 { color=red - 52 [label="Enter function test_2" style="filled" fillcolor=red]; + 53 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_15 { color=blue - 53 [label="Enter block"]; - 54 [label="Postponed enter to lambda"]; + 54 [label="Enter block"]; + 55 [label="Postponed enter to lambda"]; subgraph cluster_16 { color=blue - 75 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 78 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_17 { color=blue - 76 [label="Enter block"]; - 77 [label="Access variable R|/y|"]; - 78 [label="Function call: R|/y|.#()"]; - 79 [label="Access variable R|/x|"]; - 80 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - 81 [label="Exit block"]; + 79 [label="Enter block"]; + 80 [label="Access variable R|/y|"]; + 81 [label="Function call: R|/y|.#()"]; + 82 [label="Access variable R|/x|"]; + 83 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + 84 [label="Exit block"]; } - 82 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 85 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 55 [label="Postponed exit from lambda"]; - 56 [label="Function call: R|kotlin/run|(...)"]; - 57 [label="Call arguments union" style="filled" fillcolor=yellow]; - 58 [label="Function call: R|/id|(...)"]; - 59 [label="Access variable R|/y|"]; - 60 [label="Type operator: (R|/y| as R|kotlin/Int|)"]; - 61 [label="Postponed enter to lambda"]; + 56 [label="Postponed exit from lambda"]; + 57 [label="Function call: R|kotlin/run|(...)"]; + 58 [label="Call arguments union" style="filled" fillcolor=yellow]; + 59 [label="Function call: R|/id|(...)"]; + 60 [label="Access variable R|/y|"]; + 61 [label="Type operator: (R|/y| as R|kotlin/Int|)"]; + 62 [label="Postponed enter to lambda"]; subgraph cluster_18 { color=blue - 83 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 86 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_19 { color=blue - 84 [label="Enter block"]; - 85 [label="Access variable R|/x|"]; - 86 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 87 [label="Access variable R|/y|"]; - 88 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 89 [label="Const: Int(1)"]; - 90 [label="Exit block"]; + 87 [label="Enter block"]; + 88 [label="Access variable R|/x|"]; + 89 [label="Smart cast: R|/x|"]; + 90 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 91 [label="Access variable R|/y|"]; + 92 [label="Smart cast: R|/y|"]; + 93 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 94 [label="Const: Int(1)"]; + 95 [label="Exit block"]; } - 91 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 96 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 62 [label="Postponed exit from lambda"]; - 63 [label="Function call: R|kotlin/run|(...)"]; - 64 [label="Call arguments union" style="filled" fillcolor=yellow]; - 65 [label="Function call: R|/select|(...)"]; - 66 [label="Variable declaration: lval a: R|kotlin/Int|"]; - 67 [label="Access variable R|/x|"]; - 68 [label="Function call: R|/takeInt|(...)"]; - 69 [label="Access variable R|/y|"]; + 63 [label="Postponed exit from lambda"]; + 64 [label="Function call: R|kotlin/run|(...)"]; + 65 [label="Call arguments union" style="filled" fillcolor=yellow]; + 66 [label="Function call: R|/select|(...)"]; + 67 [label="Variable declaration: lval a: R|kotlin/Int|"]; + 68 [label="Access variable R|/x|"]; + 69 [label="Smart cast: R|/x|"]; 70 [label="Function call: R|/takeInt|(...)"]; - 71 [label="Access variable R|/a|"]; - 72 [label="Function call: R|/takeInt|(...)"]; - 73 [label="Exit block"]; + 71 [label="Access variable R|/y|"]; + 72 [label="Smart cast: R|/y|"]; + 73 [label="Function call: R|/takeInt|(...)"]; + 74 [label="Access variable R|/a|"]; + 75 [label="Function call: R|/takeInt|(...)"]; + 76 [label="Exit block"]; } - 74 [label="Exit function test_2" style="filled" fillcolor=red]; + 77 [label="Exit function test_2" style="filled" fillcolor=red]; } - 52 -> {53}; 53 -> {54}; - 54 -> {75}; - 54 -> {55} [color=red]; - 54 -> {75} [style=dashed]; - 55 -> {56}; + 54 -> {55}; + 55 -> {78}; + 55 -> {56} [color=red]; + 55 -> {78} [style=dashed]; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {83}; - 61 -> {62} [color=red]; - 61 -> {83} [style=dashed]; - 62 -> {63}; + 61 -> {62}; + 62 -> {86}; + 62 -> {63} [color=red]; + 62 -> {86} [style=dashed]; 63 -> {64}; 64 -> {65}; 65 -> {66}; @@ -240,100 +245,103 @@ digraph flowFromInplaceLambda_kt { 71 -> {72}; 72 -> {73}; 73 -> {74}; + 74 -> {75}; 75 -> {76}; 76 -> {77}; - 77 -> {78}; 78 -> {79}; 79 -> {80}; 80 -> {81}; 81 -> {82}; - 82 -> {57} [color=red]; - 82 -> {55} [color=green]; + 82 -> {83}; 83 -> {84}; 84 -> {85}; - 85 -> {86}; + 85 -> {58} [color=red]; + 85 -> {56} [color=green]; 86 -> {87}; 87 -> {88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; - 91 -> {64} [color=red]; - 91 -> {62} [color=green]; + 91 -> {92}; + 92 -> {93}; + 93 -> {94}; + 94 -> {95}; + 95 -> {96}; + 96 -> {65} [color=red]; + 96 -> {63} [color=green]; subgraph cluster_20 { color=red - 92 [label="Enter function test_3" style="filled" fillcolor=red]; + 97 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 93 [label="Enter block"]; - 94 [label="Postponed enter to lambda"]; + 98 [label="Enter block"]; + 99 [label="Postponed enter to lambda"]; subgraph cluster_22 { color=blue - 112 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 119 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 113 [label="Enter block"]; - 114 [label="Access variable R|/y|"]; - 115 [label="Function call: R|/y|.#()"]; - 116 [label="Access variable R|/x|"]; - 117 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - 118 [label="Function call: R|/materialize|()"]; - 119 [label="Exit block"]; + 120 [label="Enter block"]; + 121 [label="Access variable R|/y|"]; + 122 [label="Function call: R|/y|.#()"]; + 123 [label="Access variable R|/x|"]; + 124 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + 125 [label="Function call: R|/materialize|()"]; + 126 [label="Exit block"]; } - 120 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 127 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 95 [label="Postponed exit from lambda"]; - 96 [label="Function call: R|kotlin/run|(...)"]; - 97 [label="Function call: R|/id|(...)"]; - 98 [label="Postponed enter to lambda"]; + 100 [label="Postponed exit from lambda"]; + 101 [label="Function call: R|kotlin/run|(...)"]; + 102 [label="Function call: R|/id|(...)"]; + 103 [label="Postponed enter to lambda"]; subgraph cluster_24 { color=blue - 121 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 128 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_25 { color=blue - 122 [label="Enter block"]; - 123 [label="Access variable R|/y|"]; - 124 [label="Type operator: (R|/y| as R|kotlin/Int|)"]; - 125 [label="Access variable R|/x|"]; - 126 [label="Function call: R|/x|.#()"]; - 127 [label="Access variable R|/y|"]; - 128 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 129 [label="Const: Int(1)"]; - 130 [label="Exit block"]; + 129 [label="Enter block"]; + 130 [label="Access variable R|/y|"]; + 131 [label="Type operator: (R|/y| as R|kotlin/Int|)"]; + 132 [label="Access variable R|/x|"]; + 133 [label="Function call: R|/x|.#()"]; + 134 [label="Access variable R|/y|"]; + 135 [label="Smart cast: R|/y|"]; + 136 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 137 [label="Const: Int(1)"]; + 138 [label="Exit block"]; } - 131 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 139 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 99 [label="Postponed exit from lambda"]; - 100 [label="Function call: R|kotlin/run|(...)"]; - 101 [label="Call arguments union" style="filled" fillcolor=yellow]; - 102 [label="Function call: R|/select|(...)"]; - 103 [label="Variable declaration: lval a: R|kotlin/Int|"]; - 104 [label="Access variable R|/x|"]; - 105 [label="Function call: R|/takeInt|(...)"]; - 106 [label="Access variable R|/y|"]; - 107 [label="Function call: R|/takeInt|(...)"]; - 108 [label="Access variable R|/a|"]; - 109 [label="Function call: R|/takeInt|(...)"]; - 110 [label="Exit block"]; + 104 [label="Postponed exit from lambda"]; + 105 [label="Function call: R|kotlin/run|(...)"]; + 106 [label="Call arguments union" style="filled" fillcolor=yellow]; + 107 [label="Function call: R|/select|(...)"]; + 108 [label="Variable declaration: lval a: R|kotlin/Int|"]; + 109 [label="Access variable R|/x|"]; + 110 [label="Smart cast: R|/x|"]; + 111 [label="Function call: R|/takeInt|(...)"]; + 112 [label="Access variable R|/y|"]; + 113 [label="Smart cast: R|/y|"]; + 114 [label="Function call: R|/takeInt|(...)"]; + 115 [label="Access variable R|/a|"]; + 116 [label="Function call: R|/takeInt|(...)"]; + 117 [label="Exit block"]; } - 111 [label="Exit function test_3" style="filled" fillcolor=red]; + 118 [label="Exit function test_3" style="filled" fillcolor=red]; } - 92 -> {93}; - 93 -> {94}; - 94 -> {112}; - 94 -> {95} [color=red]; - 94 -> {112} [style=dashed]; - 95 -> {96}; - 96 -> {97}; 97 -> {98}; - 98 -> {121}; - 98 -> {99} [color=red]; - 98 -> {121} [style=dashed]; - 99 -> {100}; + 98 -> {99}; + 99 -> {119}; + 99 -> {100} [color=red]; + 99 -> {119} [style=dashed]; 100 -> {101}; 101 -> {102}; 102 -> {103}; - 103 -> {104}; + 103 -> {128}; + 103 -> {104} [color=red]; + 103 -> {128} [style=dashed]; 104 -> {105}; 105 -> {106}; 106 -> {107}; @@ -341,107 +349,110 @@ digraph flowFromInplaceLambda_kt { 108 -> {109}; 109 -> {110}; 110 -> {111}; + 111 -> {112}; 112 -> {113}; 113 -> {114}; 114 -> {115}; 115 -> {116}; 116 -> {117}; 117 -> {118}; - 118 -> {119}; 119 -> {120}; - 120 -> {101} [color=red]; - 120 -> {95} [color=green]; + 120 -> {121}; 121 -> {122}; 122 -> {123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; 126 -> {127}; - 127 -> {128}; + 127 -> {106} [color=red]; + 127 -> {100} [color=green]; 128 -> {129}; 129 -> {130}; 130 -> {131}; - 131 -> {101} [color=red]; - 131 -> {99} [color=green]; - - subgraph cluster_26 { - color=red - 132 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_27 { - color=blue - 133 [label="Enter block"]; - 134 [label="Postponed enter to lambda"]; - subgraph cluster_28 { - color=blue - 153 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_29 { - color=blue - 154 [label="Enter block"]; - 155 [label="Access variable R|/y|"]; - 156 [label="Function call: R|/y|.#()"]; - 157 [label="Access variable R|/x|"]; - 158 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - 159 [label="Exit block"]; - } - 160 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 135 [label="Postponed exit from lambda"]; - 136 [label="Function call: R|/myRun|(...)"]; - 137 [label="Function call: R|/id|(...)"]; - 138 [label="Access variable R|/y|"]; - 139 [label="Type operator: (R|/y| as R|kotlin/Int|)"]; - 140 [label="Postponed enter to lambda"]; - subgraph cluster_30 { - color=blue - 161 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_31 { - color=blue - 162 [label="Enter block"]; - 163 [label="Access variable R|/x|"]; - 164 [label="Function call: R|/x|.#()"]; - 165 [label="Access variable R|/y|"]; - 166 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 167 [label="Const: Int(1)"]; - 168 [label="Exit block"]; - } - 169 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 141 [label="Postponed exit from lambda"]; - 142 [label="Function call: R|/myRun|(...)"]; - 143 [label="Function call: R|/select|(...)"]; - 144 [label="Variable declaration: lval a: R|kotlin/Int|"]; - 145 [label="Access variable R|/x|"]; - 146 [label="Function call: #(...)"]; - 147 [label="Access variable R|/y|"]; - 148 [label="Function call: R|/takeInt|(...)"]; - 149 [label="Access variable R|/a|"]; - 150 [label="Function call: R|/takeInt|(...)"]; - 151 [label="Exit block"]; - } - 152 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 131 -> {132}; 132 -> {133}; 133 -> {134}; - 134 -> {135 153}; - 134 -> {153} [style=dashed]; + 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; 138 -> {139}; - 139 -> {140}; - 140 -> {141 161}; - 140 -> {161} [style=dashed]; + 139 -> {106} [color=red]; + 139 -> {104} [color=green]; + + subgraph cluster_26 { + color=red + 140 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_27 { + color=blue + 141 [label="Enter block"]; + 142 [label="Postponed enter to lambda"]; + subgraph cluster_28 { + color=blue + 162 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_29 { + color=blue + 163 [label="Enter block"]; + 164 [label="Access variable R|/y|"]; + 165 [label="Function call: R|/y|.#()"]; + 166 [label="Access variable R|/x|"]; + 167 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + 168 [label="Exit block"]; + } + 169 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 143 [label="Postponed exit from lambda"]; + 144 [label="Function call: R|/myRun|(...)"]; + 145 [label="Function call: R|/id|(...)"]; + 146 [label="Access variable R|/y|"]; + 147 [label="Type operator: (R|/y| as R|kotlin/Int|)"]; + 148 [label="Postponed enter to lambda"]; + subgraph cluster_30 { + color=blue + 170 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_31 { + color=blue + 171 [label="Enter block"]; + 172 [label="Access variable R|/x|"]; + 173 [label="Function call: R|/x|.#()"]; + 174 [label="Access variable R|/y|"]; + 175 [label="Smart cast: R|/y|"]; + 176 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 177 [label="Const: Int(1)"]; + 178 [label="Exit block"]; + } + 179 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 149 [label="Postponed exit from lambda"]; + 150 [label="Function call: R|/myRun|(...)"]; + 151 [label="Function call: R|/select|(...)"]; + 152 [label="Variable declaration: lval a: R|kotlin/Int|"]; + 153 [label="Access variable R|/x|"]; + 154 [label="Function call: #(...)"]; + 155 [label="Access variable R|/y|"]; + 156 [label="Smart cast: R|/y|"]; + 157 [label="Function call: R|/takeInt|(...)"]; + 158 [label="Access variable R|/a|"]; + 159 [label="Function call: R|/takeInt|(...)"]; + 160 [label="Exit block"]; + } + 161 [label="Exit function test_4" style="filled" fillcolor=red]; + } + 140 -> {141}; 141 -> {142}; - 142 -> {143}; + 142 -> {143 162}; + 142 -> {162} [style=dashed]; 143 -> {144}; 144 -> {145}; 145 -> {146}; 146 -> {147}; 147 -> {148}; - 148 -> {149}; + 148 -> {149 170}; + 148 -> {170} [style=dashed]; 149 -> {150}; 150 -> {151}; 151 -> {152}; + 152 -> {153}; 153 -> {154}; 154 -> {155}; 155 -> {156}; @@ -449,7 +460,7 @@ digraph flowFromInplaceLambda_kt { 157 -> {158}; 158 -> {159}; 159 -> {160}; - 161 -> {162}; + 160 -> {161}; 162 -> {163}; 163 -> {164}; 164 -> {165}; @@ -457,141 +468,150 @@ digraph flowFromInplaceLambda_kt { 166 -> {167}; 167 -> {168}; 168 -> {169}; - - subgraph cluster_32 { - color=red - 170 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_33 { - color=blue - 171 [label="Enter block"]; - 172 [label="Postponed enter to lambda"]; - subgraph cluster_34 { - color=blue - 185 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_35 { - color=blue - 186 [label="Enter block"]; - 187 [label="Function call: R|/materialize|()"]; - 188 [label="Exit block"]; - } - 189 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 173 [label="Postponed exit from lambda"]; - 174 [label="Function call: R|kotlin/run|(...)"]; - 175 [label="Postponed enter to lambda"]; - subgraph cluster_36 { - color=blue - 190 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_37 { - color=blue - 191 [label="Enter block"]; - 192 [label="Function call: R|/materialize|()"]; - 193 [label="Exit block"]; - } - 194 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 176 [label="Postponed exit from lambda"]; - 177 [label="Function call: R|kotlin/run|(...)"]; - 178 [label="Call arguments union" style="filled" fillcolor=yellow]; - 179 [label="Function call: R|/select|(...)"]; - 180 [label="Variable declaration: lval x: R|kotlin/Int|"]; - 181 [label="Access variable R|/x|"]; - 182 [label="Function call: R|/takeInt|(...)"]; - 183 [label="Exit block"]; - } - 184 [label="Exit function test_5" style="filled" fillcolor=red]; - } 170 -> {171}; 171 -> {172}; - 172 -> {185}; - 172 -> {173} [color=red]; - 172 -> {185} [style=dashed]; + 172 -> {173}; 173 -> {174}; 174 -> {175}; - 175 -> {190}; - 175 -> {176} [color=red]; - 175 -> {190} [style=dashed]; + 175 -> {176}; 176 -> {177}; 177 -> {178}; 178 -> {179}; - 179 -> {180}; + + subgraph cluster_32 { + color=red + 180 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_33 { + color=blue + 181 [label="Enter block"]; + 182 [label="Postponed enter to lambda"]; + subgraph cluster_34 { + color=blue + 195 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_35 { + color=blue + 196 [label="Enter block"]; + 197 [label="Function call: R|/materialize|()"]; + 198 [label="Exit block"]; + } + 199 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 183 [label="Postponed exit from lambda"]; + 184 [label="Function call: R|kotlin/run|(...)"]; + 185 [label="Postponed enter to lambda"]; + subgraph cluster_36 { + color=blue + 200 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_37 { + color=blue + 201 [label="Enter block"]; + 202 [label="Function call: R|/materialize|()"]; + 203 [label="Exit block"]; + } + 204 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 186 [label="Postponed exit from lambda"]; + 187 [label="Function call: R|kotlin/run|(...)"]; + 188 [label="Call arguments union" style="filled" fillcolor=yellow]; + 189 [label="Function call: R|/select|(...)"]; + 190 [label="Variable declaration: lval x: R|kotlin/Int|"]; + 191 [label="Access variable R|/x|"]; + 192 [label="Function call: R|/takeInt|(...)"]; + 193 [label="Exit block"]; + } + 194 [label="Exit function test_5" style="filled" fillcolor=red]; + } 180 -> {181}; 181 -> {182}; - 182 -> {183}; + 182 -> {195}; + 182 -> {183} [color=red]; + 182 -> {195} [style=dashed]; 183 -> {184}; - 185 -> {186}; + 184 -> {185}; + 185 -> {200}; + 185 -> {186} [color=red]; + 185 -> {200} [style=dashed]; 186 -> {187}; 187 -> {188}; 188 -> {189}; - 189 -> {178} [color=red]; - 189 -> {173} [color=green]; + 189 -> {190}; 190 -> {191}; 191 -> {192}; 192 -> {193}; 193 -> {194}; - 194 -> {178} [color=red]; - 194 -> {176} [color=green]; - - subgraph cluster_38 { - color=red - 195 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_39 { - color=blue - 196 [label="Enter block"]; - 197 [label="Postponed enter to lambda"]; - subgraph cluster_40 { - color=blue - 204 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_41 { - color=blue - 205 [label="Enter block"]; - 206 [label="Postponed enter to lambda"]; - subgraph cluster_42 { - color=blue - 211 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_43 { - color=blue - 212 [label="Enter block"]; - 213 [label="Function call: R|/materialize|()"]; - 214 [label="Exit block"]; - } - 215 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 207 [label="Postponed exit from lambda"]; - 208 [label="Function call: R|kotlin/run|(...)"]; - 209 [label="Exit block"]; - } - 210 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 198 [label="Postponed exit from lambda"]; - 199 [label="Function call: R|/myRun|(...)"]; - 200 [label="Function call: R|/id|(...)"]; - 201 [label="Variable declaration: lval x: R|kotlin/String|"]; - 202 [label="Exit block"]; - } - 203 [label="Exit function test_6" style="filled" fillcolor=red]; - } 195 -> {196}; 196 -> {197}; - 197 -> {198 204}; - 197 -> {204} [style=dashed]; + 197 -> {198}; 198 -> {199}; - 199 -> {200}; + 199 -> {188} [color=red]; + 199 -> {183} [color=green]; 200 -> {201}; 201 -> {202}; 202 -> {203}; - 204 -> {205}; + 203 -> {204}; + 204 -> {188} [color=red]; + 204 -> {186} [color=green]; + + subgraph cluster_38 { + color=red + 205 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_39 { + color=blue + 206 [label="Enter block"]; + 207 [label="Postponed enter to lambda"]; + subgraph cluster_40 { + color=blue + 214 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_41 { + color=blue + 215 [label="Enter block"]; + 216 [label="Postponed enter to lambda"]; + subgraph cluster_42 { + color=blue + 221 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_43 { + color=blue + 222 [label="Enter block"]; + 223 [label="Function call: R|/materialize|()"]; + 224 [label="Exit block"]; + } + 225 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 217 [label="Postponed exit from lambda"]; + 218 [label="Function call: R|kotlin/run|(...)"]; + 219 [label="Exit block"]; + } + 220 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 208 [label="Postponed exit from lambda"]; + 209 [label="Function call: R|/myRun|(...)"]; + 210 [label="Function call: R|/id|(...)"]; + 211 [label="Variable declaration: lval x: R|kotlin/String|"]; + 212 [label="Exit block"]; + } + 213 [label="Exit function test_6" style="filled" fillcolor=red]; + } 205 -> {206}; - 206 -> {211}; - 206 -> {207} [color=red]; - 206 -> {211} [style=dashed]; - 207 -> {208}; + 206 -> {207}; + 207 -> {208 214}; + 207 -> {214} [style=dashed]; 208 -> {209}; 209 -> {210}; + 210 -> {211}; 211 -> {212}; 212 -> {213}; - 213 -> {214}; 214 -> {215}; - 215 -> {207} [color=green]; + 215 -> {216}; + 216 -> {221}; + 216 -> {217} [color=red]; + 216 -> {221} [style=dashed]; + 217 -> {218}; + 218 -> {219}; + 219 -> {220}; + 221 -> {222}; + 222 -> {223}; + 223 -> {224}; + 224 -> {225}; + 225 -> {217} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda2.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda2.dot index 4b391873460..b4d4218079b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda2.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda2.dot @@ -89,16 +89,16 @@ digraph flowFromInplaceLambda2_kt { 27 [label="Postponed enter to lambda"]; subgraph cluster_10 { color=blue - 41 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 42 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 42 [label="Enter block"]; - 43 [label="Access variable R|/x|"]; - 44 [label="Type operator: (R|/x| as R|kotlin/String|)"]; - 45 [label="Function call: R|/n|()"]; - 46 [label="Exit block"]; + 43 [label="Enter block"]; + 44 [label="Access variable R|/x|"]; + 45 [label="Type operator: (R|/x| as R|kotlin/String|)"]; + 46 [label="Function call: R|/n|()"]; + 47 [label="Exit block"]; } - 47 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 48 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 28 [label="Postponed exit from lambda"]; 29 [label="Function call: R|kotlin/run|(...)"]; @@ -107,39 +107,40 @@ digraph flowFromInplaceLambda2_kt { 32 [label="Postponed enter to lambda"]; subgraph cluster_12 { color=blue - 48 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 49 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_13 { color=blue - 49 [label="Enter block"]; - 50 [label="Access variable R|/x|"]; - 51 [label="Access variable #"]; - 52 [label="Const: Int(123)"]; - 53 [label="Exit block"]; + 50 [label="Enter block"]; + 51 [label="Access variable R|/x|"]; + 52 [label="Access variable #"]; + 53 [label="Const: Int(123)"]; + 54 [label="Exit block"]; } - 54 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 55 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 33 [label="Postponed exit from lambda"]; 34 [label="Function call: R|kotlin/run|(...)"]; 35 [label="Call arguments union" style="filled" fillcolor=yellow]; 36 [label="Function call: R|/foo|(...)"]; 37 [label="Access variable R|/x|"]; - 38 [label="Access variable R|kotlin/String.length|"]; - 39 [label="Exit block"]; + 38 [label="Smart cast: R|/x|"]; + 39 [label="Access variable R|kotlin/String.length|"]; + 40 [label="Exit block"]; } - 40 [label="Exit function test1" style="filled" fillcolor=red]; + 41 [label="Exit function test1" style="filled" fillcolor=red]; } 25 -> {26}; 26 -> {27}; - 27 -> {41}; + 27 -> {42}; 27 -> {28} [color=red]; - 27 -> {41} [style=dashed]; + 27 -> {42} [style=dashed]; 28 -> {29}; 29 -> {30}; 30 -> {31}; 31 -> {32}; - 32 -> {48}; + 32 -> {49}; 32 -> {33} [color=red]; - 32 -> {48} [style=dashed]; + 32 -> {49} [style=dashed]; 33 -> {34}; 34 -> {35}; 35 -> {36}; @@ -147,776 +148,779 @@ digraph flowFromInplaceLambda2_kt { 37 -> {38}; 38 -> {39}; 39 -> {40}; - 41 -> {42}; + 40 -> {41}; 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {35} [color=red]; - 47 -> {28} [color=green]; - 48 -> {49}; + 47 -> {48}; + 48 -> {35} [color=red]; + 48 -> {28} [color=green]; 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; - 54 -> {35} [color=red]; - 54 -> {33} [color=green]; + 54 -> {55}; + 55 -> {35} [color=red]; + 55 -> {33} [color=green]; subgraph cluster_14 { color=red - 55 [label="Enter function test2" style="filled" fillcolor=red]; + 56 [label="Enter function test2" style="filled" fillcolor=red]; subgraph cluster_15 { color=blue - 56 [label="Enter block"]; - 57 [label="Postponed enter to lambda"]; + 57 [label="Enter block"]; + 58 [label="Postponed enter to lambda"]; subgraph cluster_16 { color=blue - 72 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 74 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_17 { color=blue - 73 [label="Enter block"]; - 74 [label="Access variable R|/x|"]; - 75 [label="Type operator: (R|/x| as R|kotlin/String|)"]; - 76 [label="Function call: R|/n|()"]; - 77 [label="Exit block"]; + 75 [label="Enter block"]; + 76 [label="Access variable R|/x|"]; + 77 [label="Type operator: (R|/x| as R|kotlin/String|)"]; + 78 [label="Function call: R|/n|()"]; + 79 [label="Exit block"]; } - 78 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 80 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 58 [label="Postponed exit from lambda"]; - 59 [label="Function call: R|kotlin/run|(...)"]; - 60 [label="Function call: R|/id|(...)"]; - 61 [label="Const: Int(1)"]; - 62 [label="Function call: R|/someCompletedCall|(...)"]; - 63 [label="Postponed enter to lambda"]; + 59 [label="Postponed exit from lambda"]; + 60 [label="Function call: R|kotlin/run|(...)"]; + 61 [label="Function call: R|/id|(...)"]; + 62 [label="Const: Int(1)"]; + 63 [label="Function call: R|/someCompletedCall|(...)"]; + 64 [label="Postponed enter to lambda"]; subgraph cluster_18 { color=blue - 79 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 81 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_19 { color=blue - 80 [label="Enter block"]; - 81 [label="Access variable R|/x|"]; - 82 [label="Access variable #"]; - 83 [label="Const: Int(123)"]; - 84 [label="Exit block"]; + 82 [label="Enter block"]; + 83 [label="Access variable R|/x|"]; + 84 [label="Access variable #"]; + 85 [label="Const: Int(123)"]; + 86 [label="Exit block"]; } - 85 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 87 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 64 [label="Postponed exit from lambda"]; - 65 [label="Function call: R|kotlin/run|(...)"]; - 66 [label="Call arguments union" style="filled" fillcolor=yellow]; - 67 [label="Function call: R|/foo|(...)"]; - 68 [label="Access variable R|/x|"]; - 69 [label="Access variable R|kotlin/String.length|"]; - 70 [label="Exit block"]; + 65 [label="Postponed exit from lambda"]; + 66 [label="Function call: R|kotlin/run|(...)"]; + 67 [label="Call arguments union" style="filled" fillcolor=yellow]; + 68 [label="Function call: R|/foo|(...)"]; + 69 [label="Access variable R|/x|"]; + 70 [label="Smart cast: R|/x|"]; + 71 [label="Access variable R|kotlin/String.length|"]; + 72 [label="Exit block"]; } - 71 [label="Exit function test2" style="filled" fillcolor=red]; + 73 [label="Exit function test2" style="filled" fillcolor=red]; } - 55 -> {56}; 56 -> {57}; - 57 -> {72}; - 57 -> {58} [color=red]; - 57 -> {72} [style=dashed]; - 58 -> {59}; + 57 -> {58}; + 58 -> {74}; + 58 -> {59} [color=red]; + 58 -> {74} [style=dashed]; 59 -> {60}; 60 -> {61}; 61 -> {62}; 62 -> {63}; - 63 -> {79}; - 63 -> {64} [color=red]; - 63 -> {79} [style=dashed]; - 64 -> {65}; + 63 -> {64}; + 64 -> {81}; + 64 -> {65} [color=red]; + 64 -> {81} [style=dashed]; 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; 69 -> {70}; 70 -> {71}; + 71 -> {72}; 72 -> {73}; - 73 -> {74}; 74 -> {75}; 75 -> {76}; 76 -> {77}; 77 -> {78}; - 78 -> {66} [color=red]; - 78 -> {58} [color=green]; + 78 -> {79}; 79 -> {80}; - 80 -> {81}; + 80 -> {67} [color=red]; + 80 -> {59} [color=green]; 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; - 85 -> {66} [color=red]; - 85 -> {64} [color=green]; + 85 -> {86}; + 86 -> {87}; + 87 -> {67} [color=red]; + 87 -> {65} [color=green]; subgraph cluster_20 { color=red - 86 [label="Enter function test3" style="filled" fillcolor=red]; + 88 [label="Enter function test3" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 87 [label="Enter block"]; - 88 [label="Postponed enter to lambda"]; + 89 [label="Enter block"]; + 90 [label="Postponed enter to lambda"]; subgraph cluster_22 { color=blue - 118 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 121 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 119 [label="Enter block"]; - 120 [label="Access variable R|/x|"]; - 121 [label="Type operator: (R|/x| as R|kotlin/String|)"]; - 122 [label="Function call: R|/n|()"]; - 123 [label="Exit block"]; + 122 [label="Enter block"]; + 123 [label="Access variable R|/x|"]; + 124 [label="Type operator: (R|/x| as R|kotlin/String|)"]; + 125 [label="Function call: R|/n|()"]; + 126 [label="Exit block"]; } - 124 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 127 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 89 [label="Postponed exit from lambda"]; - 90 [label="Function call: R|kotlin/run|(...)"]; - 91 [label="Function call: R|/id|(...)"]; + 91 [label="Postponed exit from lambda"]; + 92 [label="Function call: R|kotlin/run|(...)"]; + 93 [label="Function call: R|/id|(...)"]; subgraph cluster_24 { color=blue - 92 [label="Enter when"]; + 94 [label="Enter when"]; subgraph cluster_25 { color=blue - 93 [label="Enter when branch condition "]; - 94 [label="Const: Boolean(true)"]; - 95 [label="Exit when branch condition"]; + 95 [label="Enter when branch condition "]; + 96 [label="Const: Boolean(true)"]; + 97 [label="Exit when branch condition"]; } subgraph cluster_26 { color=blue - 96 [label="Enter when branch condition else"]; - 97 [label="Exit when branch condition"]; + 98 [label="Enter when branch condition else"]; + 99 [label="Exit when branch condition"]; } - 98 [label="Enter when branch result"]; + 100 [label="Enter when branch result"]; subgraph cluster_27 { color=blue - 99 [label="Enter block"]; - 100 [label="Const: Int(2)"]; - 101 [label="Exit block"]; + 101 [label="Enter block"]; + 102 [label="Const: Int(2)"]; + 103 [label="Exit block"]; } - 102 [label="Exit when branch result"]; - 103 [label="Enter when branch result"]; + 104 [label="Exit when branch result"]; + 105 [label="Enter when branch result"]; subgraph cluster_28 { color=blue - 104 [label="Enter block"]; - 105 [label="Const: Int(1)"]; - 106 [label="Exit block"]; + 106 [label="Enter block"]; + 107 [label="Const: Int(1)"]; + 108 [label="Exit block"]; } - 107 [label="Exit when branch result"]; - 108 [label="Exit when"]; + 109 [label="Exit when branch result"]; + 110 [label="Exit when"]; } - 109 [label="Postponed enter to lambda"]; + 111 [label="Postponed enter to lambda"]; subgraph cluster_29 { color=blue - 125 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 128 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_30 { color=blue - 126 [label="Enter block"]; - 127 [label="Access variable R|/x|"]; - 128 [label="Access variable #"]; - 129 [label="Const: Int(123)"]; - 130 [label="Exit block"]; + 129 [label="Enter block"]; + 130 [label="Access variable R|/x|"]; + 131 [label="Access variable #"]; + 132 [label="Const: Int(123)"]; + 133 [label="Exit block"]; } - 131 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 134 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 110 [label="Postponed exit from lambda"]; - 111 [label="Function call: R|kotlin/run|(...)"]; - 112 [label="Call arguments union" style="filled" fillcolor=yellow]; - 113 [label="Function call: R|/foo|(...)"]; - 114 [label="Access variable R|/x|"]; - 115 [label="Access variable R|kotlin/String.length|"]; - 116 [label="Exit block"]; + 112 [label="Postponed exit from lambda"]; + 113 [label="Function call: R|kotlin/run|(...)"]; + 114 [label="Call arguments union" style="filled" fillcolor=yellow]; + 115 [label="Function call: R|/foo|(...)"]; + 116 [label="Access variable R|/x|"]; + 117 [label="Smart cast: R|/x|"]; + 118 [label="Access variable R|kotlin/String.length|"]; + 119 [label="Exit block"]; } - 117 [label="Exit function test3" style="filled" fillcolor=red]; + 120 [label="Exit function test3" style="filled" fillcolor=red]; } - 86 -> {87}; - 87 -> {88}; - 88 -> {118}; - 88 -> {89} [color=red]; - 88 -> {118} [style=dashed]; + 88 -> {89}; 89 -> {90}; - 90 -> {91}; + 90 -> {121}; + 90 -> {91} [color=red]; + 90 -> {121} [style=dashed]; 91 -> {92}; 92 -> {93}; 93 -> {94}; 94 -> {95}; - 95 -> {103 96}; + 95 -> {96}; 96 -> {97}; - 97 -> {98}; + 97 -> {105 98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {108}; + 102 -> {103}; 103 -> {104}; - 104 -> {105}; + 104 -> {110}; 105 -> {106}; 106 -> {107}; 107 -> {108}; 108 -> {109}; - 109 -> {125}; - 109 -> {110} [color=red]; - 109 -> {125} [style=dashed]; + 109 -> {110}; 110 -> {111}; - 111 -> {112}; + 111 -> {128}; + 111 -> {112} [color=red]; + 111 -> {128} [style=dashed]; 112 -> {113}; 113 -> {114}; 114 -> {115}; 115 -> {116}; 116 -> {117}; + 117 -> {118}; 118 -> {119}; 119 -> {120}; - 120 -> {121}; 121 -> {122}; 122 -> {123}; 123 -> {124}; - 124 -> {112} [color=red]; - 124 -> {89} [color=green]; + 124 -> {125}; 125 -> {126}; 126 -> {127}; - 127 -> {128}; + 127 -> {114} [color=red]; + 127 -> {91} [color=green]; 128 -> {129}; 129 -> {130}; 130 -> {131}; - 131 -> {112} [color=red]; - 131 -> {110} [color=green]; + 131 -> {132}; + 132 -> {133}; + 133 -> {134}; + 134 -> {114} [color=red]; + 134 -> {112} [color=green]; subgraph cluster_31 { color=red - 132 [label="Enter function test4" style="filled" fillcolor=red]; + 135 [label="Enter function test4" style="filled" fillcolor=red]; subgraph cluster_32 { color=blue - 133 [label="Enter block"]; - 134 [label="Access variable R|/x|"]; - 135 [label="Variable declaration: lvar p: R|kotlin/String?|"]; + 136 [label="Enter block"]; + 137 [label="Access variable R|/x|"]; + 138 [label="Variable declaration: lvar p: R|kotlin/String?|"]; subgraph cluster_33 { color=blue - 136 [label="Enter when"]; + 139 [label="Enter when"]; subgraph cluster_34 { color=blue - 137 [label="Enter when branch condition "]; - 138 [label="Access variable R|/p|"]; - 139 [label="Const: Null(null)"]; - 140 [label="Equality operator !="]; - 141 [label="Exit when branch condition"]; + 140 [label="Enter when branch condition "]; + 141 [label="Access variable R|/p|"]; + 142 [label="Const: Null(null)"]; + 143 [label="Equality operator !="]; + 144 [label="Exit when branch condition"]; } - 142 [label="Synthetic else branch"]; - 143 [label="Enter when branch result"]; + 145 [label="Synthetic else branch"]; + 146 [label="Enter when branch result"]; subgraph cluster_35 { color=blue - 144 [label="Enter block"]; + 147 [label="Enter block"]; subgraph cluster_36 { color=blue - 145 [label="Enter when"]; + 148 [label="Enter when"]; subgraph cluster_37 { color=blue - 146 [label="Enter when branch condition "]; - 147 [label="Const: Boolean(true)"]; - 148 [label="Exit when branch condition"]; + 149 [label="Enter when branch condition "]; + 150 [label="Const: Boolean(true)"]; + 151 [label="Exit when branch condition"]; } subgraph cluster_38 { color=blue - 149 [label="Enter when branch condition else"]; - 150 [label="Exit when branch condition"]; + 152 [label="Enter when branch condition else"]; + 153 [label="Exit when branch condition"]; } - 151 [label="Enter when branch result"]; + 154 [label="Enter when branch result"]; subgraph cluster_39 { color=blue - 152 [label="Enter block"]; - 153 [label="Postponed enter to lambda"]; + 155 [label="Enter block"]; + 156 [label="Postponed enter to lambda"]; subgraph cluster_40 { color=blue - 188 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 191 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_41 { color=blue - 189 [label="Enter block"]; - 190 [label="Function call: R|/n|()"]; - 191 [label="Exit block"]; + 192 [label="Enter block"]; + 193 [label="Function call: R|/n|()"]; + 194 [label="Exit block"]; } - 192 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 195 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 154 [label="Postponed exit from lambda"]; - 155 [label="Function call: R|kotlin/run|(...)"]; - 156 [label="Exit block"]; + 157 [label="Postponed exit from lambda"]; + 158 [label="Function call: R|kotlin/run|(...)"]; + 159 [label="Exit block"]; } - 157 [label="Exit when branch result"]; - 158 [label="Enter when branch result"]; + 160 [label="Exit when branch result"]; + 161 [label="Enter when branch result"]; subgraph cluster_42 { color=blue - 159 [label="Enter block"]; - 160 [label="Postponed enter to lambda"]; + 162 [label="Enter block"]; + 163 [label="Postponed enter to lambda"]; subgraph cluster_43 { color=blue - 181 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 184 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_44 { color=blue - 182 [label="Enter block"]; - 183 [label="Const: Null(null)"]; - 184 [label="Assignment: R|/p|"]; - 185 [label="Function call: R|/n|()"]; - 186 [label="Exit block"]; + 185 [label="Enter block"]; + 186 [label="Const: Null(null)"]; + 187 [label="Assignment: R|/p|"]; + 188 [label="Function call: R|/n|()"]; + 189 [label="Exit block"]; } - 187 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 190 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 161 [label="Postponed exit from lambda"]; - 162 [label="Function call: R|kotlin/run|(...)"]; - 163 [label="Exit block"]; + 164 [label="Postponed exit from lambda"]; + 165 [label="Function call: R|kotlin/run|(...)"]; + 166 [label="Exit block"]; } - 164 [label="Exit when branch result"]; - 165 [label="Exit when"]; + 167 [label="Exit when branch result"]; + 168 [label="Exit when"]; } - 166 [label="Function call: R|/id|(...)"]; - 167 [label="Const: Int(1)"]; - 168 [label="Postponed enter to lambda"]; + 169 [label="Function call: R|/id|(...)"]; + 170 [label="Const: Int(1)"]; + 171 [label="Postponed enter to lambda"]; subgraph cluster_45 { color=blue - 193 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 196 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_46 { color=blue - 194 [label="Enter block"]; - 195 [label="Access variable R|/p|"]; - 196 [label="Access variable #"]; - 197 [label="Const: Int(123)"]; - 198 [label="Exit block"]; + 197 [label="Enter block"]; + 198 [label="Access variable R|/p|"]; + 199 [label="Access variable #"]; + 200 [label="Const: Int(123)"]; + 201 [label="Exit block"]; } - 199 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 202 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 169 [label="Postponed exit from lambda"]; - 170 [label="Function call: R|kotlin/run|(...)"]; - 171 [label="Merge postponed lambda exits"]; - 172 [label="Call arguments union" style="filled" fillcolor=yellow]; - 173 [label="Function call: R|/foo|(...)"]; - 174 [label="Access variable R|/p|"]; - 175 [label="Access variable #"]; - 176 [label="Exit block"]; + 172 [label="Postponed exit from lambda"]; + 173 [label="Function call: R|kotlin/run|(...)"]; + 174 [label="Merge postponed lambda exits"]; + 175 [label="Call arguments union" style="filled" fillcolor=yellow]; + 176 [label="Function call: R|/foo|(...)"]; + 177 [label="Access variable R|/p|"]; + 178 [label="Access variable #"]; + 179 [label="Exit block"]; } - 177 [label="Exit when branch result"]; - 178 [label="Exit when"]; + 180 [label="Exit when branch result"]; + 181 [label="Exit when"]; } - 179 [label="Exit block"]; + 182 [label="Exit block"]; } - 180 [label="Exit function test4" style="filled" fillcolor=red]; + 183 [label="Exit function test4" style="filled" fillcolor=red]; } - 132 -> {133}; - 133 -> {134}; - 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; 138 -> {139}; 139 -> {140}; 140 -> {141}; - 141 -> {143 142}; - 142 -> {178}; + 141 -> {142}; + 142 -> {143}; 143 -> {144}; - 144 -> {145}; - 145 -> {146}; + 144 -> {146 145}; + 145 -> {181}; 146 -> {147}; 147 -> {148}; - 148 -> {158 149}; + 148 -> {149}; 149 -> {150}; 150 -> {151}; - 151 -> {152}; + 151 -> {161 152}; 152 -> {153}; - 153 -> {188}; - 153 -> {154} [color=red]; - 153 -> {188} [style=dashed]; + 153 -> {154}; 154 -> {155}; 155 -> {156}; - 156 -> {157}; - 157 -> {165}; + 156 -> {191}; + 156 -> {157} [color=red]; + 156 -> {191} [style=dashed]; + 157 -> {158}; 158 -> {159}; 159 -> {160}; - 160 -> {181}; - 160 -> {161} [color=red]; - 160 -> {181} [style=dashed]; + 160 -> {168}; 161 -> {162}; 162 -> {163}; - 163 -> {164}; + 163 -> {184}; + 163 -> {164} [color=red]; + 163 -> {184} [style=dashed]; 164 -> {165}; - 165 -> {171 166}; + 165 -> {166}; 166 -> {167}; 167 -> {168}; - 168 -> {193}; - 168 -> {169} [color=red]; - 168 -> {193} [style=dashed]; + 168 -> {174 169}; 169 -> {170}; - 170 -> {172}; + 170 -> {171}; + 171 -> {196}; 171 -> {172} [color=red]; + 171 -> {196} [style=dashed]; 172 -> {173}; - 173 -> {174}; - 174 -> {175}; + 173 -> {175}; + 174 -> {175} [color=red]; 175 -> {176}; 176 -> {177}; 177 -> {178}; 178 -> {179}; 179 -> {180}; + 180 -> {181}; 181 -> {182}; 182 -> {183}; - 183 -> {184}; 184 -> {185}; 185 -> {186}; 186 -> {187}; - 187 -> {171} [color=red]; - 187 -> {161} [color=green]; + 187 -> {188}; 188 -> {189}; 189 -> {190}; - 190 -> {191}; + 190 -> {174} [color=red]; + 190 -> {164} [color=green]; 191 -> {192}; - 192 -> {171} [color=red]; - 192 -> {154} [color=green]; + 192 -> {193}; 193 -> {194}; 194 -> {195}; - 195 -> {196}; + 195 -> {174} [color=red]; + 195 -> {157} [color=green]; 196 -> {197}; 197 -> {198}; 198 -> {199}; - 199 -> {172} [color=red]; - 199 -> {169} [color=green]; + 199 -> {200}; + 200 -> {201}; + 201 -> {202}; + 202 -> {175} [color=red]; + 202 -> {172} [color=green]; subgraph cluster_47 { color=red - 200 [label="Enter function test5" style="filled" fillcolor=red]; + 203 [label="Enter function test5" style="filled" fillcolor=red]; subgraph cluster_48 { color=blue - 201 [label="Enter block"]; - 202 [label="Access variable R|/y|"]; - 203 [label="Enter safe call"]; - 204 [label="Postponed enter to lambda"]; + 204 [label="Enter block"]; + 205 [label="Access variable R|/y|"]; + 206 [label="Enter safe call"]; + 207 [label="Postponed enter to lambda"]; subgraph cluster_49 { color=blue - 219 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 222 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_50 { color=blue - 220 [label="Enter block"]; - 221 [label="Access variable R|/x|"]; - 222 [label="Type operator: (R|/x| as R|kotlin/String|)"]; - 223 [label="Function call: R|/n|()"]; - 224 [label="Exit block"]; + 223 [label="Enter block"]; + 224 [label="Access variable R|/x|"]; + 225 [label="Type operator: (R|/x| as R|kotlin/String|)"]; + 226 [label="Function call: R|/n|()"]; + 227 [label="Exit block"]; } - 225 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 228 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 205 [label="Postponed exit from lambda"]; - 206 [label="Function call: $subj$.R|kotlin/let|(...)"]; - 207 [label="Exit safe call"]; - 208 [label="Const: Int(1)"]; - 209 [label="Postponed enter to lambda"]; + 208 [label="Postponed exit from lambda"]; + 209 [label="Function call: $subj$.R|kotlin/let|(...)"]; + 210 [label="Exit safe call"]; + 211 [label="Const: Int(1)"]; + 212 [label="Postponed enter to lambda"]; subgraph cluster_51 { color=blue - 226 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 229 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_52 { color=blue - 227 [label="Enter block"]; - 228 [label="Const: String()"]; - 229 [label="Exit block"]; + 230 [label="Enter block"]; + 231 [label="Const: String()"]; + 232 [label="Exit block"]; } - 230 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 233 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 210 [label="Postponed exit from lambda"]; - 211 [label="Function call: R|kotlin/run|(...)"]; - 212 [label="Merge postponed lambda exits"]; - 213 [label="Call arguments union" style="filled" fillcolor=yellow]; - 214 [label="Function call: R|/foo|(...)"]; - 215 [label="Access variable R|/x|"]; - 216 [label="Access variable #"]; - 217 [label="Exit block"]; + 213 [label="Postponed exit from lambda"]; + 214 [label="Function call: R|kotlin/run|(...)"]; + 215 [label="Merge postponed lambda exits"]; + 216 [label="Call arguments union" style="filled" fillcolor=yellow]; + 217 [label="Function call: R|/foo|(...)"]; + 218 [label="Access variable R|/x|"]; + 219 [label="Access variable #"]; + 220 [label="Exit block"]; } - 218 [label="Exit function test5" style="filled" fillcolor=red]; + 221 [label="Exit function test5" style="filled" fillcolor=red]; } - 200 -> {201}; - 201 -> {202}; - 202 -> {203 207}; 203 -> {204}; - 204 -> {219}; - 204 -> {205} [color=red]; - 204 -> {219} [style=dashed]; - 205 -> {206}; + 204 -> {205}; + 205 -> {206 210}; 206 -> {207}; - 207 -> {212 208}; + 207 -> {222}; + 207 -> {208} [color=red]; + 207 -> {222} [style=dashed]; 208 -> {209}; - 209 -> {226}; - 209 -> {210} [color=red]; - 209 -> {226} [style=dashed]; - 210 -> {211}; - 211 -> {213}; + 209 -> {210}; + 210 -> {215 211}; + 211 -> {212}; + 212 -> {229}; 212 -> {213} [color=red]; + 212 -> {229} [style=dashed]; 213 -> {214}; - 214 -> {215}; - 215 -> {216}; + 214 -> {216}; + 215 -> {216} [color=red]; 216 -> {217}; 217 -> {218}; + 218 -> {219}; 219 -> {220}; 220 -> {221}; - 221 -> {222}; 222 -> {223}; 223 -> {224}; 224 -> {225}; - 225 -> {212} [color=red]; - 225 -> {205} [color=green]; + 225 -> {226}; 226 -> {227}; 227 -> {228}; - 228 -> {229}; + 228 -> {215} [color=red]; + 228 -> {208} [color=green]; 229 -> {230}; - 230 -> {213} [color=red]; - 230 -> {210} [color=green]; + 230 -> {231}; + 231 -> {232}; + 232 -> {233}; + 233 -> {216} [color=red]; + 233 -> {213} [color=green]; subgraph cluster_53 { color=red - 231 [label="Enter function test6" style="filled" fillcolor=red]; + 234 [label="Enter function test6" style="filled" fillcolor=red]; subgraph cluster_54 { color=blue - 232 [label="Enter block"]; + 235 [label="Enter block"]; subgraph cluster_55 { color=blue - 233 [label="Enter when"]; + 236 [label="Enter when"]; subgraph cluster_56 { color=blue - 234 [label="Enter when branch condition "]; - 235 [label="Const: Boolean(true)"]; - 236 [label="Exit when branch condition"]; + 237 [label="Enter when branch condition "]; + 238 [label="Const: Boolean(true)"]; + 239 [label="Exit when branch condition"]; } subgraph cluster_57 { color=blue - 237 [label="Enter when branch condition else"]; - 238 [label="Exit when branch condition"]; + 240 [label="Enter when branch condition else"]; + 241 [label="Exit when branch condition"]; } - 239 [label="Enter when branch result"]; + 242 [label="Enter when branch result"]; subgraph cluster_58 { color=blue - 240 [label="Enter block"]; - 241 [label="Postponed enter to lambda"]; + 243 [label="Enter block"]; + 244 [label="Postponed enter to lambda"]; subgraph cluster_59 { color=blue - 273 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 276 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_60 { color=blue - 274 [label="Enter block"]; - 275 [label="Access variable R|/x|"]; - 276 [label="Type operator: (R|/x| as R|kotlin/String|)"]; - 277 [label="Function call: R|/n|()"]; - 278 [label="Exit block"]; + 277 [label="Enter block"]; + 278 [label="Access variable R|/x|"]; + 279 [label="Type operator: (R|/x| as R|kotlin/String|)"]; + 280 [label="Function call: R|/n|()"]; + 281 [label="Exit block"]; } - 279 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 282 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 242 [label="Postponed exit from lambda"]; - 243 [label="Function call: R|kotlin/run|(...)"]; - 244 [label="Exit block"]; + 245 [label="Postponed exit from lambda"]; + 246 [label="Function call: R|kotlin/run|(...)"]; + 247 [label="Exit block"]; } - 245 [label="Exit when branch result"]; - 246 [label="Enter when branch result"]; + 248 [label="Exit when branch result"]; + 249 [label="Enter when branch result"]; subgraph cluster_61 { color=blue - 247 [label="Enter block"]; - 248 [label="Postponed enter to lambda"]; + 250 [label="Enter block"]; + 251 [label="Postponed enter to lambda"]; subgraph cluster_62 { color=blue - 266 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 269 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_63 { color=blue - 267 [label="Enter block"]; - 268 [label="Access variable R|/x|"]; - 269 [label="Type operator: (R|/x| as R|kotlin/String|)"]; - 270 [label="Function call: R|/n|()"]; - 271 [label="Exit block"]; + 270 [label="Enter block"]; + 271 [label="Access variable R|/x|"]; + 272 [label="Type operator: (R|/x| as R|kotlin/String|)"]; + 273 [label="Function call: R|/n|()"]; + 274 [label="Exit block"]; } - 272 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 275 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 249 [label="Postponed exit from lambda"]; - 250 [label="Function call: R|kotlin/run|(...)"]; - 251 [label="Exit block"]; + 252 [label="Postponed exit from lambda"]; + 253 [label="Function call: R|kotlin/run|(...)"]; + 254 [label="Exit block"]; } - 252 [label="Exit when branch result"]; - 253 [label="Exit when"]; + 255 [label="Exit when branch result"]; + 256 [label="Exit when"]; } - 254 [label="Function call: R|/id|(...)"]; - 255 [label="Const: Int(1)"]; - 256 [label="Postponed enter to lambda"]; + 257 [label="Function call: R|/id|(...)"]; + 258 [label="Const: Int(1)"]; + 259 [label="Postponed enter to lambda"]; subgraph cluster_64 { color=blue - 280 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 283 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_65 { color=blue - 281 [label="Enter block"]; - 282 [label="Access variable R|/x|"]; - 283 [label="Access variable #"]; - 284 [label="Const: Int(123)"]; - 285 [label="Exit block"]; + 284 [label="Enter block"]; + 285 [label="Access variable R|/x|"]; + 286 [label="Access variable #"]; + 287 [label="Const: Int(123)"]; + 288 [label="Exit block"]; } - 286 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 289 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 257 [label="Postponed exit from lambda"]; - 258 [label="Function call: R|kotlin/run|(...)"]; - 259 [label="Merge postponed lambda exits"]; - 260 [label="Call arguments union" style="filled" fillcolor=yellow]; - 261 [label="Function call: R|/foo|(...)"]; - 262 [label="Access variable R|/x|"]; - 263 [label="Access variable #"]; - 264 [label="Exit block"]; + 260 [label="Postponed exit from lambda"]; + 261 [label="Function call: R|kotlin/run|(...)"]; + 262 [label="Merge postponed lambda exits"]; + 263 [label="Call arguments union" style="filled" fillcolor=yellow]; + 264 [label="Function call: R|/foo|(...)"]; + 265 [label="Access variable R|/x|"]; + 266 [label="Access variable #"]; + 267 [label="Exit block"]; } - 265 [label="Exit function test6" style="filled" fillcolor=red]; + 268 [label="Exit function test6" style="filled" fillcolor=red]; } - 231 -> {232}; - 232 -> {233}; - 233 -> {234}; 234 -> {235}; 235 -> {236}; - 236 -> {246 237}; + 236 -> {237}; 237 -> {238}; 238 -> {239}; - 239 -> {240}; + 239 -> {249 240}; 240 -> {241}; - 241 -> {273}; - 241 -> {242} [color=red]; - 241 -> {273} [style=dashed]; + 241 -> {242}; 242 -> {243}; 243 -> {244}; - 244 -> {245}; - 245 -> {253}; + 244 -> {276}; + 244 -> {245} [color=red]; + 244 -> {276} [style=dashed]; + 245 -> {246}; 246 -> {247}; 247 -> {248}; - 248 -> {266}; - 248 -> {249} [color=red]; - 248 -> {266} [style=dashed]; + 248 -> {256}; 249 -> {250}; 250 -> {251}; - 251 -> {252}; + 251 -> {269}; + 251 -> {252} [color=red]; + 251 -> {269} [style=dashed]; 252 -> {253}; - 253 -> {259 254}; + 253 -> {254}; 254 -> {255}; 255 -> {256}; - 256 -> {280}; - 256 -> {257} [color=red]; - 256 -> {280} [style=dashed]; + 256 -> {262 257}; 257 -> {258}; - 258 -> {260}; + 258 -> {259}; + 259 -> {283}; 259 -> {260} [color=red]; + 259 -> {283} [style=dashed]; 260 -> {261}; - 261 -> {262}; - 262 -> {263}; + 261 -> {263}; + 262 -> {263} [color=red]; 263 -> {264}; 264 -> {265}; + 265 -> {266}; 266 -> {267}; 267 -> {268}; - 268 -> {269}; 269 -> {270}; 270 -> {271}; 271 -> {272}; - 272 -> {259} [color=red]; - 272 -> {249} [color=green]; + 272 -> {273}; 273 -> {274}; 274 -> {275}; - 275 -> {276}; + 275 -> {262} [color=red]; + 275 -> {252} [color=green]; 276 -> {277}; 277 -> {278}; 278 -> {279}; - 279 -> {259} [color=red]; - 279 -> {242} [color=green]; + 279 -> {280}; 280 -> {281}; 281 -> {282}; - 282 -> {283}; + 282 -> {262} [color=red]; + 282 -> {245} [color=green]; 283 -> {284}; 284 -> {285}; 285 -> {286}; - 286 -> {260} [color=red]; - 286 -> {257} [color=green]; + 286 -> {287}; + 287 -> {288}; + 288 -> {289}; + 289 -> {263} [color=red]; + 289 -> {260} [color=green]; subgraph cluster_66 { color=red - 287 [label="Enter function test7" style="filled" fillcolor=red]; + 290 [label="Enter function test7" style="filled" fillcolor=red]; subgraph cluster_67 { color=blue - 288 [label="Enter block"]; - 289 [label="Access variable R|/x|"]; - 290 [label="Variable declaration: lvar p: R|kotlin/String?|"]; + 291 [label="Enter block"]; + 292 [label="Access variable R|/x|"]; + 293 [label="Variable declaration: lvar p: R|kotlin/String?|"]; subgraph cluster_68 { color=blue - 291 [label="Enter when"]; + 294 [label="Enter when"]; subgraph cluster_69 { color=blue - 292 [label="Enter when branch condition "]; - 293 [label="Access variable R|/p|"]; - 294 [label="Const: Null(null)"]; - 295 [label="Equality operator !="]; - 296 [label="Exit when branch condition"]; + 295 [label="Enter when branch condition "]; + 296 [label="Access variable R|/p|"]; + 297 [label="Const: Null(null)"]; + 298 [label="Equality operator !="]; + 299 [label="Exit when branch condition"]; } - 297 [label="Synthetic else branch"]; - 298 [label="Enter when branch result"]; + 300 [label="Synthetic else branch"]; + 301 [label="Enter when branch result"]; subgraph cluster_70 { color=blue - 299 [label="Enter block"]; - 300 [label="Postponed enter to lambda"]; + 302 [label="Enter block"]; + 303 [label="Postponed enter to lambda"]; subgraph cluster_71 { color=blue - 317 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 320 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_72 { color=blue - 318 [label="Enter block"]; - 319 [label="Const: Null(null)"]; - 320 [label="Assignment: R|/p|"]; - 321 [label="Function call: R|/n|()"]; - 322 [label="Exit block"]; + 321 [label="Enter block"]; + 322 [label="Const: Null(null)"]; + 323 [label="Assignment: R|/p|"]; + 324 [label="Function call: R|/n|()"]; + 325 [label="Exit block"]; } - 323 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 326 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 301 [label="Postponed exit from lambda"]; - 302 [label="Function call: R|kotlin/run|(...)"]; - 303 [label="Function call: R|/id|(...)"]; - 304 [label="Const: Int(1)"]; - 305 [label="Postponed enter to lambda"]; + 304 [label="Postponed exit from lambda"]; + 305 [label="Function call: R|kotlin/run|(...)"]; + 306 [label="Function call: R|/id|(...)"]; + 307 [label="Const: Int(1)"]; + 308 [label="Postponed enter to lambda"]; subgraph cluster_73 { color=blue - 324 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 327 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_74 { color=blue - 325 [label="Enter block"]; - 326 [label="Access variable R|/p|"]; - 327 [label="Access variable #"]; - 328 [label="Const: Int(123)"]; - 329 [label="Exit block"]; + 328 [label="Enter block"]; + 329 [label="Access variable R|/p|"]; + 330 [label="Smart cast: R|/p|"]; + 331 [label="Access variable #"]; + 332 [label="Const: Int(123)"]; + 333 [label="Exit block"]; } - 330 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 334 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 306 [label="Postponed exit from lambda"]; - 307 [label="Function call: R|kotlin/run|(...)"]; - 308 [label="Call arguments union" style="filled" fillcolor=yellow]; - 309 [label="Function call: R|/foo|(...)"]; - 310 [label="Access variable R|/p|"]; - 311 [label="Access variable #"]; - 312 [label="Exit block"]; + 309 [label="Postponed exit from lambda"]; + 310 [label="Function call: R|kotlin/run|(...)"]; + 311 [label="Call arguments union" style="filled" fillcolor=yellow]; + 312 [label="Function call: R|/foo|(...)"]; + 313 [label="Access variable R|/p|"]; + 314 [label="Access variable #"]; + 315 [label="Exit block"]; } - 313 [label="Exit when branch result"]; - 314 [label="Exit when"]; + 316 [label="Exit when branch result"]; + 317 [label="Exit when"]; } - 315 [label="Exit block"]; + 318 [label="Exit block"]; } - 316 [label="Exit function test7" style="filled" fillcolor=red]; + 319 [label="Exit function test7" style="filled" fillcolor=red]; } - 287 -> {288}; - 288 -> {289}; - 289 -> {290}; 290 -> {291}; 291 -> {292}; 292 -> {293}; 293 -> {294}; 294 -> {295}; 295 -> {296}; - 296 -> {298 297}; - 297 -> {314}; + 296 -> {297}; + 297 -> {298}; 298 -> {299}; - 299 -> {300}; + 299 -> {301 300}; 300 -> {317}; - 300 -> {301} [color=red]; - 300 -> {317} [style=dashed]; 301 -> {302}; 302 -> {303}; - 303 -> {304}; + 303 -> {320}; + 303 -> {304} [color=red]; + 303 -> {320} [style=dashed]; 304 -> {305}; - 305 -> {324}; - 305 -> {306} [color=red]; - 305 -> {324} [style=dashed]; + 305 -> {306}; 306 -> {307}; 307 -> {308}; - 308 -> {309}; + 308 -> {327}; + 308 -> {309} [color=red]; + 308 -> {327} [style=dashed]; 309 -> {310}; 310 -> {311}; 311 -> {312}; @@ -924,21 +928,25 @@ digraph flowFromInplaceLambda2_kt { 313 -> {314}; 314 -> {315}; 315 -> {316}; + 316 -> {317}; 317 -> {318}; 318 -> {319}; - 319 -> {320}; 320 -> {321}; 321 -> {322}; 322 -> {323}; - 323 -> {308} [color=red]; - 323 -> {301} [color=green]; + 323 -> {324}; 324 -> {325}; 325 -> {326}; - 326 -> {327}; + 326 -> {311} [color=red]; + 326 -> {304} [color=green]; 327 -> {328}; 328 -> {329}; 329 -> {330}; - 330 -> {308} [color=red]; - 330 -> {306} [color=green]; + 330 -> {331}; + 331 -> {332}; + 332 -> {333}; + 333 -> {334}; + 334 -> {311} [color=red]; + 334 -> {309} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda3.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda3.dot index 07be819046c..9961fb27c49 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda3.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromInplaceLambda3.dot @@ -75,29 +75,32 @@ digraph flowFromInplaceLambda3_kt { 22 [label="Const: String()"]; 23 [label="Assignment: R|/x|"]; 24 [label="Access variable R|/x|"]; - 25 [label="Access variable R|kotlin/String.length|"]; - 26 [label="Postponed enter to lambda"]; + 25 [label="Smart cast: R|/x|"]; + 26 [label="Access variable R|kotlin/String.length|"]; + 27 [label="Postponed enter to lambda"]; subgraph cluster_10 { color=blue - 35 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 38 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 36 [label="Enter block"]; - 37 [label="Const: Int(1)"]; - 38 [label="Assignment: R|/x|"]; - 39 [label="Exit block"]; + 39 [label="Enter block"]; + 40 [label="Const: Int(1)"]; + 41 [label="Assignment: R|/x|"]; + 42 [label="Exit block"]; } - 40 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 43 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 27 [label="Postponed exit from lambda"]; - 28 [label="Function call: R|/unknown|(...)"]; - 29 [label="Access variable R|/x|"]; - 30 [label="Access variable #"]; - 31 [label="Access variable R|/x|"]; - 32 [label="Function call: R|/x|.#()"]; - 33 [label="Exit block"]; + 28 [label="Postponed exit from lambda"]; + 29 [label="Function call: R|/unknown|(...)"]; + 30 [label="Access variable R|/x|"]; + 31 [label="Smart cast: R|/x|"]; + 32 [label="Access variable #"]; + 33 [label="Access variable R|/x|"]; + 34 [label="Smart cast: R|/x|"]; + 35 [label="Function call: R|/x|.#()"]; + 36 [label="Exit block"]; } - 34 [label="Exit function test1" style="filled" fillcolor=red]; + 37 [label="Exit function test1" style="filled" fillcolor=red]; } 19 -> {20}; 20 -> {21}; @@ -106,202 +109,223 @@ digraph flowFromInplaceLambda3_kt { 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {27 35}; - 26 -> {35} [style=dashed]; - 27 -> {28}; + 26 -> {27}; + 27 -> {28 38}; + 27 -> {38} [style=dashed]; 28 -> {29}; 29 -> {30}; 30 -> {31}; 31 -> {32}; 32 -> {33}; 33 -> {34}; - 35 -> {40 36}; + 34 -> {35}; + 35 -> {36}; 36 -> {37}; - 37 -> {38}; - 38 -> {39}; + 38 -> {43 39}; 39 -> {40}; - 40 -> {27}; - 40 -> {35} [color=green style=dashed]; + 40 -> {41}; + 41 -> {42}; + 42 -> {43}; + 43 -> {28}; + 43 -> {38} [color=green style=dashed]; subgraph cluster_12 { color=red - 41 [label="Enter function test2" style="filled" fillcolor=red]; + 44 [label="Enter function test2" style="filled" fillcolor=red]; subgraph cluster_13 { color=blue - 42 [label="Enter block"]; - 43 [label="Variable declaration: lvar x: R|kotlin/Any?|"]; - 44 [label="Const: String()"]; - 45 [label="Assignment: R|/x|"]; - 46 [label="Access variable R|/x|"]; - 47 [label="Access variable R|kotlin/String.length|"]; - 48 [label="Postponed enter to lambda"]; + 45 [label="Enter block"]; + 46 [label="Variable declaration: lvar x: R|kotlin/Any?|"]; + 47 [label="Const: String()"]; + 48 [label="Assignment: R|/x|"]; + 49 [label="Access variable R|/x|"]; + 50 [label="Smart cast: R|/x|"]; + 51 [label="Access variable R|kotlin/String.length|"]; + 52 [label="Postponed enter to lambda"]; subgraph cluster_14 { color=blue - 58 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 64 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_15 { color=blue - 59 [label="Enter block"]; - 60 [label="Const: Int(1)"]; - 61 [label="Assignment: R|/x|"]; - 62 [label="Exit block"]; + 65 [label="Enter block"]; + 66 [label="Const: Int(1)"]; + 67 [label="Assignment: R|/x|"]; + 68 [label="Exit block"]; } - 63 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 69 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 49 [label="Call arguments union" style="filled" fillcolor=yellow]; - 50 [label="Postponed exit from lambda"]; - 51 [label="Function call: R|/atLeastOnce|(...)"]; - 52 [label="Access variable R|/x|"]; - 53 [label="Access variable #"]; - 54 [label="Access variable R|/x|"]; - 55 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 56 [label="Exit block"]; + 53 [label="Call arguments union" style="filled" fillcolor=yellow]; + 54 [label="Postponed exit from lambda"]; + 55 [label="Function call: R|/atLeastOnce|(...)"]; + 56 [label="Access variable R|/x|"]; + 57 [label="Smart cast: R|/x|"]; + 58 [label="Access variable #"]; + 59 [label="Access variable R|/x|"]; + 60 [label="Smart cast: R|/x|"]; + 61 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 62 [label="Exit block"]; } - 57 [label="Exit function test2" style="filled" fillcolor=red]; + 63 [label="Exit function test2" style="filled" fillcolor=red]; } - 41 -> {42}; - 42 -> {43}; - 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; 47 -> {48}; - 48 -> {58}; - 48 -> {50} [color=red]; - 48 -> {58} [style=dashed]; - 49 -> {51} [color=red]; - 50 -> {51} [color=green]; + 48 -> {49}; + 49 -> {50}; + 50 -> {51}; 51 -> {52}; - 52 -> {53}; - 53 -> {54}; - 54 -> {55}; + 52 -> {64}; + 52 -> {54} [color=red]; + 52 -> {64} [style=dashed]; + 53 -> {55} [color=red]; + 54 -> {55} [color=green]; 55 -> {56}; 56 -> {57}; + 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; 61 -> {62}; 62 -> {63}; - 63 -> {49} [color=red]; - 63 -> {50} [color=green]; - 63 -> {58} [color=green style=dashed]; - - subgraph cluster_16 { - color=red - 64 [label="Enter function test3" style="filled" fillcolor=red]; - subgraph cluster_17 { - color=blue - 65 [label="Enter block"]; - 66 [label="Variable declaration: lvar x: R|kotlin/Any?|"]; - 67 [label="Const: String()"]; - 68 [label="Assignment: R|/x|"]; - 69 [label="Access variable R|/x|"]; - 70 [label="Access variable R|kotlin/String.length|"]; - 71 [label="Postponed enter to lambda"]; - subgraph cluster_18 { - color=blue - 81 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_19 { - color=blue - 82 [label="Enter block"]; - 83 [label="Const: Int(1)"]; - 84 [label="Assignment: R|/x|"]; - 85 [label="Exit block"]; - } - 86 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 72 [label="Call arguments union" style="filled" fillcolor=yellow]; - 73 [label="Postponed exit from lambda"]; - 74 [label="Function call: R|/exactlyOnce|(...)"]; - 75 [label="Access variable R|/x|"]; - 76 [label="Access variable #"]; - 77 [label="Access variable R|/x|"]; - 78 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 79 [label="Exit block"]; - } - 80 [label="Exit function test3" style="filled" fillcolor=red]; - } 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; - 69 -> {70}; + 69 -> {53} [color=red]; + 69 -> {54} [color=green]; + 69 -> {64} [color=green style=dashed]; + + subgraph cluster_16 { + color=red + 70 [label="Enter function test3" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 71 [label="Enter block"]; + 72 [label="Variable declaration: lvar x: R|kotlin/Any?|"]; + 73 [label="Const: String()"]; + 74 [label="Assignment: R|/x|"]; + 75 [label="Access variable R|/x|"]; + 76 [label="Smart cast: R|/x|"]; + 77 [label="Access variable R|kotlin/String.length|"]; + 78 [label="Postponed enter to lambda"]; + subgraph cluster_18 { + color=blue + 90 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_19 { + color=blue + 91 [label="Enter block"]; + 92 [label="Const: Int(1)"]; + 93 [label="Assignment: R|/x|"]; + 94 [label="Exit block"]; + } + 95 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 79 [label="Call arguments union" style="filled" fillcolor=yellow]; + 80 [label="Postponed exit from lambda"]; + 81 [label="Function call: R|/exactlyOnce|(...)"]; + 82 [label="Access variable R|/x|"]; + 83 [label="Smart cast: R|/x|"]; + 84 [label="Access variable #"]; + 85 [label="Access variable R|/x|"]; + 86 [label="Smart cast: R|/x|"]; + 87 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 88 [label="Exit block"]; + } + 89 [label="Exit function test3" style="filled" fillcolor=red]; + } 70 -> {71}; - 71 -> {81}; - 71 -> {73} [color=red]; - 71 -> {81} [style=dashed]; - 72 -> {74} [color=red]; - 73 -> {74} [color=green]; + 71 -> {72}; + 72 -> {73}; + 73 -> {74}; 74 -> {75}; 75 -> {76}; 76 -> {77}; 77 -> {78}; - 78 -> {79}; - 79 -> {80}; + 78 -> {90}; + 78 -> {80} [color=red]; + 78 -> {90} [style=dashed]; + 79 -> {81} [color=red]; + 80 -> {81} [color=green]; 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; 85 -> {86}; - 86 -> {72} [color=red]; - 86 -> {73} [color=green]; - 86 -> {81} [color=green style=dashed]; - - subgraph cluster_20 { - color=red - 87 [label="Enter function test4" style="filled" fillcolor=red]; - subgraph cluster_21 { - color=blue - 88 [label="Enter block"]; - 89 [label="Variable declaration: lvar x: R|kotlin/Any?|"]; - 90 [label="Const: String()"]; - 91 [label="Assignment: R|/x|"]; - 92 [label="Access variable R|/x|"]; - 93 [label="Access variable R|kotlin/String.length|"]; - 94 [label="Postponed enter to lambda"]; - subgraph cluster_22 { - color=blue - 103 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_23 { - color=blue - 104 [label="Enter block"]; - 105 [label="Const: Int(1)"]; - 106 [label="Assignment: R|/x|"]; - 107 [label="Exit block"]; - } - 108 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 95 [label="Postponed exit from lambda"]; - 96 [label="Function call: R|/atMostOnce|(...)"]; - 97 [label="Access variable R|/x|"]; - 98 [label="Access variable #"]; - 99 [label="Access variable R|/x|"]; - 100 [label="Function call: R|/x|.#()"]; - 101 [label="Exit block"]; - } - 102 [label="Exit function test4" style="filled" fillcolor=red]; - } + 86 -> {87}; 87 -> {88}; 88 -> {89}; - 89 -> {90}; 90 -> {91}; 91 -> {92}; 92 -> {93}; 93 -> {94}; - 94 -> {95 103}; - 94 -> {103} [style=dashed]; - 95 -> {96}; + 94 -> {95}; + 95 -> {79} [color=red]; + 95 -> {80} [color=green]; + 95 -> {90} [color=green style=dashed]; + + subgraph cluster_20 { + color=red + 96 [label="Enter function test4" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 97 [label="Enter block"]; + 98 [label="Variable declaration: lvar x: R|kotlin/Any?|"]; + 99 [label="Const: String()"]; + 100 [label="Assignment: R|/x|"]; + 101 [label="Access variable R|/x|"]; + 102 [label="Smart cast: R|/x|"]; + 103 [label="Access variable R|kotlin/String.length|"]; + 104 [label="Postponed enter to lambda"]; + subgraph cluster_22 { + color=blue + 115 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_23 { + color=blue + 116 [label="Enter block"]; + 117 [label="Const: Int(1)"]; + 118 [label="Assignment: R|/x|"]; + 119 [label="Exit block"]; + } + 120 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 105 [label="Postponed exit from lambda"]; + 106 [label="Function call: R|/atMostOnce|(...)"]; + 107 [label="Access variable R|/x|"]; + 108 [label="Smart cast: R|/x|"]; + 109 [label="Access variable #"]; + 110 [label="Access variable R|/x|"]; + 111 [label="Smart cast: R|/x|"]; + 112 [label="Function call: R|/x|.#()"]; + 113 [label="Exit block"]; + } + 114 [label="Exit function test4" style="filled" fillcolor=red]; + } 96 -> {97}; 97 -> {98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; 101 -> {102}; - 103 -> {108 104}; - 104 -> {105}; + 102 -> {103}; + 103 -> {104}; + 104 -> {105 115}; + 104 -> {115} [style=dashed]; 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {95}; + 108 -> {109}; + 109 -> {110}; + 110 -> {111}; + 111 -> {112}; + 112 -> {113}; + 113 -> {114}; + 115 -> {120 116}; + 116 -> {117}; + 117 -> {118}; + 118 -> {119}; + 119 -> {120}; + 120 -> {105}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromTwoInplaceLambdas.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromTwoInplaceLambdas.dot index d854907d704..df5dab8ca9f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromTwoInplaceLambdas.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/flowFromTwoInplaceLambdas.dot @@ -89,11 +89,12 @@ digraph flowFromTwoInplaceLambdas_kt { color=blue 47 [label="Enter block"]; 48 [label="Access variable R|/p|"]; - 49 [label="Access variable #"]; - 50 [label="Const: Int(123)"]; - 51 [label="Exit block"]; + 49 [label="Smart cast: R|/p|"]; + 50 [label="Access variable #"]; + 51 [label="Const: Int(123)"]; + 52 [label="Exit block"]; } - 52 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 53 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 27 [label="Call arguments union" style="filled" fillcolor=yellow]; 30 [label="Postponed exit from lambda"]; @@ -152,77 +153,78 @@ digraph flowFromTwoInplaceLambdas_kt { 49 -> {50}; 50 -> {51}; 51 -> {52}; - 52 -> {27} [color=red]; - 52 -> {30} [color=green]; + 52 -> {53}; + 53 -> {27} [color=red]; + 53 -> {30} [color=green]; subgraph cluster_13 { color=red - 53 [label="Enter function test1_tail" style="filled" fillcolor=red]; + 54 [label="Enter function test1_tail" style="filled" fillcolor=red]; subgraph cluster_14 { color=blue - 54 [label="Enter block"]; - 55 [label="Access variable R|/x|"]; - 56 [label="Variable declaration: lvar p: R|kotlin/String?|"]; + 55 [label="Enter block"]; + 56 [label="Access variable R|/x|"]; + 57 [label="Variable declaration: lvar p: R|kotlin/String?|"]; subgraph cluster_15 { color=blue - 57 [label="Enter when"]; + 58 [label="Enter when"]; subgraph cluster_16 { color=blue - 58 [label="Enter when branch condition "]; - 59 [label="Access variable R|/p|"]; - 60 [label="Const: Null(null)"]; - 61 [label="Equality operator !="]; - 62 [label="Exit when branch condition"]; + 59 [label="Enter when branch condition "]; + 60 [label="Access variable R|/p|"]; + 61 [label="Const: Null(null)"]; + 62 [label="Equality operator !="]; + 63 [label="Exit when branch condition"]; } - 63 [label="Synthetic else branch"]; - 64 [label="Enter when branch result"]; + 64 [label="Synthetic else branch"]; + 65 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 65 [label="Enter block"]; - 66 [label="Postponed enter to lambda"]; + 66 [label="Enter block"]; + 67 [label="Postponed enter to lambda"]; subgraph cluster_18 { color=blue - 86 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 87 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_19 { color=blue - 87 [label="Enter block"]; - 88 [label="Access variable R|/p|"]; - 89 [label="Access variable #"]; - 90 [label="Const: Int(123)"]; - 91 [label="Exit block"]; + 88 [label="Enter block"]; + 89 [label="Access variable R|/p|"]; + 90 [label="Smart cast: R|/p|"]; + 91 [label="Access variable #"]; + 92 [label="Const: Int(123)"]; + 93 [label="Exit block"]; } - 92 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 94 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 68 [label="Postponed exit from lambda"]; - 69 [label="Postponed enter to lambda"]; + 69 [label="Postponed exit from lambda"]; + 70 [label="Postponed enter to lambda"]; subgraph cluster_20 { color=blue - 79 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 80 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 80 [label="Enter block"]; - 81 [label="Const: Null(null)"]; - 82 [label="Assignment: R|/p|"]; - 83 [label="Function call: R|/n|()"]; - 84 [label="Exit block"]; + 81 [label="Enter block"]; + 82 [label="Const: Null(null)"]; + 83 [label="Assignment: R|/p|"]; + 84 [label="Function call: R|/n|()"]; + 85 [label="Exit block"]; } - 85 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 86 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 67 [label="Call arguments union" style="filled" fillcolor=yellow]; - 70 [label="Postponed exit from lambda"]; - 71 [label="Function call: R|/run2|(...)"]; - 72 [label="Access variable R|/p|"]; - 73 [label="Access variable #"]; - 74 [label="Exit block"]; + 68 [label="Call arguments union" style="filled" fillcolor=yellow]; + 71 [label="Postponed exit from lambda"]; + 72 [label="Function call: R|/run2|(...)"]; + 73 [label="Access variable R|/p|"]; + 74 [label="Access variable #"]; + 75 [label="Exit block"]; } - 75 [label="Exit when branch result"]; - 76 [label="Exit when"]; + 76 [label="Exit when branch result"]; + 77 [label="Exit when"]; } - 77 [label="Exit block"]; + 78 [label="Exit block"]; } - 78 [label="Exit function test1_tail" style="filled" fillcolor=red]; + 79 [label="Exit function test1_tail" style="filled" fillcolor=red]; } - 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; @@ -231,316 +233,325 @@ digraph flowFromTwoInplaceLambdas_kt { 59 -> {60}; 60 -> {61}; 61 -> {62}; - 62 -> {64 63}; - 63 -> {76}; - 64 -> {65}; + 62 -> {63}; + 63 -> {65 64}; + 64 -> {77}; 65 -> {66}; - 66 -> {86}; - 66 -> {68} [color=red]; - 66 -> {86} [style=dashed]; - 67 -> {71} [color=red]; - 68 -> {69}; - 69 -> {79}; - 69 -> {70} [color=red]; - 69 -> {79} [style=dashed]; - 70 -> {71} [color=green]; - 71 -> {72}; + 66 -> {67}; + 67 -> {87}; + 67 -> {69} [color=red]; + 67 -> {87} [style=dashed]; + 68 -> {72} [color=red]; + 69 -> {70}; + 70 -> {80}; + 70 -> {71} [color=red]; + 70 -> {80} [style=dashed]; + 71 -> {72} [color=green]; 72 -> {73}; 73 -> {74}; 74 -> {75}; 75 -> {76}; 76 -> {77}; 77 -> {78}; - 79 -> {80}; + 78 -> {79}; 80 -> {81}; 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; - 85 -> {67} [color=red]; - 85 -> {70} [color=green]; - 86 -> {87}; + 85 -> {86}; + 86 -> {68} [color=red]; + 86 -> {71} [color=green]; 87 -> {88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; - 92 -> {67} [color=red]; - 92 -> {68} [color=green]; + 92 -> {93}; + 93 -> {94}; + 94 -> {68} [color=red]; + 94 -> {69} [color=green]; subgraph cluster_22 { color=red - 93 [label="Enter function test2" style="filled" fillcolor=red]; + 95 [label="Enter function test2" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 94 [label="Enter block"]; - 95 [label="Access variable R|/x|"]; - 96 [label="Variable declaration: lvar p: R|kotlin/Any?|"]; - 97 [label="Access variable R|/p|"]; - 98 [label="Access variable #"]; - 99 [label="Postponed enter to lambda"]; + 96 [label="Enter block"]; + 97 [label="Access variable R|/x|"]; + 98 [label="Variable declaration: lvar p: R|kotlin/Any?|"]; + 99 [label="Access variable R|/p|"]; + 100 [label="Access variable #"]; + 101 [label="Postponed enter to lambda"]; subgraph cluster_24 { color=blue - 113 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 117 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_25 { color=blue - 114 [label="Enter block"]; - 115 [label="Const: Null(null)"]; - 116 [label="Assignment: R|/p|"]; - 117 [label="Function call: R|/n|()"]; - 118 [label="Exit block"]; + 118 [label="Enter block"]; + 119 [label="Const: Null(null)"]; + 120 [label="Assignment: R|/p|"]; + 121 [label="Function call: R|/n|()"]; + 122 [label="Exit block"]; } - 119 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 123 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 101 [label="Postponed exit from lambda"]; - 102 [label="Postponed enter to lambda"]; + 103 [label="Postponed exit from lambda"]; + 104 [label="Postponed enter to lambda"]; subgraph cluster_26 { color=blue - 120 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 124 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_27 { color=blue - 121 [label="Enter block"]; - 122 [label="Access variable R|/p|"]; - 123 [label="Type operator: (R|/p| as R|kotlin/String|)"]; - 124 [label="Const: Int(123)"]; - 125 [label="Exit block"]; + 125 [label="Enter block"]; + 126 [label="Access variable R|/p|"]; + 127 [label="Type operator: (R|/p| as R|kotlin/String|)"]; + 128 [label="Const: Int(123)"]; + 129 [label="Exit block"]; } - 126 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 130 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 100 [label="Call arguments union" style="filled" fillcolor=yellow]; - 103 [label="Postponed exit from lambda"]; - 104 [label="Function call: R|/run2|(...)"]; - 105 [label="Access variable R|/p|"]; - 106 [label="Access variable #"]; + 102 [label="Call arguments union" style="filled" fillcolor=yellow]; + 105 [label="Postponed exit from lambda"]; + 106 [label="Function call: R|/run2|(...)"]; 107 [label="Access variable R|/p|"]; - 108 [label="Enter safe call"]; - 109 [label="Access variable R|kotlin/String.length|"]; - 110 [label="Exit safe call"]; - 111 [label="Exit block"]; + 108 [label="Smart cast: R|/p|"]; + 109 [label="Access variable #"]; + 110 [label="Access variable R|/p|"]; + 111 [label="Smart cast: R|/p|"]; + 112 [label="Enter safe call"]; + 113 [label="Access variable R|kotlin/String.length|"]; + 114 [label="Exit safe call"]; + 115 [label="Exit block"]; } - 112 [label="Exit function test2" style="filled" fillcolor=red]; + 116 [label="Exit function test2" style="filled" fillcolor=red]; } - 93 -> {94}; - 94 -> {95}; 95 -> {96}; 96 -> {97}; 97 -> {98}; 98 -> {99}; - 99 -> {113}; - 99 -> {101} [color=red]; - 99 -> {113} [style=dashed]; - 100 -> {104} [color=red]; - 101 -> {102}; - 102 -> {120}; - 102 -> {103} [color=red]; - 102 -> {120} [style=dashed]; - 103 -> {104} [color=green]; - 104 -> {105}; - 105 -> {106}; + 99 -> {100}; + 100 -> {101}; + 101 -> {117}; + 101 -> {103} [color=red]; + 101 -> {117} [style=dashed]; + 102 -> {106} [color=red]; + 103 -> {104}; + 104 -> {124}; + 104 -> {105} [color=red]; + 104 -> {124} [style=dashed]; + 105 -> {106} [color=green]; 106 -> {107}; - 107 -> {108 110}; + 107 -> {108}; 108 -> {109}; 109 -> {110}; 110 -> {111}; - 111 -> {112}; + 111 -> {112 114}; + 112 -> {113}; 113 -> {114}; 114 -> {115}; 115 -> {116}; - 116 -> {117}; 117 -> {118}; 118 -> {119}; - 119 -> {100} [color=red]; - 119 -> {101} [color=green]; + 119 -> {120}; 120 -> {121}; 121 -> {122}; 122 -> {123}; - 123 -> {124}; + 123 -> {102} [color=red]; + 123 -> {103} [color=green]; 124 -> {125}; 125 -> {126}; - 126 -> {100} [color=red]; - 126 -> {103} [color=green]; - - subgraph cluster_28 { - color=red - 127 [label="Enter function test3" style="filled" fillcolor=red]; - subgraph cluster_29 { - color=blue - 128 [label="Enter block"]; - 129 [label="Access variable R|/x|"]; - 130 [label="Variable declaration: lvar p: R|kotlin/Any?|"]; - 131 [label="Access variable R|/p|"]; - 132 [label="Access variable #"]; - 133 [label="Postponed enter to lambda"]; - subgraph cluster_30 { - color=blue - 147 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_31 { - color=blue - 148 [label="Enter block"]; - 149 [label="Const: Null(null)"]; - 150 [label="Assignment: R|/p|"]; - 151 [label="Function call: R|/n|()"]; - 152 [label="Exit block"]; - } - 153 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 135 [label="Postponed exit from lambda"]; - 136 [label="Postponed enter to lambda"]; - subgraph cluster_32 { - color=blue - 154 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_33 { - color=blue - 155 [label="Enter block"]; - 156 [label="Const: String()"]; - 157 [label="Assignment: R|/p|"]; - 158 [label="Const: Int(123)"]; - 159 [label="Exit block"]; - } - 160 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 134 [label="Call arguments union" style="filled" fillcolor=yellow]; - 137 [label="Postponed exit from lambda"]; - 138 [label="Function call: R|/run2|(...)"]; - 139 [label="Access variable R|/p|"]; - 140 [label="Access variable #"]; - 141 [label="Access variable R|/p|"]; - 142 [label="Enter safe call"]; - 143 [label="Access variable R|kotlin/String.length|"]; - 144 [label="Exit safe call"]; - 145 [label="Exit block"]; - } - 146 [label="Exit function test3" style="filled" fillcolor=red]; - } + 126 -> {127}; 127 -> {128}; 128 -> {129}; 129 -> {130}; - 130 -> {131}; + 130 -> {102} [color=red]; + 130 -> {105} [color=green]; + + subgraph cluster_28 { + color=red + 131 [label="Enter function test3" style="filled" fillcolor=red]; + subgraph cluster_29 { + color=blue + 132 [label="Enter block"]; + 133 [label="Access variable R|/x|"]; + 134 [label="Variable declaration: lvar p: R|kotlin/Any?|"]; + 135 [label="Access variable R|/p|"]; + 136 [label="Access variable #"]; + 137 [label="Postponed enter to lambda"]; + subgraph cluster_30 { + color=blue + 153 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_31 { + color=blue + 154 [label="Enter block"]; + 155 [label="Const: Null(null)"]; + 156 [label="Assignment: R|/p|"]; + 157 [label="Function call: R|/n|()"]; + 158 [label="Exit block"]; + } + 159 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 139 [label="Postponed exit from lambda"]; + 140 [label="Postponed enter to lambda"]; + subgraph cluster_32 { + color=blue + 160 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_33 { + color=blue + 161 [label="Enter block"]; + 162 [label="Const: String()"]; + 163 [label="Assignment: R|/p|"]; + 164 [label="Const: Int(123)"]; + 165 [label="Exit block"]; + } + 166 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 138 [label="Call arguments union" style="filled" fillcolor=yellow]; + 141 [label="Postponed exit from lambda"]; + 142 [label="Function call: R|/run2|(...)"]; + 143 [label="Access variable R|/p|"]; + 144 [label="Smart cast: R|/p|"]; + 145 [label="Access variable #"]; + 146 [label="Access variable R|/p|"]; + 147 [label="Smart cast: R|/p|"]; + 148 [label="Enter safe call"]; + 149 [label="Access variable R|kotlin/String.length|"]; + 150 [label="Exit safe call"]; + 151 [label="Exit block"]; + } + 152 [label="Exit function test3" style="filled" fillcolor=red]; + } 131 -> {132}; 132 -> {133}; - 133 -> {147}; - 133 -> {135} [color=red]; - 133 -> {147} [style=dashed]; - 134 -> {138} [color=red]; + 133 -> {134}; + 134 -> {135}; 135 -> {136}; - 136 -> {154}; - 136 -> {137} [color=red]; - 136 -> {154} [style=dashed]; - 137 -> {138} [color=green]; - 138 -> {139}; + 136 -> {137}; + 137 -> {153}; + 137 -> {139} [color=red]; + 137 -> {153} [style=dashed]; + 138 -> {142} [color=red]; 139 -> {140}; - 140 -> {141}; - 141 -> {142 144}; + 140 -> {160}; + 140 -> {141} [color=red]; + 140 -> {160} [style=dashed]; + 141 -> {142} [color=green]; 142 -> {143}; 143 -> {144}; 144 -> {145}; 145 -> {146}; - 147 -> {148}; + 146 -> {147}; + 147 -> {148 150}; 148 -> {149}; 149 -> {150}; 150 -> {151}; 151 -> {152}; - 152 -> {153}; - 153 -> {134} [color=red]; - 153 -> {135} [color=green]; + 153 -> {154}; 154 -> {155}; 155 -> {156}; 156 -> {157}; 157 -> {158}; 158 -> {159}; - 159 -> {160}; - 160 -> {134} [color=red]; - 160 -> {137} [color=green]; + 159 -> {138} [color=red]; + 159 -> {139} [color=green]; + 160 -> {161}; + 161 -> {162}; + 162 -> {163}; + 163 -> {164}; + 164 -> {165}; + 165 -> {166}; + 166 -> {138} [color=red]; + 166 -> {141} [color=green]; subgraph cluster_34 { color=red - 161 [label="Enter class I1" style="filled" fillcolor=red]; - 162 [label="Exit class I1" style="filled" fillcolor=red]; + 167 [label="Enter class I1" style="filled" fillcolor=red]; + 168 [label="Exit class I1" style="filled" fillcolor=red]; } - 161 -> {162} [color=green]; + 167 -> {168} [color=green]; subgraph cluster_35 { color=red - 163 [label="Enter class I2" style="filled" fillcolor=red]; - 164 [label="Exit class I2" style="filled" fillcolor=red]; + 169 [label="Enter class I2" style="filled" fillcolor=red]; + 170 [label="Exit class I2" style="filled" fillcolor=red]; } - 163 -> {164} [color=green]; + 169 -> {170} [color=green]; subgraph cluster_36 { color=red - 165 [label="Enter function test4" style="filled" fillcolor=red]; + 171 [label="Enter function test4" style="filled" fillcolor=red]; subgraph cluster_37 { color=blue - 166 [label="Enter block"]; - 167 [label="Access variable R|/x|"]; - 168 [label="Access variable #"]; - 169 [label="Access variable R|/x|"]; - 170 [label="Access variable #"]; - 171 [label="Postponed enter to lambda"]; + 172 [label="Enter block"]; + 173 [label="Access variable R|/x|"]; + 174 [label="Access variable #"]; + 175 [label="Access variable R|/x|"]; + 176 [label="Access variable #"]; + 177 [label="Postponed enter to lambda"]; subgraph cluster_38 { color=blue - 183 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 191 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_39 { color=blue - 184 [label="Enter block"]; - 185 [label="Access variable R|/x|"]; - 186 [label="Type operator: (R|/x| as R|I1|)"]; - 187 [label="Access variable R|/x|"]; - 188 [label="Access variable #"]; - 189 [label="Function call: R|/n|()"]; - 190 [label="Exit block"]; - } - 191 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 173 [label="Postponed exit from lambda"]; - 174 [label="Postponed enter to lambda"]; - subgraph cluster_40 { - color=blue - 192 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_41 { - color=blue - 193 [label="Enter block"]; - 194 [label="Access variable R|/x|"]; - 195 [label="Type operator: (R|/x| as R|I2|)"]; - 196 [label="Access variable R|/x|"]; - 197 [label="Access variable #"]; - 198 [label="Const: Int(123)"]; + 192 [label="Enter block"]; + 193 [label="Access variable R|/x|"]; + 194 [label="Type operator: (R|/x| as R|I1|)"]; + 195 [label="Access variable R|/x|"]; + 196 [label="Smart cast: R|/x|"]; + 197 [label="Access variable #"]; + 198 [label="Function call: R|/n|()"]; 199 [label="Exit block"]; } 200 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 172 [label="Call arguments union" style="filled" fillcolor=yellow]; - 175 [label="Postponed exit from lambda"]; - 176 [label="Function call: R|/run2|(...)"]; - 177 [label="Access variable R|/x|"]; - 178 [label="Access variable R|/I1.x|"]; - 179 [label="Access variable R|/x|"]; - 180 [label="Access variable R|/I2.y|"]; - 181 [label="Exit block"]; + 179 [label="Postponed exit from lambda"]; + 180 [label="Postponed enter to lambda"]; + subgraph cluster_40 { + color=blue + 201 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_41 { + color=blue + 202 [label="Enter block"]; + 203 [label="Access variable R|/x|"]; + 204 [label="Type operator: (R|/x| as R|I2|)"]; + 205 [label="Access variable R|/x|"]; + 206 [label="Smart cast: R|/x|"]; + 207 [label="Access variable #"]; + 208 [label="Const: Int(123)"]; + 209 [label="Exit block"]; + } + 210 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 178 [label="Call arguments union" style="filled" fillcolor=yellow]; + 181 [label="Postponed exit from lambda"]; + 182 [label="Function call: R|/run2|(...)"]; + 183 [label="Access variable R|/x|"]; + 184 [label="Smart cast: R|/x|"]; + 185 [label="Access variable R|/I1.x|"]; + 186 [label="Access variable R|/x|"]; + 187 [label="Smart cast: R|/x|"]; + 188 [label="Access variable R|/I2.y|"]; + 189 [label="Exit block"]; } - 182 [label="Exit function test4" style="filled" fillcolor=red]; + 190 [label="Exit function test4" style="filled" fillcolor=red]; } - 165 -> {166}; - 166 -> {167}; - 167 -> {168}; - 168 -> {169}; - 169 -> {170}; - 170 -> {171}; - 171 -> {183}; - 171 -> {173} [color=red]; - 171 -> {183} [style=dashed]; - 172 -> {176} [color=red]; + 171 -> {172}; + 172 -> {173}; 173 -> {174}; - 174 -> {192}; - 174 -> {175} [color=red]; - 174 -> {192} [style=dashed]; - 175 -> {176} [color=green]; + 174 -> {175}; + 175 -> {176}; 176 -> {177}; - 177 -> {178}; - 178 -> {179}; + 177 -> {191}; + 177 -> {179} [color=red]; + 177 -> {191} [style=dashed]; + 178 -> {182} [color=red]; 179 -> {180}; - 180 -> {181}; - 181 -> {182}; + 180 -> {201}; + 180 -> {181} [color=red]; + 180 -> {201} [style=dashed]; + 181 -> {182} [color=green]; + 182 -> {183}; 183 -> {184}; 184 -> {185}; 185 -> {186}; @@ -548,9 +559,7 @@ digraph flowFromTwoInplaceLambdas_kt { 187 -> {188}; 188 -> {189}; 189 -> {190}; - 190 -> {191}; - 191 -> {172} [color=red]; - 191 -> {173} [color=green]; + 191 -> {192}; 192 -> {193}; 193 -> {194}; 194 -> {195}; @@ -559,7 +568,18 @@ digraph flowFromTwoInplaceLambdas_kt { 197 -> {198}; 198 -> {199}; 199 -> {200}; - 200 -> {172} [color=red]; - 200 -> {175} [color=green]; + 200 -> {178} [color=red]; + 200 -> {179} [color=green]; + 201 -> {202}; + 202 -> {203}; + 203 -> {204}; + 204 -> {205}; + 205 -> {206}; + 206 -> {207}; + 207 -> {208}; + 208 -> {209}; + 209 -> {210}; + 210 -> {178} [color=red]; + 210 -> {181} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot index 963354d4a36..9955587b956 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot @@ -30,29 +30,31 @@ digraph jumps_kt { color=blue 11 [label="Enter block"]; 12 [label="Access variable R|/x|"]; - 13 [label="Exit block"]; + 13 [label="Smart cast: R|/x|"]; + 14 [label="Exit block"]; } - 14 [label="Exit when branch result"]; - 15 [label="Enter when branch result"]; + 15 [label="Exit when branch result"]; + 16 [label="Enter when branch result"]; subgraph cluster_6 { color=blue - 16 [label="Enter block"]; - 17 [label="Function call: R|java/lang/Exception.Exception|()"]; - 18 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 19 [label="Stub" style="filled" fillcolor=gray]; - 20 [label="Exit block" style="filled" fillcolor=gray]; + 17 [label="Enter block"]; + 18 [label="Function call: R|java/lang/Exception.Exception|()"]; + 19 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 20 [label="Stub" style="filled" fillcolor=gray]; + 21 [label="Exit block" style="filled" fillcolor=gray]; } - 21 [label="Exit when branch result" style="filled" fillcolor=gray]; - 22 [label="Exit when"]; + 22 [label="Exit when branch result" style="filled" fillcolor=gray]; + 23 [label="Exit when"]; } - 23 [label="Variable declaration: lval y: R|kotlin/Int|"]; - 24 [label="Access variable R|/y|"]; - 25 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 26 [label="Access variable R|/x|"]; - 27 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 28 [label="Exit block"]; + 24 [label="Variable declaration: lval y: R|kotlin/Int|"]; + 25 [label="Access variable R|/y|"]; + 26 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 27 [label="Access variable R|/x|"]; + 28 [label="Smart cast: R|/x|"]; + 29 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 30 [label="Exit block"]; } - 29 [label="Exit function test_1" style="filled" fillcolor=red]; + 31 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -61,95 +63,97 @@ digraph jumps_kt { 4 -> {5}; 5 -> {6}; 6 -> {7}; - 7 -> {15 8}; + 7 -> {16 8}; 8 -> {9}; 9 -> {10}; 10 -> {11}; 11 -> {12}; 12 -> {13}; 13 -> {14}; - 14 -> {22}; - 15 -> {16}; + 14 -> {15}; + 15 -> {23}; 16 -> {17}; 17 -> {18}; - 18 -> {29} [label=onUncaughtException]; - 18 -> {19} [style=dotted]; + 18 -> {19}; + 19 -> {31} [label=onUncaughtException]; 19 -> {20} [style=dotted]; 20 -> {21} [style=dotted]; 21 -> {22} [style=dotted]; - 22 -> {23}; + 22 -> {23} [style=dotted]; 23 -> {24}; 24 -> {25}; 25 -> {26}; 26 -> {27}; 27 -> {28}; 28 -> {29}; + 29 -> {30}; + 30 -> {31}; subgraph cluster_7 { color=red - 30 [label="Enter function test_2" style="filled" fillcolor=red]; + 32 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_8 { color=blue - 31 [label="Enter block"]; + 33 [label="Enter block"]; subgraph cluster_9 { color=blue - 32 [label="Enter when"]; + 34 [label="Enter when"]; subgraph cluster_10 { color=blue - 33 [label="Enter when branch condition "]; - 34 [label="Access variable R|/x|"]; - 35 [label="Const: Null(null)"]; - 36 [label="Equality operator =="]; - 37 [label="Exit when branch condition"]; + 35 [label="Enter when branch condition "]; + 36 [label="Access variable R|/x|"]; + 37 [label="Const: Null(null)"]; + 38 [label="Equality operator =="]; + 39 [label="Exit when branch condition"]; } subgraph cluster_11 { color=blue - 38 [label="Enter when branch condition else"]; - 39 [label="Exit when branch condition"]; + 40 [label="Enter when branch condition else"]; + 41 [label="Exit when branch condition"]; } - 40 [label="Enter when branch result"]; + 42 [label="Enter when branch result"]; subgraph cluster_12 { color=blue - 41 [label="Enter block"]; - 42 [label="Access variable R|/x|"]; - 43 [label="Exit block"]; + 43 [label="Enter block"]; + 44 [label="Access variable R|/x|"]; + 45 [label="Smart cast: R|/x|"]; + 46 [label="Exit block"]; } - 44 [label="Exit when branch result"]; - 45 [label="Enter when branch result"]; + 47 [label="Exit when branch result"]; + 48 [label="Enter when branch result"]; subgraph cluster_13 { color=blue - 46 [label="Enter block"]; - 47 [label="Access variable R|/x|"]; - 48 [label="Exit block"]; + 49 [label="Enter block"]; + 50 [label="Access variable R|/x|"]; + 51 [label="Smart cast: R|/x|"]; + 52 [label="Exit block"]; } - 49 [label="Exit when branch result"]; - 50 [label="Exit when"]; + 53 [label="Exit when branch result"]; + 54 [label="Exit when"]; } - 51 [label="Variable declaration: lval y: R|kotlin/Int?|"]; - 52 [label="Access variable R|/y|"]; - 53 [label="Function call: R|/y|.#()"]; - 54 [label="Exit block"]; + 55 [label="Variable declaration: lval y: R|kotlin/Int?|"]; + 56 [label="Access variable R|/y|"]; + 57 [label="Function call: R|/y|.#()"]; + 58 [label="Exit block"]; } - 55 [label="Exit function test_2" style="filled" fillcolor=red]; + 59 [label="Exit function test_2" style="filled" fillcolor=red]; } - 30 -> {31}; - 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; - 37 -> {45 38}; + 37 -> {38}; 38 -> {39}; - 39 -> {40}; + 39 -> {48 40}; 40 -> {41}; 41 -> {42}; 42 -> {43}; 43 -> {44}; - 44 -> {50}; + 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {48}; + 47 -> {54}; 48 -> {49}; 49 -> {50}; 50 -> {51}; @@ -157,256 +161,264 @@ digraph jumps_kt { 52 -> {53}; 53 -> {54}; 54 -> {55}; - - subgraph cluster_14 { - color=red - 56 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_15 { - color=blue - 57 [label="Enter block"]; - subgraph cluster_16 { - color=blue - 58 [label="Enter while loop"]; - subgraph cluster_17 { - color=blue - 59 [label="Enter loop condition"]; - 60 [label="Const: Boolean(true)"]; - 61 [label="Exit loop condition"]; - } - subgraph cluster_18 { - color=blue - 62 [label="Enter loop block"]; - subgraph cluster_19 { - color=blue - 63 [label="Enter block"]; - 64 [label="Access variable R|/x|"]; - 65 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - 66 [label="Jump: break@@@[Boolean(true)] "]; - 67 [label="Stub" style="filled" fillcolor=gray]; - 68 [label="Exit block" style="filled" fillcolor=gray]; - } - 69 [label="Exit loop block" style="filled" fillcolor=gray]; - } - 70 [label="Exit whileloop"]; - } - 71 [label="Access variable R|/x|"]; - 72 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 73 [label="Exit block"]; - } - 74 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; - 59 -> {60}; + + subgraph cluster_14 { + color=red + 60 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_15 { + color=blue + 61 [label="Enter block"]; + subgraph cluster_16 { + color=blue + 62 [label="Enter while loop"]; + subgraph cluster_17 { + color=blue + 63 [label="Enter loop condition"]; + 64 [label="Const: Boolean(true)"]; + 65 [label="Exit loop condition"]; + } + subgraph cluster_18 { + color=blue + 66 [label="Enter loop block"]; + subgraph cluster_19 { + color=blue + 67 [label="Enter block"]; + 68 [label="Access variable R|/x|"]; + 69 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + 70 [label="Jump: break@@@[Boolean(true)] "]; + 71 [label="Stub" style="filled" fillcolor=gray]; + 72 [label="Exit block" style="filled" fillcolor=gray]; + } + 73 [label="Exit loop block" style="filled" fillcolor=gray]; + } + 74 [label="Exit whileloop"]; + } + 75 [label="Access variable R|/x|"]; + 76 [label="Smart cast: R|/x|"]; + 77 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 78 [label="Exit block"]; + } + 79 [label="Exit function test_3" style="filled" fillcolor=red]; + } 60 -> {61}; 61 -> {62}; - 61 -> {70} [style=dotted]; 62 -> {63}; 63 -> {64}; 64 -> {65}; 65 -> {66}; - 66 -> {70}; - 66 -> {67} [style=dotted]; - 67 -> {68} [style=dotted]; - 68 -> {69} [style=dotted]; - 69 -> {59} [color=green style=dotted]; - 70 -> {71}; - 71 -> {72}; - 72 -> {73}; - 73 -> {74}; - - subgraph cluster_20 { - color=red - 75 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_21 { - color=blue - 76 [label="Enter block"]; - subgraph cluster_22 { - color=blue - 77 [label="Enter do-while loop"]; - subgraph cluster_23 { - color=blue - 78 [label="Enter loop block"]; - subgraph cluster_24 { - color=blue - 79 [label="Enter block"]; - 80 [label="Access variable R|/x|"]; - 81 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - 82 [label="Jump: break@@@[Boolean(true)] "]; - 83 [label="Stub" style="filled" fillcolor=gray]; - 84 [label="Exit block" style="filled" fillcolor=gray]; - } - 85 [label="Exit loop block" style="filled" fillcolor=gray]; - } - subgraph cluster_25 { - color=blue - 86 [label="Enter loop condition" style="filled" fillcolor=gray]; - 87 [label="Const: Boolean(true)" style="filled" fillcolor=gray]; - 88 [label="Exit loop condition" style="filled" fillcolor=gray]; - } - 89 [label="Exit do-whileloop"]; - } - 90 [label="Access variable R|/x|"]; - 91 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 92 [label="Exit block"]; - } - 93 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 65 -> {74} [style=dotted]; + 66 -> {67}; + 67 -> {68}; + 68 -> {69}; + 69 -> {70}; + 70 -> {74}; + 70 -> {71} [style=dotted]; + 71 -> {72} [style=dotted]; + 72 -> {73} [style=dotted]; + 73 -> {63} [color=green style=dotted]; + 74 -> {75}; 75 -> {76}; 76 -> {77}; 77 -> {78}; 78 -> {79}; - 79 -> {80}; + + subgraph cluster_20 { + color=red + 80 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 81 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 82 [label="Enter do-while loop"]; + subgraph cluster_23 { + color=blue + 83 [label="Enter loop block"]; + subgraph cluster_24 { + color=blue + 84 [label="Enter block"]; + 85 [label="Access variable R|/x|"]; + 86 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + 87 [label="Jump: break@@@[Boolean(true)] "]; + 88 [label="Stub" style="filled" fillcolor=gray]; + 89 [label="Exit block" style="filled" fillcolor=gray]; + } + 90 [label="Exit loop block" style="filled" fillcolor=gray]; + } + subgraph cluster_25 { + color=blue + 91 [label="Enter loop condition" style="filled" fillcolor=gray]; + 92 [label="Const: Boolean(true)" style="filled" fillcolor=gray]; + 93 [label="Exit loop condition" style="filled" fillcolor=gray]; + } + 94 [label="Exit do-whileloop"]; + } + 95 [label="Access variable R|/x|"]; + 96 [label="Smart cast: R|/x|"]; + 97 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 98 [label="Exit block"]; + } + 99 [label="Exit function test_4" style="filled" fillcolor=red]; + } 80 -> {81}; 81 -> {82}; - 82 -> {89}; - 82 -> {83} [style=dotted]; - 83 -> {84} [style=dotted]; - 84 -> {85} [style=dotted]; - 85 -> {86} [style=dotted]; - 86 -> {87} [style=dotted]; + 82 -> {83}; + 83 -> {84}; + 84 -> {85}; + 85 -> {86}; + 86 -> {87}; + 87 -> {94}; 87 -> {88} [style=dotted]; 88 -> {89} [style=dotted]; - 88 -> {78} [color=green style=dotted]; - 89 -> {90}; - 90 -> {91}; - 91 -> {92}; - 92 -> {93}; - - subgraph cluster_26 { - color=red - 94 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_27 { - color=blue - 95 [label="Enter block"]; - subgraph cluster_28 { - color=blue - 96 [label="Enter while loop"]; - subgraph cluster_29 { - color=blue - 97 [label="Enter loop condition"]; - 98 [label="Access variable R|/b|"]; - 99 [label="Exit loop condition"]; - } - subgraph cluster_30 { - color=blue - 100 [label="Enter loop block"]; - subgraph cluster_31 { - color=blue - 101 [label="Enter block"]; - subgraph cluster_32 { - color=blue - 102 [label="Enter when"]; - subgraph cluster_33 { - color=blue - 103 [label="Enter when branch condition "]; - 104 [label="Access variable R|/b|"]; - 105 [label="Exit when branch condition"]; - } - 106 [label="Synthetic else branch"]; - 107 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 108 [label="Enter block"]; - 109 [label="Jump: continue@@@[R|/b|] "]; - 110 [label="Stub" style="filled" fillcolor=gray]; - 111 [label="Exit block" style="filled" fillcolor=gray]; - } - 112 [label="Exit when branch result" style="filled" fillcolor=gray]; - 113 [label="Exit when"]; - } - 114 [label="Exit block"]; - } - 115 [label="Exit loop block"]; - } - 116 [label="Exit whileloop"]; - } - 117 [label="Exit block"]; - } - 118 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 89 -> {90} [style=dotted]; + 90 -> {91} [style=dotted]; + 91 -> {92} [style=dotted]; + 92 -> {93} [style=dotted]; + 93 -> {94} [style=dotted]; + 93 -> {83} [color=green style=dotted]; 94 -> {95}; 95 -> {96}; 96 -> {97}; 97 -> {98}; 98 -> {99}; - 99 -> {116 100}; + + subgraph cluster_26 { + color=red + 100 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_27 { + color=blue + 101 [label="Enter block"]; + subgraph cluster_28 { + color=blue + 102 [label="Enter while loop"]; + subgraph cluster_29 { + color=blue + 103 [label="Enter loop condition"]; + 104 [label="Access variable R|/b|"]; + 105 [label="Exit loop condition"]; + } + subgraph cluster_30 { + color=blue + 106 [label="Enter loop block"]; + subgraph cluster_31 { + color=blue + 107 [label="Enter block"]; + subgraph cluster_32 { + color=blue + 108 [label="Enter when"]; + subgraph cluster_33 { + color=blue + 109 [label="Enter when branch condition "]; + 110 [label="Access variable R|/b|"]; + 111 [label="Exit when branch condition"]; + } + 112 [label="Synthetic else branch"]; + 113 [label="Enter when branch result"]; + subgraph cluster_34 { + color=blue + 114 [label="Enter block"]; + 115 [label="Jump: continue@@@[R|/b|] "]; + 116 [label="Stub" style="filled" fillcolor=gray]; + 117 [label="Exit block" style="filled" fillcolor=gray]; + } + 118 [label="Exit when branch result" style="filled" fillcolor=gray]; + 119 [label="Exit when"]; + } + 120 [label="Exit block"]; + } + 121 [label="Exit loop block"]; + } + 122 [label="Exit whileloop"]; + } + 123 [label="Exit block"]; + } + 124 [label="Exit function test_5" style="filled" fillcolor=red]; + } 100 -> {101}; 101 -> {102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; - 105 -> {107 106}; - 106 -> {113}; + 105 -> {122 106}; + 106 -> {107}; 107 -> {108}; 108 -> {109}; - 109 -> {110} [style=dotted]; - 109 -> {96} [color=green style=dashed]; - 110 -> {111} [style=dotted]; - 111 -> {112} [style=dotted]; - 112 -> {113} [style=dotted]; + 109 -> {110}; + 110 -> {111}; + 111 -> {113 112}; + 112 -> {119}; 113 -> {114}; 114 -> {115}; - 115 -> {97} [color=green style=dashed]; - 116 -> {117}; - 117 -> {118}; + 115 -> {116} [style=dotted]; + 115 -> {102} [color=green style=dashed]; + 116 -> {117} [style=dotted]; + 117 -> {118} [style=dotted]; + 118 -> {119} [style=dotted]; + 119 -> {120}; + 120 -> {121}; + 121 -> {103} [color=green style=dashed]; + 122 -> {123}; + 123 -> {124}; subgraph cluster_35 { color=red - 119 [label="Enter function run" style="filled" fillcolor=red]; + 125 [label="Enter function run" style="filled" fillcolor=red]; subgraph cluster_36 { color=blue - 120 [label="Enter block"]; - 121 [label="Function call: R|/block|.R|SubstitutionOverride|()"]; - 122 [label="Exit block"]; + 126 [label="Enter block"]; + 127 [label="Function call: R|/block|.R|SubstitutionOverride|()"]; + 128 [label="Exit block"]; } - 123 [label="Exit function run" style="filled" fillcolor=red]; + 129 [label="Exit function run" style="filled" fillcolor=red]; } - 119 -> {120}; - 120 -> {121}; - 121 -> {122}; - 122 -> {123}; + 125 -> {126}; + 126 -> {127}; + 127 -> {128}; + 128 -> {129}; subgraph cluster_37 { color=red - 124 [label="Enter function test_6" style="filled" fillcolor=red]; + 130 [label="Enter function test_6" style="filled" fillcolor=red]; subgraph cluster_38 { color=blue - 125 [label="Enter block"]; - 126 [label="Postponed enter to lambda"]; + 131 [label="Enter block"]; + 132 [label="Postponed enter to lambda"]; subgraph cluster_39 { color=blue - 131 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 137 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_40 { color=blue - 132 [label="Enter block"]; - 133 [label="Jump: ^@run Unit"]; - 134 [label="Stub" style="filled" fillcolor=gray]; - 135 [label="Exit block" style="filled" fillcolor=gray]; + 138 [label="Enter block"]; + 139 [label="Jump: ^@run Unit"]; + 140 [label="Stub" style="filled" fillcolor=gray]; + 141 [label="Exit block" style="filled" fillcolor=gray]; } - 136 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 142 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 127 [label="Postponed exit from lambda"]; - 128 [label="Function call: R|/run|(...)"]; - 129 [label="Exit block"]; + 133 [label="Postponed exit from lambda"]; + 134 [label="Function call: R|/run|(...)"]; + 135 [label="Exit block"]; } - 130 [label="Exit function test_6" style="filled" fillcolor=red]; + 136 [label="Exit function test_6" style="filled" fillcolor=red]; } - 124 -> {125}; - 125 -> {126}; - 126 -> {127 131}; - 126 -> {131} [style=dashed]; - 127 -> {128}; - 128 -> {129}; - 129 -> {130}; - 131 -> {136 132}; - 132 -> {133}; - 133 -> {136}; - 133 -> {134} [style=dotted]; - 134 -> {135} [style=dotted]; - 135 -> {136} [style=dotted]; - 136 -> {127}; - 136 -> {131} [color=green style=dashed]; + 130 -> {131}; + 131 -> {132}; + 132 -> {133 137}; + 132 -> {137} [style=dashed]; + 133 -> {134}; + 134 -> {135}; + 135 -> {136}; + 137 -> {142 138}; + 138 -> {139}; + 139 -> {142}; + 139 -> {140} [style=dotted]; + 140 -> {141} [style=dotted]; + 141 -> {142} [style=dotted]; + 142 -> {133}; + 142 -> {137} [color=green style=dashed]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/lambdas.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/lambdas.dot index 16c595783b6..493b1321b6a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/lambdas.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/lambdas.dot @@ -48,10 +48,11 @@ digraph lambdas_kt { color=blue 24 [label="Enter block"]; 25 [label="Access variable R|/x|"]; - 26 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 27 [label="Exit block"]; + 26 [label="Smart cast: R|/x|"]; + 27 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 28 [label="Exit block"]; } - 28 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 29 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 16 [label="Postponed exit from lambda"]; 17 [label="Function call: R|/run|(...)"]; @@ -82,208 +83,211 @@ digraph lambdas_kt { 19 -> {20}; 20 -> {21}; 21 -> {22}; - 23 -> {28 24}; + 23 -> {29 24}; 24 -> {25}; 25 -> {26}; 26 -> {27}; 27 -> {28}; - 28 -> {16}; - 28 -> {23} [color=green style=dashed]; + 28 -> {29}; + 29 -> {16}; + 29 -> {23} [color=green style=dashed]; subgraph cluster_9 { color=red - 29 [label="Enter function test_2" style="filled" fillcolor=red]; + 30 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 30 [label="Enter block"]; + 31 [label="Enter block"]; subgraph cluster_11 { color=blue - 31 [label="Enter when"]; + 32 [label="Enter when"]; subgraph cluster_12 { color=blue - 32 [label="Enter when branch condition "]; - 33 [label="Access variable R|/x|"]; - 34 [label="Type operator: (R|/x| is R|kotlin/Int|)"]; - 35 [label="Exit when branch condition"]; + 33 [label="Enter when branch condition "]; + 34 [label="Access variable R|/x|"]; + 35 [label="Type operator: (R|/x| is R|kotlin/Int|)"]; + 36 [label="Exit when branch condition"]; } - 36 [label="Synthetic else branch"]; - 37 [label="Enter when branch result"]; + 37 [label="Synthetic else branch"]; + 38 [label="Enter when branch result"]; subgraph cluster_13 { color=blue - 38 [label="Enter block"]; - 39 [label="Postponed enter to lambda"]; + 39 [label="Enter block"]; + 40 [label="Postponed enter to lambda"]; subgraph cluster_14 { color=blue - 48 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 49 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_15 { color=blue - 49 [label="Enter block"]; - 50 [label="Access variable R|/x|"]; - 51 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 52 [label="Exit block"]; + 50 [label="Enter block"]; + 51 [label="Access variable R|/x|"]; + 52 [label="Smart cast: R|/x|"]; + 53 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 54 [label="Exit block"]; } - 53 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 55 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 40 [label="Postponed exit from lambda"]; - 41 [label="Exit anonymous function expression"]; - 42 [label="Variable declaration: lval lambda: R|() -> kotlin/Int|"]; - 43 [label="Exit block"]; + 41 [label="Postponed exit from lambda"]; + 42 [label="Exit anonymous function expression"]; + 43 [label="Variable declaration: lval lambda: R|() -> kotlin/Int|"]; + 44 [label="Exit block"]; } - 44 [label="Exit when branch result"]; - 45 [label="Exit when"]; + 45 [label="Exit when branch result"]; + 46 [label="Exit when"]; } - 46 [label="Exit block"]; + 47 [label="Exit block"]; } - 47 [label="Exit function test_2" style="filled" fillcolor=red]; + 48 [label="Exit function test_2" style="filled" fillcolor=red]; } - 29 -> {30}; 30 -> {31}; 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; - 35 -> {37 36}; - 36 -> {45}; - 37 -> {38}; + 35 -> {36}; + 36 -> {38 37}; + 37 -> {46}; 38 -> {39}; - 39 -> {40 48}; - 39 -> {48} [style=dashed]; - 40 -> {41}; + 39 -> {40}; + 40 -> {41 49}; + 40 -> {49} [style=dashed]; 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 48 -> {49}; + 47 -> {48}; 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; + 53 -> {54}; + 54 -> {55}; subgraph cluster_16 { color=red - 54 [label="Enter function getInt" style="filled" fillcolor=red]; + 56 [label="Enter function getInt" style="filled" fillcolor=red]; subgraph cluster_17 { color=blue - 55 [label="Enter block"]; - 56 [label="Function call: R|/block|.R|SubstitutionOverride|()"]; - 57 [label="Const: Int(1)"]; - 58 [label="Jump: ^getInt Int(1)"]; - 59 [label="Stub" style="filled" fillcolor=gray]; - 60 [label="Exit block" style="filled" fillcolor=gray]; + 57 [label="Enter block"]; + 58 [label="Function call: R|/block|.R|SubstitutionOverride|()"]; + 59 [label="Const: Int(1)"]; + 60 [label="Jump: ^getInt Int(1)"]; + 61 [label="Stub" style="filled" fillcolor=gray]; + 62 [label="Exit block" style="filled" fillcolor=gray]; } - 61 [label="Exit function getInt" style="filled" fillcolor=red]; + 63 [label="Exit function getInt" style="filled" fillcolor=red]; } - 54 -> {55}; - 55 -> {56}; 56 -> {57}; 57 -> {58}; - 58 -> {61}; - 58 -> {59} [style=dotted]; - 59 -> {60} [style=dotted]; + 58 -> {59}; + 59 -> {60}; + 60 -> {63}; 60 -> {61} [style=dotted]; + 61 -> {62} [style=dotted]; + 62 -> {63} [style=dotted]; subgraph cluster_18 { color=red - 62 [label="Enter function test_3" style="filled" fillcolor=red]; + 64 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_19 { color=blue - 63 [label="Enter block"]; - 64 [label="Postponed enter to lambda"]; + 65 [label="Enter block"]; + 66 [label="Postponed enter to lambda"]; subgraph cluster_20 { color=blue - 71 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 73 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 72 [label="Enter block"]; - 73 [label="Const: Int(1)"]; - 74 [label="Jump: ^test_3 Int(1)"]; - 75 [label="Stub" style="filled" fillcolor=gray]; - 76 [label="Exit block" style="filled" fillcolor=gray]; + 74 [label="Enter block"]; + 75 [label="Const: Int(1)"]; + 76 [label="Jump: ^test_3 Int(1)"]; + 77 [label="Stub" style="filled" fillcolor=gray]; + 78 [label="Exit block" style="filled" fillcolor=gray]; } - 77 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 79 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 65 [label="Postponed exit from lambda"]; - 66 [label="Function call: R|/getInt|(...)"]; - 67 [label="Jump: ^test_3 R|/getInt|( = getInt@fun (): R|kotlin/Unit| { + 67 [label="Postponed exit from lambda"]; + 68 [label="Function call: R|/getInt|(...)"]; + 69 [label="Jump: ^test_3 R|/getInt|( = getInt@fun (): R|kotlin/Unit| { ^test_3 Int(1) } )"]; - 68 [label="Stub" style="filled" fillcolor=gray]; - 69 [label="Exit block" style="filled" fillcolor=gray]; + 70 [label="Stub" style="filled" fillcolor=gray]; + 71 [label="Exit block" style="filled" fillcolor=gray]; } - 70 [label="Exit function test_3" style="filled" fillcolor=red]; + 72 [label="Exit function test_3" style="filled" fillcolor=red]; } - 62 -> {63}; - 63 -> {64}; - 64 -> {65 71}; - 64 -> {71} [style=dashed]; + 64 -> {65}; 65 -> {66}; - 66 -> {67}; - 67 -> {70}; - 67 -> {68} [style=dotted]; - 68 -> {69} [style=dotted]; + 66 -> {67 73}; + 66 -> {73} [style=dashed]; + 67 -> {68}; + 68 -> {69}; + 69 -> {72}; 69 -> {70} [style=dotted]; - 71 -> {77 72}; - 72 -> {73}; - 73 -> {74}; - 74 -> {70}; - 74 -> {75} [style=dotted]; - 75 -> {76} [style=dotted]; + 70 -> {71} [style=dotted]; + 71 -> {72} [style=dotted]; + 73 -> {79 74}; + 74 -> {75}; + 75 -> {76}; + 76 -> {72}; 76 -> {77} [style=dotted]; - 77 -> {65}; - 77 -> {71} [color=green style=dashed]; + 77 -> {78} [style=dotted]; + 78 -> {79} [style=dotted]; + 79 -> {67}; + 79 -> {73} [color=green style=dashed]; subgraph cluster_22 { color=red - 78 [label="Enter function test_4" style="filled" fillcolor=red]; + 80 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 79 [label="Enter block"]; - 80 [label="Postponed enter to lambda"]; + 81 [label="Enter block"]; + 82 [label="Postponed enter to lambda"]; subgraph cluster_24 { color=blue - 87 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 89 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_25 { color=blue - 88 [label="Enter block"]; - 89 [label="Const: Int(1)"]; - 90 [label="Jump: ^test_4 Int(1)"]; - 91 [label="Stub" style="filled" fillcolor=gray]; - 92 [label="Exit block" style="filled" fillcolor=gray]; + 90 [label="Enter block"]; + 91 [label="Const: Int(1)"]; + 92 [label="Jump: ^test_4 Int(1)"]; + 93 [label="Stub" style="filled" fillcolor=gray]; + 94 [label="Exit block" style="filled" fillcolor=gray]; } - 93 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 95 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 81 [label="Postponed exit from lambda"]; - 82 [label="Function call: R|/getInt|(...)"]; - 83 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun (): R|kotlin/Unit| { + 83 [label="Postponed exit from lambda"]; + 84 [label="Function call: R|/getInt|(...)"]; + 85 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun (): R|kotlin/Unit| { ^test_4 Int(1) } )"]; - 84 [label="Stub" style="filled" fillcolor=gray]; - 85 [label="Exit block" style="filled" fillcolor=gray]; + 86 [label="Stub" style="filled" fillcolor=gray]; + 87 [label="Exit block" style="filled" fillcolor=gray]; } - 86 [label="Exit function test_4" style="filled" fillcolor=red]; + 88 [label="Exit function test_4" style="filled" fillcolor=red]; } - 78 -> {79}; - 79 -> {80}; - 80 -> {81 87}; - 80 -> {87} [style=dashed]; + 80 -> {81}; 81 -> {82}; - 82 -> {83}; - 83 -> {86}; - 83 -> {84} [style=dotted]; - 84 -> {85} [style=dotted]; + 82 -> {83 89}; + 82 -> {89} [style=dashed]; + 83 -> {84}; + 84 -> {85}; + 85 -> {88}; 85 -> {86} [style=dotted]; - 87 -> {93 88}; - 88 -> {89}; - 89 -> {90}; - 90 -> {86}; - 90 -> {91} [style=dotted]; - 91 -> {92} [style=dotted]; + 86 -> {87} [style=dotted]; + 87 -> {88} [style=dotted]; + 89 -> {95 90}; + 90 -> {91}; + 91 -> {92}; + 92 -> {88}; 92 -> {93} [style=dotted]; - 93 -> {81}; - 93 -> {87} [color=green style=dashed]; + 93 -> {94} [style=dotted]; + 94 -> {95} [style=dotted]; + 95 -> {83}; + 95 -> {89} [color=green style=dashed]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot index e4348a034b8..635121b3db9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot @@ -87,17 +87,17 @@ digraph localClassesWithImplicit_kt { 19 -> {20} [style=dotted]; 20 -> {21} [style=dotted]; 21 -> {22}; - 21 -> {33 36 71 89} [color=red]; + 21 -> {33 36 73 92} [color=red]; 22 -> {23}; - 22 -> {96 99 134 152} [color=red]; - 22 -> {33 36 71 89 29} [color=green]; - 22 -> {33 36 71 89 29} [style=dashed]; + 22 -> {99 102 139 158} [color=red]; + 22 -> {33 36 73 92 29} [color=green]; + 22 -> {33 36 73 92 29} [style=dashed]; 23 -> {24} [color=red]; 23 -> {31} [color=green]; 23 -> {31} [style=dashed]; 24 -> {25}; - 24 -> {96 99 134 152} [color=green]; - 24 -> {96 99 134 152} [style=dashed]; + 24 -> {99 102 139 158} [color=green]; + 24 -> {99 102 139 158} [style=dashed]; 25 -> {26}; 26 -> {27}; 27 -> {28}; @@ -128,45 +128,47 @@ digraph localClassesWithImplicit_kt { color=blue 46 [label="Enter block"]; 47 [label="Access variable R|/a|"]; - 48 [label="Access variable R|kotlin/String.length|"]; + 48 [label="Smart cast: R|/a|"]; + 49 [label="Access variable R|kotlin/String.length|"]; subgraph cluster_14 { color=blue - 49 [label="Enter when"]; + 50 [label="Enter when"]; subgraph cluster_15 { color=blue - 50 [label="Enter when branch condition "]; - 51 [label="Access variable R|/b|"]; - 52 [label="Type operator: (R|/b| is R|kotlin/String|)"]; - 53 [label="Exit when branch condition"]; + 51 [label="Enter when branch condition "]; + 52 [label="Access variable R|/b|"]; + 53 [label="Type operator: (R|/b| is R|kotlin/String|)"]; + 54 [label="Exit when branch condition"]; } subgraph cluster_16 { color=blue - 54 [label="Enter when branch condition else"]; - 55 [label="Exit when branch condition"]; + 55 [label="Enter when branch condition else"]; + 56 [label="Exit when branch condition"]; } - 56 [label="Enter when branch result"]; + 57 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 57 [label="Enter block"]; - 58 [label="Const: Int(1)"]; - 59 [label="Exit block"]; + 58 [label="Enter block"]; + 59 [label="Const: Int(1)"]; + 60 [label="Exit block"]; } - 60 [label="Exit when branch result"]; - 61 [label="Enter when branch result"]; + 61 [label="Exit when branch result"]; + 62 [label="Enter when branch result"]; subgraph cluster_18 { color=blue - 62 [label="Enter block"]; - 63 [label="Access variable R|/b|"]; - 64 [label="Access variable R|kotlin/String.length|"]; - 65 [label="Function call: this@R|/A|.R|/bar|()"]; - 66 [label="Exit block"]; + 63 [label="Enter block"]; + 64 [label="Access variable R|/b|"]; + 65 [label="Smart cast: R|/b|"]; + 66 [label="Access variable R|kotlin/String.length|"]; + 67 [label="Function call: this@R|/A|.R|/bar|()"]; + 68 [label="Exit block"]; } - 67 [label="Exit when branch result"]; - 68 [label="Exit when"]; + 69 [label="Exit when branch result"]; + 70 [label="Exit when"]; } - 69 [label="Exit block"]; + 71 [label="Exit block"]; } - 70 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 72 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 39 [label="Postponed exit from lambda"]; 40 [label="Function call: R|/myRun|(...)"]; @@ -199,7 +201,7 @@ digraph localClassesWithImplicit_kt { 41 -> {42} [style=dotted]; 42 -> {43} [style=dotted]; 43 -> {44} [style=dotted]; - 45 -> {70 46}; + 45 -> {72 46}; 46 -> {47}; 47 -> {48}; 48 -> {49}; @@ -207,15 +209,15 @@ digraph localClassesWithImplicit_kt { 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {61 54}; - 54 -> {55}; + 53 -> {54}; + 54 -> {62 55}; 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; - 60 -> {68}; - 61 -> {62}; + 60 -> {61}; + 61 -> {70}; 62 -> {63}; 63 -> {64}; 64 -> {65}; @@ -224,152 +226,158 @@ digraph localClassesWithImplicit_kt { 67 -> {68}; 68 -> {69}; 69 -> {70}; - 70 -> {39}; - 70 -> {45} [color=green style=dashed]; + 70 -> {71}; + 71 -> {72}; + 72 -> {39}; + 72 -> {45} [color=green style=dashed]; subgraph cluster_19 { color=red - 71 [label="Enter function bar" style="filled" fillcolor=red]; + 73 [label="Enter function bar" style="filled" fillcolor=red]; subgraph cluster_20 { color=blue - 72 [label="Enter block"]; - 73 [label="Postponed enter to lambda"]; + 74 [label="Enter block"]; + 75 [label="Postponed enter to lambda"]; subgraph cluster_21 { color=blue - 80 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 82 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_22 { color=blue - 81 [label="Enter block"]; - 82 [label="Access variable R|/b|"]; - 83 [label="Access variable #"]; - 84 [label="Access variable R|/a|"]; - 85 [label="Access variable R|kotlin/String.length|"]; - 86 [label="Function call: this@R|/A|.R|/baz|()"]; - 87 [label="Exit block"]; + 83 [label="Enter block"]; + 84 [label="Access variable R|/b|"]; + 85 [label="Access variable #"]; + 86 [label="Access variable R|/a|"]; + 87 [label="Smart cast: R|/a|"]; + 88 [label="Access variable R|kotlin/String.length|"]; + 89 [label="Function call: this@R|/A|.R|/baz|()"]; + 90 [label="Exit block"]; } - 88 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 91 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 74 [label="Postponed exit from lambda"]; - 75 [label="Function call: R|/myRun|(...)"]; - 76 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { + 76 [label="Postponed exit from lambda"]; + 77 [label="Function call: R|/myRun|(...)"]; + 78 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { R|/b|.# R|/a|.R|kotlin/String.length| ^ this@R|/A|.R|/baz|() } )"]; - 77 [label="Stub" style="filled" fillcolor=gray]; - 78 [label="Exit block" style="filled" fillcolor=gray]; + 79 [label="Stub" style="filled" fillcolor=gray]; + 80 [label="Exit block" style="filled" fillcolor=gray]; } - 79 [label="Exit function bar" style="filled" fillcolor=red]; + 81 [label="Exit function bar" style="filled" fillcolor=red]; } - 71 -> {72}; - 72 -> {73}; - 73 -> {74 80}; - 73 -> {80} [style=dashed]; + 73 -> {74}; 74 -> {75}; - 75 -> {76}; - 76 -> {79}; - 76 -> {77} [style=dotted]; - 77 -> {78} [style=dotted]; + 75 -> {76 82}; + 75 -> {82} [style=dashed]; + 76 -> {77}; + 77 -> {78}; + 78 -> {81}; 78 -> {79} [style=dotted]; - 80 -> {88 81}; - 81 -> {82}; - 82 -> {83}; + 79 -> {80} [style=dotted]; + 80 -> {81} [style=dotted]; + 82 -> {91 83}; 83 -> {84}; 84 -> {85}; 85 -> {86}; 86 -> {87}; 87 -> {88}; - 88 -> {74}; - 88 -> {80} [color=green style=dashed]; + 88 -> {89}; + 89 -> {90}; + 90 -> {91}; + 91 -> {76}; + 91 -> {82} [color=green style=dashed]; subgraph cluster_23 { color=red - 89 [label="Enter function baz" style="filled" fillcolor=red]; + 92 [label="Enter function baz" style="filled" fillcolor=red]; subgraph cluster_24 { color=blue - 90 [label="Enter block"]; - 91 [label="Const: Int(1)"]; - 92 [label="Jump: ^baz Int(1)"]; - 93 [label="Stub" style="filled" fillcolor=gray]; - 94 [label="Exit block" style="filled" fillcolor=gray]; + 93 [label="Enter block"]; + 94 [label="Const: Int(1)"]; + 95 [label="Jump: ^baz Int(1)"]; + 96 [label="Stub" style="filled" fillcolor=gray]; + 97 [label="Exit block" style="filled" fillcolor=gray]; } - 95 [label="Exit function baz" style="filled" fillcolor=red]; + 98 [label="Exit function baz" style="filled" fillcolor=red]; } - 89 -> {90}; - 90 -> {91}; - 91 -> {92}; - 92 -> {95}; - 92 -> {93} [style=dotted]; - 93 -> {94} [style=dotted]; - 94 -> {95} [style=dotted]; + 92 -> {93}; + 93 -> {94}; + 94 -> {95}; + 95 -> {98}; + 95 -> {96} [style=dotted]; + 96 -> {97} [style=dotted]; + 97 -> {98} [style=dotted]; subgraph cluster_25 { color=red - 96 [label="Enter function " style="filled" fillcolor=red]; - 97 [label="Delegated constructor call: super()"]; - 98 [label="Exit function " style="filled" fillcolor=red]; + 99 [label="Enter function " style="filled" fillcolor=red]; + 100 [label="Delegated constructor call: super()"]; + 101 [label="Exit function " style="filled" fillcolor=red]; } - 96 -> {97}; - 97 -> {98}; + 99 -> {100}; + 100 -> {101}; subgraph cluster_26 { color=red - 99 [label="Enter function foo" style="filled" fillcolor=red]; + 102 [label="Enter function foo" style="filled" fillcolor=red]; subgraph cluster_27 { color=blue - 100 [label="Enter block"]; - 101 [label="Postponed enter to lambda"]; + 103 [label="Enter block"]; + 104 [label="Postponed enter to lambda"]; subgraph cluster_28 { color=blue - 108 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 111 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_29 { color=blue - 109 [label="Enter block"]; - 110 [label="Access variable R|/a|"]; - 111 [label="Access variable R|kotlin/String.length|"]; + 112 [label="Enter block"]; + 113 [label="Access variable R|/a|"]; + 114 [label="Smart cast: R|/a|"]; + 115 [label="Access variable R|kotlin/String.length|"]; subgraph cluster_30 { color=blue - 112 [label="Enter when"]; + 116 [label="Enter when"]; subgraph cluster_31 { color=blue - 113 [label="Enter when branch condition "]; - 114 [label="Access variable R|/b|"]; - 115 [label="Type operator: (R|/b| is R|kotlin/String|)"]; - 116 [label="Exit when branch condition"]; + 117 [label="Enter when branch condition "]; + 118 [label="Access variable R|/b|"]; + 119 [label="Type operator: (R|/b| is R|kotlin/String|)"]; + 120 [label="Exit when branch condition"]; } subgraph cluster_32 { color=blue - 117 [label="Enter when branch condition else"]; - 118 [label="Exit when branch condition"]; + 121 [label="Enter when branch condition else"]; + 122 [label="Exit when branch condition"]; } - 119 [label="Enter when branch result"]; + 123 [label="Enter when branch result"]; subgraph cluster_33 { color=blue - 120 [label="Enter block"]; - 121 [label="Const: Int(1)"]; - 122 [label="Exit block"]; + 124 [label="Enter block"]; + 125 [label="Const: Int(1)"]; + 126 [label="Exit block"]; } - 123 [label="Exit when branch result"]; - 124 [label="Enter when branch result"]; + 127 [label="Exit when branch result"]; + 128 [label="Enter when branch result"]; subgraph cluster_34 { color=blue - 125 [label="Enter block"]; - 126 [label="Access variable R|/b|"]; - 127 [label="Access variable R|kotlin/String.length|"]; - 128 [label="Function call: this@R|/|.R|/.bar|()"]; - 129 [label="Exit block"]; + 129 [label="Enter block"]; + 130 [label="Access variable R|/b|"]; + 131 [label="Smart cast: R|/b|"]; + 132 [label="Access variable R|kotlin/String.length|"]; + 133 [label="Function call: this@R|/|.R|/.bar|()"]; + 134 [label="Exit block"]; } - 130 [label="Exit when branch result"]; - 131 [label="Exit when"]; + 135 [label="Exit when branch result"]; + 136 [label="Exit when"]; } - 132 [label="Exit block"]; + 137 [label="Exit block"]; } - 133 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 138 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 102 [label="Postponed exit from lambda"]; - 103 [label="Function call: R|/myRun|(...)"]; - 104 [label="Jump: ^foo R|/myRun|( = myRun@fun (): R|kotlin/Int| { + 105 [label="Postponed exit from lambda"]; + 106 [label="Function call: R|/myRun|(...)"]; + 107 [label="Jump: ^foo R|/myRun|( = myRun@fun (): R|kotlin/Int| { R|/a|.R|kotlin/String.length| ^ when () { (R|/b| is R|kotlin/String|) -> { @@ -383,124 +391,128 @@ digraph localClassesWithImplicit_kt { } )"]; - 105 [label="Stub" style="filled" fillcolor=gray]; - 106 [label="Exit block" style="filled" fillcolor=gray]; + 108 [label="Stub" style="filled" fillcolor=gray]; + 109 [label="Exit block" style="filled" fillcolor=gray]; } - 107 [label="Exit function foo" style="filled" fillcolor=red]; + 110 [label="Exit function foo" style="filled" fillcolor=red]; } - 99 -> {100}; - 100 -> {101}; - 101 -> {102 108}; - 101 -> {108} [style=dashed]; 102 -> {103}; 103 -> {104}; - 104 -> {107}; - 104 -> {105} [style=dotted]; - 105 -> {106} [style=dotted]; - 106 -> {107} [style=dotted]; - 108 -> {133 109}; - 109 -> {110}; - 110 -> {111}; - 111 -> {112}; + 104 -> {105 111}; + 104 -> {111} [style=dashed]; + 105 -> {106}; + 106 -> {107}; + 107 -> {110}; + 107 -> {108} [style=dotted]; + 108 -> {109} [style=dotted]; + 109 -> {110} [style=dotted]; + 111 -> {138 112}; 112 -> {113}; 113 -> {114}; 114 -> {115}; 115 -> {116}; - 116 -> {124 117}; + 116 -> {117}; 117 -> {118}; 118 -> {119}; 119 -> {120}; - 120 -> {121}; + 120 -> {128 121}; 121 -> {122}; 122 -> {123}; - 123 -> {131}; + 123 -> {124}; 124 -> {125}; 125 -> {126}; 126 -> {127}; - 127 -> {128}; + 127 -> {136}; 128 -> {129}; 129 -> {130}; 130 -> {131}; 131 -> {132}; 132 -> {133}; - 133 -> {102}; - 133 -> {108} [color=green style=dashed]; + 133 -> {134}; + 134 -> {135}; + 135 -> {136}; + 136 -> {137}; + 137 -> {138}; + 138 -> {105}; + 138 -> {111} [color=green style=dashed]; subgraph cluster_35 { color=red - 134 [label="Enter function bar" style="filled" fillcolor=red]; + 139 [label="Enter function bar" style="filled" fillcolor=red]; subgraph cluster_36 { color=blue - 135 [label="Enter block"]; - 136 [label="Postponed enter to lambda"]; + 140 [label="Enter block"]; + 141 [label="Postponed enter to lambda"]; subgraph cluster_37 { color=blue - 143 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 148 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_38 { color=blue - 144 [label="Enter block"]; - 145 [label="Access variable R|/a|"]; - 146 [label="Access variable R|kotlin/String.length|"]; - 147 [label="Access variable R|/b|"]; - 148 [label="Access variable #"]; - 149 [label="Function call: this@R|/|.R|/.baz|()"]; - 150 [label="Exit block"]; + 149 [label="Enter block"]; + 150 [label="Access variable R|/a|"]; + 151 [label="Smart cast: R|/a|"]; + 152 [label="Access variable R|kotlin/String.length|"]; + 153 [label="Access variable R|/b|"]; + 154 [label="Access variable #"]; + 155 [label="Function call: this@R|/|.R|/.baz|()"]; + 156 [label="Exit block"]; } - 151 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 157 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 137 [label="Postponed exit from lambda"]; - 138 [label="Function call: R|/myRun|(...)"]; - 139 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { + 142 [label="Postponed exit from lambda"]; + 143 [label="Function call: R|/myRun|(...)"]; + 144 [label="Jump: ^bar R|/myRun|( = myRun@fun (): R|kotlin/Int| { R|/a|.R|kotlin/String.length| R|/b|.# ^ this@R|/|.R|/.baz|() } )"]; - 140 [label="Stub" style="filled" fillcolor=gray]; - 141 [label="Exit block" style="filled" fillcolor=gray]; + 145 [label="Stub" style="filled" fillcolor=gray]; + 146 [label="Exit block" style="filled" fillcolor=gray]; } - 142 [label="Exit function bar" style="filled" fillcolor=red]; + 147 [label="Exit function bar" style="filled" fillcolor=red]; } - 134 -> {135}; - 135 -> {136}; - 136 -> {137 143}; - 136 -> {143} [style=dashed]; - 137 -> {138}; - 138 -> {139}; - 139 -> {142}; - 139 -> {140} [style=dotted]; - 140 -> {141} [style=dotted]; - 141 -> {142} [style=dotted]; - 143 -> {151 144}; - 144 -> {145}; - 145 -> {146}; - 146 -> {147}; - 147 -> {148}; - 148 -> {149}; + 139 -> {140}; + 140 -> {141}; + 141 -> {142 148}; + 141 -> {148} [style=dashed]; + 142 -> {143}; + 143 -> {144}; + 144 -> {147}; + 144 -> {145} [style=dotted]; + 145 -> {146} [style=dotted]; + 146 -> {147} [style=dotted]; + 148 -> {157 149}; 149 -> {150}; 150 -> {151}; - 151 -> {137}; - 151 -> {143} [color=green style=dashed]; - - subgraph cluster_39 { - color=red - 152 [label="Enter function baz" style="filled" fillcolor=red]; - subgraph cluster_40 { - color=blue - 153 [label="Enter block"]; - 154 [label="Const: Int(1)"]; - 155 [label="Jump: ^baz Int(1)"]; - 156 [label="Stub" style="filled" fillcolor=gray]; - 157 [label="Exit block" style="filled" fillcolor=gray]; - } - 158 [label="Exit function baz" style="filled" fillcolor=red]; - } + 151 -> {152}; 152 -> {153}; 153 -> {154}; 154 -> {155}; - 155 -> {158}; - 155 -> {156} [style=dotted]; - 156 -> {157} [style=dotted]; - 157 -> {158} [style=dotted]; + 155 -> {156}; + 156 -> {157}; + 157 -> {142}; + 157 -> {148} [color=green style=dashed]; + + subgraph cluster_39 { + color=red + 158 [label="Enter function baz" style="filled" fillcolor=red]; + subgraph cluster_40 { + color=blue + 159 [label="Enter block"]; + 160 [label="Const: Int(1)"]; + 161 [label="Jump: ^baz Int(1)"]; + 162 [label="Stub" style="filled" fillcolor=gray]; + 163 [label="Exit block" style="filled" fillcolor=gray]; + } + 164 [label="Exit function baz" style="filled" fillcolor=red]; + } + 158 -> {159}; + 159 -> {160}; + 160 -> {161}; + 161 -> {164}; + 161 -> {162} [style=dotted]; + 162 -> {163} [style=dotted]; + 163 -> {164} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/when.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/when.dot index beca20c2139..0af26260932 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/when.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/when.dot @@ -169,26 +169,28 @@ digraph when_kt { 60 [label="Exit left part of &&"]; 61 [label="Enter right part of &&"]; 62 [label="Access variable R|/x|"]; - 63 [label="Type operator: (R|/x| is R|B|)"]; - 64 [label="Exit &&"]; + 63 [label="Smart cast: R|/x|"]; + 64 [label="Type operator: (R|/x| is R|B|)"]; + 65 [label="Exit &&"]; } - 65 [label="Exit when branch condition"]; + 66 [label="Exit when branch condition"]; } - 66 [label="Synthetic else branch"]; - 67 [label="Enter when branch result"]; + 67 [label="Synthetic else branch"]; + 68 [label="Enter when branch result"]; subgraph cluster_18 { color=blue - 68 [label="Enter block"]; - 69 [label="Access variable R|/x|"]; - 70 [label="Type operator: (R|/x| is R|A|)"]; - 71 [label="Exit block"]; + 69 [label="Enter block"]; + 70 [label="Access variable R|/x|"]; + 71 [label="Smart cast: R|/x|"]; + 72 [label="Type operator: (R|/x| is R|A|)"]; + 73 [label="Exit block"]; } - 72 [label="Exit when branch result"]; - 73 [label="Exit when"]; + 74 [label="Exit when branch result"]; + 75 [label="Exit when"]; } - 74 [label="Exit block"]; + 76 [label="Exit block"]; } - 75 [label="Exit function test_2" style="filled" fillcolor=red]; + 77 [label="Exit function test_2" style="filled" fillcolor=red]; } 53 -> {54}; 54 -> {55}; @@ -197,14 +199,14 @@ digraph when_kt { 57 -> {58}; 58 -> {59}; 59 -> {60}; - 60 -> {64 61}; + 60 -> {65 61}; 61 -> {62}; 62 -> {63}; 63 -> {64}; 64 -> {65}; - 65 -> {67 66}; - 66 -> {73}; - 67 -> {68}; + 65 -> {66}; + 66 -> {68 67}; + 67 -> {75}; 68 -> {69}; 69 -> {70}; 70 -> {71}; @@ -212,5 +214,7 @@ digraph when_kt { 72 -> {73}; 73 -> {74}; 74 -> {75}; + 75 -> {76}; + 76 -> {77}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/elvisReturnSimple.dot b/compiler/fir/analysis-tests/testData/resolve/elvisReturnSimple.dot index 8d226574f23..5a06647bf67 100644 --- a/compiler/fir/analysis-tests/testData/resolve/elvisReturnSimple.dot +++ b/compiler/fir/analysis-tests/testData/resolve/elvisReturnSimple.dot @@ -38,25 +38,26 @@ digraph elvisReturnSimple_kt { color=blue 16 [label="Enter block"]; 17 [label="Access variable R|/s|"]; - 18 [label="Access variable R|kotlin/String.length|"]; - 19 [label="Jump: ^stringReturnInLeftLen R|/s|.R|kotlin/String.length|"]; - 20 [label="Stub" style="filled" fillcolor=gray]; - 21 [label="Exit block" style="filled" fillcolor=gray]; + 18 [label="Smart cast: R|/s|"]; + 19 [label="Access variable R|kotlin/String.length|"]; + 20 [label="Jump: ^stringReturnInLeftLen R|/s|.R|kotlin/String.length|"]; + 21 [label="Stub" style="filled" fillcolor=gray]; + 22 [label="Exit block" style="filled" fillcolor=gray]; } - 22 [label="Exit when branch result" style="filled" fillcolor=gray]; - 23 [label="Exit when"]; + 23 [label="Exit when branch result" style="filled" fillcolor=gray]; + 24 [label="Exit when"]; } - 24 [label="Exit lhs of ?:"]; - 25 [label="Enter rhs of ?:"]; - 26 [label="Const: Int(0)"]; - 27 [label="Jump: ^stringReturnInLeftLen Int(0)"]; - 28 [label="Stub" style="filled" fillcolor=gray]; - 29 [label="Lhs of ?: is not null" style="filled" fillcolor=gray]; - 30 [label="Exit ?:" style="filled" fillcolor=gray]; - 31 [label="Variable declaration: lval s1: R|kotlin/Nothing|" style="filled" fillcolor=gray]; - 32 [label="Exit block" style="filled" fillcolor=gray]; + 25 [label="Exit lhs of ?:"]; + 26 [label="Enter rhs of ?:"]; + 27 [label="Const: Int(0)"]; + 28 [label="Jump: ^stringReturnInLeftLen Int(0)"]; + 29 [label="Stub" style="filled" fillcolor=gray]; + 30 [label="Lhs of ?: is not null" style="filled" fillcolor=gray]; + 31 [label="Exit ?:" style="filled" fillcolor=gray]; + 32 [label="Variable declaration: lval s1: R|kotlin/Nothing|" style="filled" fillcolor=gray]; + 33 [label="Exit block" style="filled" fillcolor=gray]; } - 33 [label="Exit function stringReturnInLeftLen" style="filled" fillcolor=red]; + 34 [label="Exit function stringReturnInLeftLen" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -72,27 +73,28 @@ digraph elvisReturnSimple_kt { 11 -> {12}; 12 -> {13}; 13 -> {14}; - 14 -> {23}; + 14 -> {24}; 15 -> {16}; 16 -> {17}; 17 -> {18}; 18 -> {19}; - 19 -> {33}; - 19 -> {20} [style=dotted]; + 19 -> {20}; + 20 -> {34}; 20 -> {21} [style=dotted]; 21 -> {22} [style=dotted]; 22 -> {23} [style=dotted]; - 23 -> {24}; + 23 -> {24} [style=dotted]; 24 -> {25}; - 24 -> {29} [style=dotted]; 25 -> {26}; + 25 -> {30} [style=dotted]; 26 -> {27}; - 27 -> {33}; - 27 -> {28} [style=dotted]; - 28 -> {30} [style=dotted]; - 29 -> {30} [style=dotted]; + 27 -> {28}; + 28 -> {34}; + 28 -> {29} [style=dotted]; + 29 -> {31} [style=dotted]; 30 -> {31} [style=dotted]; 31 -> {32} [style=dotted]; 32 -> {33} [style=dotted]; + 33 -> {34} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot index f55e732cf3b..7b8374e3fac 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot @@ -27,10 +27,11 @@ digraph bangbang_kt { 7 [label="Check not null: R|/a|!!"]; 8 [label="Function call: R|/a|!!.R|/A.foo|()"]; 9 [label="Access variable R|/a|"]; - 10 [label="Function call: R|/a|.R|/A.foo|()"]; - 11 [label="Exit block"]; + 10 [label="Smart cast: R|/a|"]; + 11 [label="Function call: R|/a|.R|/A.foo|()"]; + 12 [label="Exit block"]; } - 12 [label="Exit function test_0" style="filled" fillcolor=red]; + 13 [label="Exit function test_0" style="filled" fillcolor=red]; } 4 -> {5}; 5 -> {6}; @@ -40,52 +41,54 @@ digraph bangbang_kt { 9 -> {10}; 10 -> {11}; 11 -> {12}; + 12 -> {13}; subgraph cluster_4 { color=red - 13 [label="Enter function test_1" style="filled" fillcolor=red]; + 14 [label="Enter function test_1" style="filled" fillcolor=red]; subgraph cluster_5 { color=blue - 14 [label="Enter block"]; + 15 [label="Enter block"]; subgraph cluster_6 { color=blue - 15 [label="Enter when"]; + 16 [label="Enter when"]; subgraph cluster_7 { color=blue - 16 [label="Enter when branch condition "]; - 17 [label="Access variable R|/a|"]; - 18 [label="Check not null: R|/a|!!"]; - 19 [label="Function call: R|/a|!!.R|/A.foo|()"]; - 20 [label="Exit when branch condition"]; + 17 [label="Enter when branch condition "]; + 18 [label="Access variable R|/a|"]; + 19 [label="Check not null: R|/a|!!"]; + 20 [label="Function call: R|/a|!!.R|/A.foo|()"]; + 21 [label="Exit when branch condition"]; } - 21 [label="Synthetic else branch"]; - 22 [label="Enter when branch result"]; + 22 [label="Synthetic else branch"]; + 23 [label="Enter when branch result"]; subgraph cluster_8 { color=blue - 23 [label="Enter block"]; - 24 [label="Access variable R|/a|"]; - 25 [label="Function call: R|/a|.R|/A.foo|()"]; - 26 [label="Exit block"]; + 24 [label="Enter block"]; + 25 [label="Access variable R|/a|"]; + 26 [label="Smart cast: R|/a|"]; + 27 [label="Function call: R|/a|.R|/A.foo|()"]; + 28 [label="Exit block"]; } - 27 [label="Exit when branch result"]; - 28 [label="Exit when"]; + 29 [label="Exit when branch result"]; + 30 [label="Exit when"]; } - 29 [label="Access variable R|/a|"]; - 30 [label="Function call: R|/a|.R|/A.foo|()"]; - 31 [label="Exit block"]; + 31 [label="Access variable R|/a|"]; + 32 [label="Smart cast: R|/a|"]; + 33 [label="Function call: R|/a|.R|/A.foo|()"]; + 34 [label="Exit block"]; } - 32 [label="Exit function test_1" style="filled" fillcolor=red]; + 35 [label="Exit function test_1" style="filled" fillcolor=red]; } - 13 -> {14}; 14 -> {15}; 15 -> {16}; 16 -> {17}; 17 -> {18}; 18 -> {19}; 19 -> {20}; - 20 -> {22 21}; - 21 -> {28}; - 22 -> {23}; + 20 -> {21}; + 21 -> {23 22}; + 22 -> {30}; 23 -> {24}; 24 -> {25}; 25 -> {26}; @@ -95,67 +98,69 @@ digraph bangbang_kt { 29 -> {30}; 30 -> {31}; 31 -> {32}; + 32 -> {33}; + 33 -> {34}; + 34 -> {35}; subgraph cluster_9 { color=red - 33 [label="Enter function test_2" style="filled" fillcolor=red]; + 36 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 34 [label="Enter block"]; + 37 [label="Enter block"]; subgraph cluster_11 { color=blue - 35 [label="Enter when"]; + 38 [label="Enter when"]; subgraph cluster_12 { color=blue - 36 [label="Enter when branch condition "]; + 39 [label="Enter when branch condition "]; subgraph cluster_13 { color=blue - 37 [label="Enter &&"]; - 38 [label="Access variable R|/a|"]; - 39 [label="Check not null: R|/a|!!"]; - 40 [label="Function call: R|/a|!!.R|/A.foo|()"]; - 41 [label="Exit left part of &&"]; - 42 [label="Enter right part of &&"]; - 43 [label="Access variable R|/b|"]; - 44 [label="Exit &&"]; + 40 [label="Enter &&"]; + 41 [label="Access variable R|/a|"]; + 42 [label="Check not null: R|/a|!!"]; + 43 [label="Function call: R|/a|!!.R|/A.foo|()"]; + 44 [label="Exit left part of &&"]; + 45 [label="Enter right part of &&"]; + 46 [label="Access variable R|/b|"]; + 47 [label="Exit &&"]; } - 45 [label="Exit when branch condition"]; + 48 [label="Exit when branch condition"]; } - 46 [label="Synthetic else branch"]; - 47 [label="Enter when branch result"]; + 49 [label="Synthetic else branch"]; + 50 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 48 [label="Enter block"]; - 49 [label="Access variable R|/a|"]; - 50 [label="Function call: R|/a|.R|/A.foo|()"]; - 51 [label="Exit block"]; + 51 [label="Enter block"]; + 52 [label="Access variable R|/a|"]; + 53 [label="Smart cast: R|/a|"]; + 54 [label="Function call: R|/a|.R|/A.foo|()"]; + 55 [label="Exit block"]; } - 52 [label="Exit when branch result"]; - 53 [label="Exit when"]; + 56 [label="Exit when branch result"]; + 57 [label="Exit when"]; } - 54 [label="Access variable R|/a|"]; - 55 [label="Function call: R|/a|.R|/A.foo|()"]; - 56 [label="Exit block"]; + 58 [label="Access variable R|/a|"]; + 59 [label="Smart cast: R|/a|"]; + 60 [label="Function call: R|/a|.R|/A.foo|()"]; + 61 [label="Exit block"]; } - 57 [label="Exit function test_2" style="filled" fillcolor=red]; + 62 [label="Exit function test_2" style="filled" fillcolor=red]; } - 33 -> {34}; - 34 -> {35}; - 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; 39 -> {40}; 40 -> {41}; - 41 -> {44 42}; + 41 -> {42}; 42 -> {43}; 43 -> {44}; - 44 -> {45}; - 45 -> {47 46}; - 46 -> {53}; + 44 -> {47 45}; + 45 -> {46}; + 46 -> {47}; 47 -> {48}; - 48 -> {49}; - 49 -> {50}; + 48 -> {50 49}; + 49 -> {57}; 50 -> {51}; 51 -> {52}; 52 -> {53}; @@ -163,249 +168,260 @@ digraph bangbang_kt { 54 -> {55}; 55 -> {56}; 56 -> {57}; - - subgraph cluster_15 { - color=red - 58 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_16 { - color=blue - 59 [label="Enter block"]; - subgraph cluster_17 { - color=blue - 60 [label="Enter when"]; - subgraph cluster_18 { - color=blue - 61 [label="Enter when branch condition "]; - subgraph cluster_19 { - color=blue - 62 [label="Enter &&"]; - 63 [label="Access variable R|/b|"]; - 64 [label="Exit left part of &&"]; - 65 [label="Enter right part of &&"]; - 66 [label="Access variable R|/a|"]; - 67 [label="Check not null: R|/a|!!"]; - 68 [label="Function call: R|/a|!!.R|/A.foo|()"]; - 69 [label="Exit &&"]; - } - 70 [label="Exit when branch condition"]; - } - 71 [label="Synthetic else branch"]; - 72 [label="Enter when branch result"]; - subgraph cluster_20 { - color=blue - 73 [label="Enter block"]; - 74 [label="Access variable R|/a|"]; - 75 [label="Function call: R|/a|.R|/A.foo|()"]; - 76 [label="Exit block"]; - } - 77 [label="Exit when branch result"]; - 78 [label="Exit when"]; - } - 79 [label="Access variable R|/a|"]; - 80 [label="Function call: R|/a|.#()"]; - 81 [label="Exit block"]; - } - 82 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; 61 -> {62}; - 62 -> {63}; + + subgraph cluster_15 { + color=red + 63 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_16 { + color=blue + 64 [label="Enter block"]; + subgraph cluster_17 { + color=blue + 65 [label="Enter when"]; + subgraph cluster_18 { + color=blue + 66 [label="Enter when branch condition "]; + subgraph cluster_19 { + color=blue + 67 [label="Enter &&"]; + 68 [label="Access variable R|/b|"]; + 69 [label="Exit left part of &&"]; + 70 [label="Enter right part of &&"]; + 71 [label="Access variable R|/a|"]; + 72 [label="Check not null: R|/a|!!"]; + 73 [label="Function call: R|/a|!!.R|/A.foo|()"]; + 74 [label="Exit &&"]; + } + 75 [label="Exit when branch condition"]; + } + 76 [label="Synthetic else branch"]; + 77 [label="Enter when branch result"]; + subgraph cluster_20 { + color=blue + 78 [label="Enter block"]; + 79 [label="Access variable R|/a|"]; + 80 [label="Smart cast: R|/a|"]; + 81 [label="Function call: R|/a|.R|/A.foo|()"]; + 82 [label="Exit block"]; + } + 83 [label="Exit when branch result"]; + 84 [label="Exit when"]; + } + 85 [label="Access variable R|/a|"]; + 86 [label="Function call: R|/a|.#()"]; + 87 [label="Exit block"]; + } + 88 [label="Exit function test_3" style="filled" fillcolor=red]; + } 63 -> {64}; - 64 -> {69 65}; + 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; - 69 -> {70}; - 70 -> {72 71}; - 71 -> {78}; + 69 -> {74 70}; + 70 -> {71}; + 71 -> {72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {76}; - 76 -> {77}; + 75 -> {77 76}; + 76 -> {84}; 77 -> {78}; 78 -> {79}; 79 -> {80}; 80 -> {81}; 81 -> {82}; - - subgraph cluster_21 { - color=red - 83 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_22 { - color=blue - 84 [label="Enter block"]; - subgraph cluster_23 { - color=blue - 85 [label="Enter when"]; - subgraph cluster_24 { - color=blue - 86 [label="Enter when branch condition "]; - subgraph cluster_25 { - color=blue - 87 [label="Enter ||"]; - 88 [label="Access variable R|/a|"]; - 89 [label="Check not null: R|/a|!!"]; - 90 [label="Function call: R|/a|!!.R|/A.foo|()"]; - 91 [label="Exit left part of ||"]; - 92 [label="Enter right part of ||"]; - 93 [label="Access variable R|/b|"]; - 94 [label="Exit ||"]; - } - 95 [label="Exit when branch condition"]; - } - 96 [label="Synthetic else branch"]; - 97 [label="Enter when branch result"]; - subgraph cluster_26 { - color=blue - 98 [label="Enter block"]; - 99 [label="Access variable R|/a|"]; - 100 [label="Function call: R|/a|.R|/A.foo|()"]; - 101 [label="Exit block"]; - } - 102 [label="Exit when branch result"]; - 103 [label="Exit when"]; - } - 104 [label="Access variable R|/a|"]; - 105 [label="Function call: R|/a|.R|/A.foo|()"]; - 106 [label="Exit block"]; - } - 107 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 82 -> {83}; 83 -> {84}; 84 -> {85}; 85 -> {86}; 86 -> {87}; 87 -> {88}; - 88 -> {89}; + + subgraph cluster_21 { + color=red + 89 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_22 { + color=blue + 90 [label="Enter block"]; + subgraph cluster_23 { + color=blue + 91 [label="Enter when"]; + subgraph cluster_24 { + color=blue + 92 [label="Enter when branch condition "]; + subgraph cluster_25 { + color=blue + 93 [label="Enter ||"]; + 94 [label="Access variable R|/a|"]; + 95 [label="Check not null: R|/a|!!"]; + 96 [label="Function call: R|/a|!!.R|/A.foo|()"]; + 97 [label="Exit left part of ||"]; + 98 [label="Enter right part of ||"]; + 99 [label="Access variable R|/b|"]; + 100 [label="Exit ||"]; + } + 101 [label="Exit when branch condition"]; + } + 102 [label="Synthetic else branch"]; + 103 [label="Enter when branch result"]; + subgraph cluster_26 { + color=blue + 104 [label="Enter block"]; + 105 [label="Access variable R|/a|"]; + 106 [label="Smart cast: R|/a|"]; + 107 [label="Function call: R|/a|.R|/A.foo|()"]; + 108 [label="Exit block"]; + } + 109 [label="Exit when branch result"]; + 110 [label="Exit when"]; + } + 111 [label="Access variable R|/a|"]; + 112 [label="Smart cast: R|/a|"]; + 113 [label="Function call: R|/a|.R|/A.foo|()"]; + 114 [label="Exit block"]; + } + 115 [label="Exit function test_4" style="filled" fillcolor=red]; + } 89 -> {90}; 90 -> {91}; - 91 -> {94 92}; + 91 -> {92}; 92 -> {93}; 93 -> {94}; 94 -> {95}; - 95 -> {97 96}; - 96 -> {103}; - 97 -> {98}; + 95 -> {96}; + 96 -> {97}; + 97 -> {100 98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; - 101 -> {102}; - 102 -> {103}; + 101 -> {103 102}; + 102 -> {110}; 103 -> {104}; 104 -> {105}; 105 -> {106}; 106 -> {107}; - - subgraph cluster_27 { - color=red - 108 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_28 { - color=blue - 109 [label="Enter block"]; - subgraph cluster_29 { - color=blue - 110 [label="Enter when"]; - subgraph cluster_30 { - color=blue - 111 [label="Enter when branch condition "]; - subgraph cluster_31 { - color=blue - 112 [label="Enter ||"]; - 113 [label="Access variable R|/b|"]; - 114 [label="Exit left part of ||"]; - 115 [label="Enter right part of ||"]; - 116 [label="Access variable R|/a|"]; - 117 [label="Check not null: R|/a|!!"]; - 118 [label="Function call: R|/a|!!.R|/A.foo|()"]; - 119 [label="Exit ||"]; - } - 120 [label="Exit when branch condition"]; - } - 121 [label="Synthetic else branch"]; - 122 [label="Enter when branch result"]; - subgraph cluster_32 { - color=blue - 123 [label="Enter block"]; - 124 [label="Access variable R|/a|"]; - 125 [label="Function call: R|/a|.#()"]; - 126 [label="Exit block"]; - } - 127 [label="Exit when branch result"]; - 128 [label="Exit when"]; - } - 129 [label="Access variable R|/a|"]; - 130 [label="Function call: R|/a|.#()"]; - 131 [label="Exit block"]; - } - 132 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 107 -> {108}; 108 -> {109}; 109 -> {110}; 110 -> {111}; 111 -> {112}; 112 -> {113}; 113 -> {114}; - 114 -> {119 115}; - 115 -> {116}; + 114 -> {115}; + + subgraph cluster_27 { + color=red + 116 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_28 { + color=blue + 117 [label="Enter block"]; + subgraph cluster_29 { + color=blue + 118 [label="Enter when"]; + subgraph cluster_30 { + color=blue + 119 [label="Enter when branch condition "]; + subgraph cluster_31 { + color=blue + 120 [label="Enter ||"]; + 121 [label="Access variable R|/b|"]; + 122 [label="Exit left part of ||"]; + 123 [label="Enter right part of ||"]; + 124 [label="Access variable R|/a|"]; + 125 [label="Check not null: R|/a|!!"]; + 126 [label="Function call: R|/a|!!.R|/A.foo|()"]; + 127 [label="Exit ||"]; + } + 128 [label="Exit when branch condition"]; + } + 129 [label="Synthetic else branch"]; + 130 [label="Enter when branch result"]; + subgraph cluster_32 { + color=blue + 131 [label="Enter block"]; + 132 [label="Access variable R|/a|"]; + 133 [label="Function call: R|/a|.#()"]; + 134 [label="Exit block"]; + } + 135 [label="Exit when branch result"]; + 136 [label="Exit when"]; + } + 137 [label="Access variable R|/a|"]; + 138 [label="Function call: R|/a|.#()"]; + 139 [label="Exit block"]; + } + 140 [label="Exit function test_5" style="filled" fillcolor=red]; + } 116 -> {117}; 117 -> {118}; 118 -> {119}; 119 -> {120}; - 120 -> {122 121}; - 121 -> {128}; - 122 -> {123}; + 120 -> {121}; + 121 -> {122}; + 122 -> {127 123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; 126 -> {127}; 127 -> {128}; - 128 -> {129}; - 129 -> {130}; + 128 -> {130 129}; + 129 -> {136}; 130 -> {131}; 131 -> {132}; - - subgraph cluster_33 { - color=red - 133 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_34 { - color=blue - 134 [label="Enter block"]; - 135 [label="Access variable R|/x|"]; - 136 [label="Check not null: R|/x|!!"]; - 137 [label="Function call: R|/x|!!.R|/A.foo|()"]; - 138 [label="Exit block"]; - } - 139 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 132 -> {133}; 133 -> {134}; 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; 138 -> {139}; + 139 -> {140}; - subgraph cluster_35 { + subgraph cluster_33 { color=red - 140 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_36 { + 141 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_34 { color=blue - 141 [label="Enter block"]; - 142 [label="Access variable R|/x|"]; - 143 [label="Check not null: R|/x|!!"]; - 144 [label="Function call: R|/x|!!.R|/A.foo|()"]; - 145 [label="Exit block"]; + 142 [label="Enter block"]; + 143 [label="Access variable R|/x|"]; + 144 [label="Check not null: R|/x|!!"]; + 145 [label="Function call: R|/x|!!.R|/A.foo|()"]; + 146 [label="Exit block"]; } - 146 [label="Exit function test_7" style="filled" fillcolor=red]; + 147 [label="Exit function test_6" style="filled" fillcolor=red]; } - 140 -> {141}; 141 -> {142}; 142 -> {143}; 143 -> {144}; 144 -> {145}; 145 -> {146}; + 146 -> {147}; + + subgraph cluster_35 { + color=red + 148 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_36 { + color=blue + 149 [label="Enter block"]; + 150 [label="Access variable R|/x|"]; + 151 [label="Check not null: R|/x|!!"]; + 152 [label="Function call: R|/x|!!.R|/A.foo|()"]; + 153 [label="Exit block"]; + } + 154 [label="Exit function test_7" style="filled" fillcolor=red]; + } + 148 -> {149}; + 149 -> {150}; + 150 -> {151}; + 151 -> {152}; + 152 -> {153}; + 153 -> {154}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.dot index 93dc3d36030..58d7fec75cf 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.dot @@ -72,30 +72,34 @@ digraph booleanOperators_kt { 21 [label="Exit left part of &&"]; 22 [label="Enter right part of &&"]; 23 [label="Access variable R|/x|"]; - 24 [label="Type operator: (R|/x| is R|C|)"]; - 25 [label="Exit &&"]; + 24 [label="Smart cast: R|/x|"]; + 25 [label="Type operator: (R|/x| is R|C|)"]; + 26 [label="Exit &&"]; } - 26 [label="Exit when branch condition"]; + 27 [label="Exit when branch condition"]; } - 27 [label="Synthetic else branch"]; - 28 [label="Enter when branch result"]; + 28 [label="Synthetic else branch"]; + 29 [label="Enter when branch result"]; subgraph cluster_12 { color=blue - 29 [label="Enter block"]; - 30 [label="Access variable R|/x|"]; - 31 [label="Function call: R|/x|.R|/A.foo|()"]; - 32 [label="Access variable R|/x|"]; - 33 [label="Function call: R|/x|.R|/B.bar|()"]; + 30 [label="Enter block"]; + 31 [label="Access variable R|/x|"]; + 32 [label="Smart cast: R|/x|"]; + 33 [label="Function call: R|/x|.R|/A.foo|()"]; 34 [label="Access variable R|/x|"]; - 35 [label="Function call: R|/x|.R|/C.baz|()"]; - 36 [label="Exit block"]; + 35 [label="Smart cast: R|/x|"]; + 36 [label="Function call: R|/x|.R|/B.bar|()"]; + 37 [label="Access variable R|/x|"]; + 38 [label="Smart cast: R|/x|"]; + 39 [label="Function call: R|/x|.R|/C.baz|()"]; + 40 [label="Exit block"]; } - 37 [label="Exit when branch result"]; - 38 [label="Exit when"]; + 41 [label="Exit when branch result"]; + 42 [label="Exit when"]; } - 39 [label="Exit block"]; + 43 [label="Exit block"]; } - 40 [label="Exit function test_1" style="filled" fillcolor=red]; + 44 [label="Exit function test_1" style="filled" fillcolor=red]; } 14 -> {15}; 15 -> {16}; @@ -104,14 +108,14 @@ digraph booleanOperators_kt { 18 -> {19}; 19 -> {20}; 20 -> {21}; - 21 -> {25 22}; + 21 -> {26 22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {28 27}; - 27 -> {38}; - 28 -> {29}; + 26 -> {27}; + 27 -> {29 28}; + 28 -> {42}; 29 -> {30}; 30 -> {31}; 31 -> {32}; @@ -123,70 +127,73 @@ digraph booleanOperators_kt { 37 -> {38}; 38 -> {39}; 39 -> {40}; - - subgraph cluster_13 { - color=red - 41 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_14 { - color=blue - 42 [label="Enter block"]; - subgraph cluster_15 { - color=blue - 43 [label="Enter when"]; - subgraph cluster_16 { - color=blue - 44 [label="Enter when branch condition "]; - subgraph cluster_17 { - color=blue - 45 [label="Enter ||"]; - 46 [label="Access variable R|/x|"]; - 47 [label="Type operator: (R|/x| is R|B|)"]; - 48 [label="Exit left part of ||"]; - 49 [label="Enter right part of ||"]; - 50 [label="Access variable R|/x|"]; - 51 [label="Type operator: (R|/x| is R|C|)"]; - 52 [label="Exit ||"]; - } - 53 [label="Exit when branch condition"]; - } - 54 [label="Synthetic else branch"]; - 55 [label="Enter when branch result"]; - subgraph cluster_18 { - color=blue - 56 [label="Enter block"]; - 57 [label="Access variable R|/x|"]; - 58 [label="Function call: R|/x|.R|/A.foo|()"]; - 59 [label="Access variable R|/x|"]; - 60 [label="Function call: R|/x|.#()"]; - 61 [label="Access variable R|/x|"]; - 62 [label="Function call: R|/x|.#()"]; - 63 [label="Exit block"]; - } - 64 [label="Exit when branch result"]; - 65 [label="Exit when"]; - } - 66 [label="Exit block"]; - } - 67 [label="Exit function test_2" style="filled" fillcolor=red]; - } + 40 -> {41}; 41 -> {42}; 42 -> {43}; 43 -> {44}; - 44 -> {45}; + + subgraph cluster_13 { + color=red + 45 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 46 [label="Enter block"]; + subgraph cluster_15 { + color=blue + 47 [label="Enter when"]; + subgraph cluster_16 { + color=blue + 48 [label="Enter when branch condition "]; + subgraph cluster_17 { + color=blue + 49 [label="Enter ||"]; + 50 [label="Access variable R|/x|"]; + 51 [label="Type operator: (R|/x| is R|B|)"]; + 52 [label="Exit left part of ||"]; + 53 [label="Enter right part of ||"]; + 54 [label="Access variable R|/x|"]; + 55 [label="Type operator: (R|/x| is R|C|)"]; + 56 [label="Exit ||"]; + } + 57 [label="Exit when branch condition"]; + } + 58 [label="Synthetic else branch"]; + 59 [label="Enter when branch result"]; + subgraph cluster_18 { + color=blue + 60 [label="Enter block"]; + 61 [label="Access variable R|/x|"]; + 62 [label="Smart cast: R|/x|"]; + 63 [label="Function call: R|/x|.R|/A.foo|()"]; + 64 [label="Access variable R|/x|"]; + 65 [label="Smart cast: R|/x|"]; + 66 [label="Function call: R|/x|.#()"]; + 67 [label="Access variable R|/x|"]; + 68 [label="Smart cast: R|/x|"]; + 69 [label="Function call: R|/x|.#()"]; + 70 [label="Exit block"]; + } + 71 [label="Exit when branch result"]; + 72 [label="Exit when"]; + } + 73 [label="Exit block"]; + } + 74 [label="Exit function test_2" style="filled" fillcolor=red]; + } 45 -> {46}; 46 -> {47}; 47 -> {48}; - 48 -> {52 49}; + 48 -> {49}; 49 -> {50}; 50 -> {51}; 51 -> {52}; - 52 -> {53}; - 53 -> {55 54}; - 54 -> {65}; + 52 -> {56 53}; + 53 -> {54}; + 54 -> {55}; 55 -> {56}; 56 -> {57}; - 57 -> {58}; - 58 -> {59}; + 57 -> {59 58}; + 58 -> {72}; 59 -> {60}; 60 -> {61}; 61 -> {62}; @@ -195,103 +202,59 @@ digraph booleanOperators_kt { 64 -> {65}; 65 -> {66}; 66 -> {67}; - - subgraph cluster_19 { - color=red - 68 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_20 { - color=blue - 69 [label="Enter block"]; - subgraph cluster_21 { - color=blue - 70 [label="Enter when"]; - subgraph cluster_22 { - color=blue - 71 [label="Enter when branch condition "]; - 72 [label="Access variable R|/x|"]; - 73 [label="Type operator: (R|/x| !is R|A|)"]; - 74 [label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; - 75 [label="Exit when branch condition"]; - } - 76 [label="Synthetic else branch"]; - 77 [label="Enter when branch result"]; - subgraph cluster_23 { - color=blue - 78 [label="Enter block"]; - 79 [label="Access variable R|/x|"]; - 80 [label="Function call: R|/x|.R|/A.foo|()"]; - 81 [label="Exit block"]; - } - 82 [label="Exit when branch result"]; - 83 [label="Exit when"]; - } - 84 [label="Exit block"]; - } - 85 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 67 -> {68}; 68 -> {69}; 69 -> {70}; 70 -> {71}; 71 -> {72}; 72 -> {73}; 73 -> {74}; - 74 -> {75}; - 75 -> {77 76}; - 76 -> {83}; + + subgraph cluster_19 { + color=red + 75 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_20 { + color=blue + 76 [label="Enter block"]; + subgraph cluster_21 { + color=blue + 77 [label="Enter when"]; + subgraph cluster_22 { + color=blue + 78 [label="Enter when branch condition "]; + 79 [label="Access variable R|/x|"]; + 80 [label="Type operator: (R|/x| !is R|A|)"]; + 81 [label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; + 82 [label="Exit when branch condition"]; + } + 83 [label="Synthetic else branch"]; + 84 [label="Enter when branch result"]; + subgraph cluster_23 { + color=blue + 85 [label="Enter block"]; + 86 [label="Access variable R|/x|"]; + 87 [label="Smart cast: R|/x|"]; + 88 [label="Function call: R|/x|.R|/A.foo|()"]; + 89 [label="Exit block"]; + } + 90 [label="Exit when branch result"]; + 91 [label="Exit when"]; + } + 92 [label="Exit block"]; + } + 93 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 75 -> {76}; + 76 -> {77}; 77 -> {78}; 78 -> {79}; 79 -> {80}; 80 -> {81}; 81 -> {82}; - 82 -> {83}; - 83 -> {84}; + 82 -> {84 83}; + 83 -> {91}; 84 -> {85}; - - subgraph cluster_24 { - color=red - 86 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_25 { - color=blue - 87 [label="Enter block"]; - subgraph cluster_26 { - color=blue - 88 [label="Enter when"]; - subgraph cluster_27 { - color=blue - 89 [label="Enter when branch condition "]; - subgraph cluster_28 { - color=blue - 90 [label="Enter ||"]; - 91 [label="Access variable R|/x|"]; - 92 [label="Type operator: (R|/x| !is R|kotlin/String|)"]; - 93 [label="Exit left part of ||"]; - 94 [label="Enter right part of ||"]; - 95 [label="Access variable R|/x|"]; - 96 [label="Access variable R|kotlin/String.length|"]; - 97 [label="Const: Int(0)"]; - 98 [label="Equality operator =="]; - 99 [label="Exit ||"]; - } - 100 [label="Exit when branch condition"]; - } - 101 [label="Synthetic else branch"]; - 102 [label="Enter when branch result"]; - subgraph cluster_29 { - color=blue - 103 [label="Enter block"]; - 104 [label="Access variable R|/x|"]; - 105 [label="Access variable #"]; - 106 [label="Exit block"]; - } - 107 [label="Exit when branch result"]; - 108 [label="Exit when"]; - } - 109 [label="Access variable R|/x|"]; - 110 [label="Access variable #"]; - 111 [label="Exit block"]; - } - 112 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 85 -> {86}; 86 -> {87}; 87 -> {88}; 88 -> {89}; @@ -299,15 +262,61 @@ digraph booleanOperators_kt { 90 -> {91}; 91 -> {92}; 92 -> {93}; - 93 -> {99 94}; + + subgraph cluster_24 { + color=red + 94 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_25 { + color=blue + 95 [label="Enter block"]; + subgraph cluster_26 { + color=blue + 96 [label="Enter when"]; + subgraph cluster_27 { + color=blue + 97 [label="Enter when branch condition "]; + subgraph cluster_28 { + color=blue + 98 [label="Enter ||"]; + 99 [label="Access variable R|/x|"]; + 100 [label="Type operator: (R|/x| !is R|kotlin/String|)"]; + 101 [label="Exit left part of ||"]; + 102 [label="Enter right part of ||"]; + 103 [label="Access variable R|/x|"]; + 104 [label="Smart cast: R|/x|"]; + 105 [label="Access variable R|kotlin/String.length|"]; + 106 [label="Const: Int(0)"]; + 107 [label="Equality operator =="]; + 108 [label="Exit ||"]; + } + 109 [label="Exit when branch condition"]; + } + 110 [label="Synthetic else branch"]; + 111 [label="Enter when branch result"]; + subgraph cluster_29 { + color=blue + 112 [label="Enter block"]; + 113 [label="Access variable R|/x|"]; + 114 [label="Access variable #"]; + 115 [label="Exit block"]; + } + 116 [label="Exit when branch result"]; + 117 [label="Exit when"]; + } + 118 [label="Access variable R|/x|"]; + 119 [label="Access variable #"]; + 120 [label="Exit block"]; + } + 121 [label="Exit function test_4" style="filled" fillcolor=red]; + } 94 -> {95}; 95 -> {96}; 96 -> {97}; 97 -> {98}; 98 -> {99}; 99 -> {100}; - 100 -> {102 101}; - 101 -> {108}; + 100 -> {101}; + 101 -> {108 102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; @@ -315,51 +324,10 @@ digraph booleanOperators_kt { 106 -> {107}; 107 -> {108}; 108 -> {109}; - 109 -> {110}; - 110 -> {111}; + 109 -> {111 110}; + 110 -> {117}; 111 -> {112}; - - subgraph cluster_30 { - color=red - 113 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_31 { - color=blue - 114 [label="Enter block"]; - subgraph cluster_32 { - color=blue - 115 [label="Enter when"]; - subgraph cluster_33 { - color=blue - 116 [label="Enter when branch condition "]; - subgraph cluster_34 { - color=blue - 117 [label="Enter &&"]; - 118 [label="Access variable R|/x|"]; - 119 [label="Type operator: (R|/x| is R|A|)"]; - 120 [label="Exit left part of &&"]; - 121 [label="Enter right part of &&"]; - 122 [label="Access variable R|/x|"]; - 123 [label="Function call: R|/x|.R|/A.bool|()"]; - 124 [label="Exit &&"]; - } - 125 [label="Exit when branch condition"]; - } - 126 [label="Synthetic else branch"]; - 127 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 128 [label="Enter block"]; - 129 [label="Access variable R|/x|"]; - 130 [label="Function call: R|/x|.R|/A.foo|()"]; - 131 [label="Exit block"]; - } - 132 [label="Exit when branch result"]; - 133 [label="Exit when"]; - } - 134 [label="Exit block"]; - } - 135 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 112 -> {113}; 113 -> {114}; 114 -> {115}; 115 -> {116}; @@ -367,502 +335,547 @@ digraph booleanOperators_kt { 117 -> {118}; 118 -> {119}; 119 -> {120}; - 120 -> {124 121}; - 121 -> {122}; + 120 -> {121}; + + subgraph cluster_30 { + color=red + 122 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_31 { + color=blue + 123 [label="Enter block"]; + subgraph cluster_32 { + color=blue + 124 [label="Enter when"]; + subgraph cluster_33 { + color=blue + 125 [label="Enter when branch condition "]; + subgraph cluster_34 { + color=blue + 126 [label="Enter &&"]; + 127 [label="Access variable R|/x|"]; + 128 [label="Type operator: (R|/x| is R|A|)"]; + 129 [label="Exit left part of &&"]; + 130 [label="Enter right part of &&"]; + 131 [label="Access variable R|/x|"]; + 132 [label="Smart cast: R|/x|"]; + 133 [label="Function call: R|/x|.R|/A.bool|()"]; + 134 [label="Exit &&"]; + } + 135 [label="Exit when branch condition"]; + } + 136 [label="Synthetic else branch"]; + 137 [label="Enter when branch result"]; + subgraph cluster_35 { + color=blue + 138 [label="Enter block"]; + 139 [label="Access variable R|/x|"]; + 140 [label="Smart cast: R|/x|"]; + 141 [label="Function call: R|/x|.R|/A.foo|()"]; + 142 [label="Exit block"]; + } + 143 [label="Exit when branch result"]; + 144 [label="Exit when"]; + } + 145 [label="Exit block"]; + } + 146 [label="Exit function test_5" style="filled" fillcolor=red]; + } 122 -> {123}; 123 -> {124}; 124 -> {125}; - 125 -> {127 126}; - 126 -> {133}; + 125 -> {126}; + 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {130}; + 129 -> {134 130}; 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; 134 -> {135}; - - subgraph cluster_36 { - color=red - 136 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_37 { - color=blue - 137 [label="Enter block"]; - subgraph cluster_38 { - color=blue - 138 [label="Enter when"]; - subgraph cluster_39 { - color=blue - 139 [label="Enter when branch condition "]; - 140 [label="Access variable R|/x|"]; - 141 [label="Type operator: (R|/x| !is R|A|)"]; - 142 [label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; - 143 [label="Exit when branch condition"]; - } - 144 [label="Synthetic else branch"]; - 145 [label="Enter when branch result"]; - subgraph cluster_40 { - color=blue - 146 [label="Enter block"]; - 147 [label="Access variable R|/x|"]; - 148 [label="Function call: R|/x|.R|/A.foo|()"]; - 149 [label="Exit block"]; - } - 150 [label="Exit when branch result"]; - 151 [label="Exit when"]; - } - 152 [label="Exit block"]; - } - 153 [label="Exit function test_6" style="filled" fillcolor=red]; - } - 136 -> {137}; + 135 -> {137 136}; + 136 -> {144}; 137 -> {138}; 138 -> {139}; 139 -> {140}; 140 -> {141}; 141 -> {142}; 142 -> {143}; - 143 -> {145 144}; - 144 -> {151}; + 143 -> {144}; + 144 -> {145}; 145 -> {146}; - 146 -> {147}; + + subgraph cluster_36 { + color=red + 147 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_37 { + color=blue + 148 [label="Enter block"]; + subgraph cluster_38 { + color=blue + 149 [label="Enter when"]; + subgraph cluster_39 { + color=blue + 150 [label="Enter when branch condition "]; + 151 [label="Access variable R|/x|"]; + 152 [label="Type operator: (R|/x| !is R|A|)"]; + 153 [label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; + 154 [label="Exit when branch condition"]; + } + 155 [label="Synthetic else branch"]; + 156 [label="Enter when branch result"]; + subgraph cluster_40 { + color=blue + 157 [label="Enter block"]; + 158 [label="Access variable R|/x|"]; + 159 [label="Smart cast: R|/x|"]; + 160 [label="Function call: R|/x|.R|/A.foo|()"]; + 161 [label="Exit block"]; + } + 162 [label="Exit when branch result"]; + 163 [label="Exit when"]; + } + 164 [label="Exit block"]; + } + 165 [label="Exit function test_6" style="filled" fillcolor=red]; + } 147 -> {148}; 148 -> {149}; 149 -> {150}; 150 -> {151}; 151 -> {152}; 152 -> {153}; - - subgraph cluster_41 { - color=red - 154 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_42 { - color=blue - 155 [label="Enter block"]; - subgraph cluster_43 { - color=blue - 156 [label="Enter when"]; - subgraph cluster_44 { - color=blue - 157 [label="Enter when branch condition "]; - subgraph cluster_45 { - color=blue - 158 [label="Enter ||"]; - 159 [label="Access variable R|/x|"]; - 160 [label="Type operator: (R|/x| is R|A|)"]; - 161 [label="Exit left part of ||"]; - 162 [label="Enter right part of ||"]; - 163 [label="Const: Boolean(false)"]; - 164 [label="Exit ||"]; - } - 165 [label="Exit when branch condition"]; - } - 166 [label="Synthetic else branch"]; - 167 [label="Enter when branch result"]; - subgraph cluster_46 { - color=blue - 168 [label="Enter block"]; - 169 [label="Access variable R|/x|"]; - 170 [label="Function call: R|/x|.#()"]; - 171 [label="Exit block"]; - } - 172 [label="Exit when branch result"]; - 173 [label="Exit when"]; - } - 174 [label="Exit block"]; - } - 175 [label="Exit function test_7" style="filled" fillcolor=red]; - } - 154 -> {155}; - 155 -> {156}; + 153 -> {154}; + 154 -> {156 155}; + 155 -> {163}; 156 -> {157}; 157 -> {158}; 158 -> {159}; 159 -> {160}; 160 -> {161}; - 161 -> {164 162}; + 161 -> {162}; 162 -> {163}; 163 -> {164}; 164 -> {165}; - 165 -> {167 166}; - 166 -> {173}; + + subgraph cluster_41 { + color=red + 166 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_42 { + color=blue + 167 [label="Enter block"]; + subgraph cluster_43 { + color=blue + 168 [label="Enter when"]; + subgraph cluster_44 { + color=blue + 169 [label="Enter when branch condition "]; + subgraph cluster_45 { + color=blue + 170 [label="Enter ||"]; + 171 [label="Access variable R|/x|"]; + 172 [label="Type operator: (R|/x| is R|A|)"]; + 173 [label="Exit left part of ||"]; + 174 [label="Enter right part of ||"]; + 175 [label="Const: Boolean(false)"]; + 176 [label="Exit ||"]; + } + 177 [label="Exit when branch condition"]; + } + 178 [label="Synthetic else branch"]; + 179 [label="Enter when branch result"]; + subgraph cluster_46 { + color=blue + 180 [label="Enter block"]; + 181 [label="Access variable R|/x|"]; + 182 [label="Function call: R|/x|.#()"]; + 183 [label="Exit block"]; + } + 184 [label="Exit when branch result"]; + 185 [label="Exit when"]; + } + 186 [label="Exit block"]; + } + 187 [label="Exit function test_7" style="filled" fillcolor=red]; + } + 166 -> {167}; 167 -> {168}; 168 -> {169}; 169 -> {170}; 170 -> {171}; 171 -> {172}; 172 -> {173}; - 173 -> {174}; + 173 -> {176 174}; 174 -> {175}; - - subgraph cluster_47 { - color=red - 176 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_48 { - color=blue - 177 [label="Enter block"]; - subgraph cluster_49 { - color=blue - 178 [label="Enter when"]; - subgraph cluster_50 { - color=blue - 179 [label="Enter when branch condition "]; - subgraph cluster_51 { - color=blue - 180 [label="Enter ||"]; - 181 [label="Const: Boolean(false)"]; - 182 [label="Exit left part of ||"]; - 183 [label="Enter right part of ||"]; - 184 [label="Access variable R|/x|"]; - 185 [label="Type operator: (R|/x| is R|A|)"]; - 186 [label="Exit ||"]; - } - 187 [label="Exit when branch condition"]; - } - 188 [label="Synthetic else branch"]; - 189 [label="Enter when branch result"]; - subgraph cluster_52 { - color=blue - 190 [label="Enter block"]; - 191 [label="Access variable R|/x|"]; - 192 [label="Function call: R|/x|.#()"]; - 193 [label="Exit block"]; - } - 194 [label="Exit when branch result"]; - 195 [label="Exit when"]; - } - 196 [label="Exit block"]; - } - 197 [label="Exit function test_8" style="filled" fillcolor=red]; - } + 175 -> {176}; 176 -> {177}; - 177 -> {178}; - 178 -> {179}; + 177 -> {179 178}; + 178 -> {185}; 179 -> {180}; 180 -> {181}; 181 -> {182}; 182 -> {183}; - 182 -> {186} [style=dotted]; 183 -> {184}; 184 -> {185}; 185 -> {186}; 186 -> {187}; - 187 -> {189 188}; - 188 -> {195}; + + subgraph cluster_47 { + color=red + 188 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_48 { + color=blue + 189 [label="Enter block"]; + subgraph cluster_49 { + color=blue + 190 [label="Enter when"]; + subgraph cluster_50 { + color=blue + 191 [label="Enter when branch condition "]; + subgraph cluster_51 { + color=blue + 192 [label="Enter ||"]; + 193 [label="Const: Boolean(false)"]; + 194 [label="Exit left part of ||"]; + 195 [label="Enter right part of ||"]; + 196 [label="Access variable R|/x|"]; + 197 [label="Type operator: (R|/x| is R|A|)"]; + 198 [label="Exit ||"]; + } + 199 [label="Exit when branch condition"]; + } + 200 [label="Synthetic else branch"]; + 201 [label="Enter when branch result"]; + subgraph cluster_52 { + color=blue + 202 [label="Enter block"]; + 203 [label="Access variable R|/x|"]; + 204 [label="Function call: R|/x|.#()"]; + 205 [label="Exit block"]; + } + 206 [label="Exit when branch result"]; + 207 [label="Exit when"]; + } + 208 [label="Exit block"]; + } + 209 [label="Exit function test_8" style="filled" fillcolor=red]; + } + 188 -> {189}; 189 -> {190}; 190 -> {191}; 191 -> {192}; 192 -> {193}; 193 -> {194}; 194 -> {195}; + 194 -> {198} [style=dotted]; 195 -> {196}; 196 -> {197}; - - subgraph cluster_53 { - color=red - 198 [label="Enter function test_9" style="filled" fillcolor=red]; - subgraph cluster_54 { - color=blue - 199 [label="Enter block"]; - subgraph cluster_55 { - color=blue - 200 [label="Enter when"]; - subgraph cluster_56 { - color=blue - 201 [label="Enter when branch condition "]; - subgraph cluster_57 { - color=blue - 202 [label="Enter ||"]; - 203 [label="Access variable R|/x|"]; - 204 [label="Type operator: (R|/x| is R|A|)"]; - 205 [label="Exit left part of ||"]; - 206 [label="Enter right part of ||"]; - 207 [label="Const: Boolean(true)"]; - 208 [label="Exit ||"]; - } - 209 [label="Exit when branch condition"]; - } - 210 [label="Synthetic else branch"]; - 211 [label="Enter when branch result"]; - subgraph cluster_58 { - color=blue - 212 [label="Enter block"]; - 213 [label="Access variable R|/x|"]; - 214 [label="Function call: R|/x|.#()"]; - 215 [label="Exit block"]; - } - 216 [label="Exit when branch result"]; - 217 [label="Exit when"]; - } - 218 [label="Exit block"]; - } - 219 [label="Exit function test_9" style="filled" fillcolor=red]; - } + 197 -> {198}; 198 -> {199}; - 199 -> {200}; - 200 -> {201}; + 199 -> {201 200}; + 200 -> {207}; 201 -> {202}; 202 -> {203}; 203 -> {204}; 204 -> {205}; - 205 -> {208 206}; + 205 -> {206}; 206 -> {207}; 207 -> {208}; 208 -> {209}; - 209 -> {211 210}; - 210 -> {217}; + + subgraph cluster_53 { + color=red + 210 [label="Enter function test_9" style="filled" fillcolor=red]; + subgraph cluster_54 { + color=blue + 211 [label="Enter block"]; + subgraph cluster_55 { + color=blue + 212 [label="Enter when"]; + subgraph cluster_56 { + color=blue + 213 [label="Enter when branch condition "]; + subgraph cluster_57 { + color=blue + 214 [label="Enter ||"]; + 215 [label="Access variable R|/x|"]; + 216 [label="Type operator: (R|/x| is R|A|)"]; + 217 [label="Exit left part of ||"]; + 218 [label="Enter right part of ||"]; + 219 [label="Const: Boolean(true)"]; + 220 [label="Exit ||"]; + } + 221 [label="Exit when branch condition"]; + } + 222 [label="Synthetic else branch"]; + 223 [label="Enter when branch result"]; + subgraph cluster_58 { + color=blue + 224 [label="Enter block"]; + 225 [label="Access variable R|/x|"]; + 226 [label="Function call: R|/x|.#()"]; + 227 [label="Exit block"]; + } + 228 [label="Exit when branch result"]; + 229 [label="Exit when"]; + } + 230 [label="Exit block"]; + } + 231 [label="Exit function test_9" style="filled" fillcolor=red]; + } + 210 -> {211}; 211 -> {212}; 212 -> {213}; 213 -> {214}; 214 -> {215}; 215 -> {216}; 216 -> {217}; - 217 -> {218}; + 217 -> {220 218}; 218 -> {219}; - - subgraph cluster_59 { - color=red - 220 [label="Enter function test_10" style="filled" fillcolor=red]; - subgraph cluster_60 { - color=blue - 221 [label="Enter block"]; - subgraph cluster_61 { - color=blue - 222 [label="Enter when"]; - subgraph cluster_62 { - color=blue - 223 [label="Enter when branch condition "]; - subgraph cluster_63 { - color=blue - 224 [label="Enter ||"]; - 225 [label="Const: Boolean(true)"]; - 226 [label="Exit left part of ||"]; - 227 [label="Enter right part of ||" style="filled" fillcolor=gray]; - 228 [label="Access variable R|/x|" style="filled" fillcolor=gray]; - 229 [label="Type operator: (R|/x| is R|A|)" style="filled" fillcolor=gray]; - 230 [label="Exit ||"]; - } - 231 [label="Exit when branch condition"]; - } - 232 [label="Synthetic else branch"]; - 233 [label="Enter when branch result"]; - subgraph cluster_64 { - color=blue - 234 [label="Enter block"]; - 235 [label="Access variable R|/x|"]; - 236 [label="Function call: R|/x|.#()"]; - 237 [label="Exit block"]; - } - 238 [label="Exit when branch result"]; - 239 [label="Exit when"]; - } - 240 [label="Exit block"]; - } - 241 [label="Exit function test_10" style="filled" fillcolor=red]; - } + 219 -> {220}; 220 -> {221}; - 221 -> {222}; - 222 -> {223}; + 221 -> {223 222}; + 222 -> {229}; 223 -> {224}; 224 -> {225}; 225 -> {226}; - 226 -> {230}; - 226 -> {227} [style=dotted]; - 227 -> {228} [style=dotted]; - 228 -> {229} [style=dotted]; - 229 -> {230} [style=dotted]; + 226 -> {227}; + 227 -> {228}; + 228 -> {229}; + 229 -> {230}; 230 -> {231}; - 231 -> {233 232}; - 232 -> {239}; + + subgraph cluster_59 { + color=red + 232 [label="Enter function test_10" style="filled" fillcolor=red]; + subgraph cluster_60 { + color=blue + 233 [label="Enter block"]; + subgraph cluster_61 { + color=blue + 234 [label="Enter when"]; + subgraph cluster_62 { + color=blue + 235 [label="Enter when branch condition "]; + subgraph cluster_63 { + color=blue + 236 [label="Enter ||"]; + 237 [label="Const: Boolean(true)"]; + 238 [label="Exit left part of ||"]; + 239 [label="Enter right part of ||" style="filled" fillcolor=gray]; + 240 [label="Access variable R|/x|" style="filled" fillcolor=gray]; + 241 [label="Type operator: (R|/x| is R|A|)" style="filled" fillcolor=gray]; + 242 [label="Exit ||"]; + } + 243 [label="Exit when branch condition"]; + } + 244 [label="Synthetic else branch"]; + 245 [label="Enter when branch result"]; + subgraph cluster_64 { + color=blue + 246 [label="Enter block"]; + 247 [label="Access variable R|/x|"]; + 248 [label="Function call: R|/x|.#()"]; + 249 [label="Exit block"]; + } + 250 [label="Exit when branch result"]; + 251 [label="Exit when"]; + } + 252 [label="Exit block"]; + } + 253 [label="Exit function test_10" style="filled" fillcolor=red]; + } + 232 -> {233}; 233 -> {234}; 234 -> {235}; 235 -> {236}; 236 -> {237}; 237 -> {238}; - 238 -> {239}; - 239 -> {240}; - 240 -> {241}; - - subgraph cluster_65 { - color=red - 242 [label="Enter function test_11" style="filled" fillcolor=red]; - subgraph cluster_66 { - color=blue - 243 [label="Enter block"]; - subgraph cluster_67 { - color=blue - 244 [label="Enter when"]; - subgraph cluster_68 { - color=blue - 245 [label="Enter when branch condition "]; - subgraph cluster_69 { - color=blue - 246 [label="Enter &&"]; - 247 [label="Const: Boolean(false)"]; - 248 [label="Exit left part of &&"]; - 249 [label="Enter right part of &&" style="filled" fillcolor=gray]; - 250 [label="Access variable R|/x|" style="filled" fillcolor=gray]; - 251 [label="Type operator: (R|/x| is R|A|)" style="filled" fillcolor=gray]; - 252 [label="Exit &&"]; - } - 253 [label="Exit when branch condition"]; - } - 254 [label="Synthetic else branch"]; - 255 [label="Enter when branch result"]; - subgraph cluster_70 { - color=blue - 256 [label="Enter block"]; - 257 [label="Access variable R|/x|"]; - 258 [label="Function call: R|/x|.#()"]; - 259 [label="Exit block"]; - } - 260 [label="Exit when branch result"]; - 261 [label="Exit when"]; - } - 262 [label="Exit block"]; - } - 263 [label="Exit function test_11" style="filled" fillcolor=red]; - } + 238 -> {242}; + 238 -> {239} [style=dotted]; + 239 -> {240} [style=dotted]; + 240 -> {241} [style=dotted]; + 241 -> {242} [style=dotted]; 242 -> {243}; - 243 -> {244}; - 244 -> {245}; + 243 -> {245 244}; + 244 -> {251}; 245 -> {246}; 246 -> {247}; 247 -> {248}; - 248 -> {252}; - 248 -> {249} [style=dotted]; - 249 -> {250} [style=dotted]; - 250 -> {251} [style=dotted]; - 251 -> {252} [style=dotted]; + 248 -> {249}; + 249 -> {250}; + 250 -> {251}; + 251 -> {252}; 252 -> {253}; - 253 -> {255 254}; - 254 -> {261}; + + subgraph cluster_65 { + color=red + 254 [label="Enter function test_11" style="filled" fillcolor=red]; + subgraph cluster_66 { + color=blue + 255 [label="Enter block"]; + subgraph cluster_67 { + color=blue + 256 [label="Enter when"]; + subgraph cluster_68 { + color=blue + 257 [label="Enter when branch condition "]; + subgraph cluster_69 { + color=blue + 258 [label="Enter &&"]; + 259 [label="Const: Boolean(false)"]; + 260 [label="Exit left part of &&"]; + 261 [label="Enter right part of &&" style="filled" fillcolor=gray]; + 262 [label="Access variable R|/x|" style="filled" fillcolor=gray]; + 263 [label="Type operator: (R|/x| is R|A|)" style="filled" fillcolor=gray]; + 264 [label="Exit &&"]; + } + 265 [label="Exit when branch condition"]; + } + 266 [label="Synthetic else branch"]; + 267 [label="Enter when branch result"]; + subgraph cluster_70 { + color=blue + 268 [label="Enter block"]; + 269 [label="Access variable R|/x|"]; + 270 [label="Function call: R|/x|.#()"]; + 271 [label="Exit block"]; + } + 272 [label="Exit when branch result"]; + 273 [label="Exit when"]; + } + 274 [label="Exit block"]; + } + 275 [label="Exit function test_11" style="filled" fillcolor=red]; + } + 254 -> {255}; 255 -> {256}; 256 -> {257}; 257 -> {258}; 258 -> {259}; 259 -> {260}; - 260 -> {261}; - 261 -> {262}; - 262 -> {263}; - - subgraph cluster_71 { - color=red - 264 [label="Enter function test_12" style="filled" fillcolor=red]; - subgraph cluster_72 { - color=blue - 265 [label="Enter block"]; - subgraph cluster_73 { - color=blue - 266 [label="Enter when"]; - subgraph cluster_74 { - color=blue - 267 [label="Enter when branch condition "]; - subgraph cluster_75 { - color=blue - 268 [label="Enter &&"]; - 269 [label="Access variable R|/x|"]; - 270 [label="Type operator: (R|/x| is R|A|)"]; - 271 [label="Exit left part of &&"]; - 272 [label="Enter right part of &&"]; - 273 [label="Const: Boolean(false)"]; - 274 [label="Exit &&"]; - } - 275 [label="Exit when branch condition"]; - } - 276 [label="Synthetic else branch"]; - 277 [label="Enter when branch result"]; - subgraph cluster_76 { - color=blue - 278 [label="Enter block"]; - 279 [label="Access variable R|/x|"]; - 280 [label="Function call: R|/x|.R|/A.foo|()"]; - 281 [label="Exit block"]; - } - 282 [label="Exit when branch result"]; - 283 [label="Exit when"]; - } - 284 [label="Exit block"]; - } - 285 [label="Exit function test_12" style="filled" fillcolor=red]; - } + 260 -> {264}; + 260 -> {261} [style=dotted]; + 261 -> {262} [style=dotted]; + 262 -> {263} [style=dotted]; + 263 -> {264} [style=dotted]; 264 -> {265}; - 265 -> {266}; - 266 -> {267}; + 265 -> {267 266}; + 266 -> {273}; 267 -> {268}; 268 -> {269}; 269 -> {270}; 270 -> {271}; - 271 -> {274 272}; + 271 -> {272}; 272 -> {273}; 273 -> {274}; 274 -> {275}; - 275 -> {277 276}; - 276 -> {283}; + + subgraph cluster_71 { + color=red + 276 [label="Enter function test_12" style="filled" fillcolor=red]; + subgraph cluster_72 { + color=blue + 277 [label="Enter block"]; + subgraph cluster_73 { + color=blue + 278 [label="Enter when"]; + subgraph cluster_74 { + color=blue + 279 [label="Enter when branch condition "]; + subgraph cluster_75 { + color=blue + 280 [label="Enter &&"]; + 281 [label="Access variable R|/x|"]; + 282 [label="Type operator: (R|/x| is R|A|)"]; + 283 [label="Exit left part of &&"]; + 284 [label="Enter right part of &&"]; + 285 [label="Const: Boolean(false)"]; + 286 [label="Exit &&"]; + } + 287 [label="Exit when branch condition"]; + } + 288 [label="Synthetic else branch"]; + 289 [label="Enter when branch result"]; + subgraph cluster_76 { + color=blue + 290 [label="Enter block"]; + 291 [label="Access variable R|/x|"]; + 292 [label="Smart cast: R|/x|"]; + 293 [label="Function call: R|/x|.R|/A.foo|()"]; + 294 [label="Exit block"]; + } + 295 [label="Exit when branch result"]; + 296 [label="Exit when"]; + } + 297 [label="Exit block"]; + } + 298 [label="Exit function test_12" style="filled" fillcolor=red]; + } + 276 -> {277}; 277 -> {278}; 278 -> {279}; 279 -> {280}; 280 -> {281}; 281 -> {282}; 282 -> {283}; - 283 -> {284}; + 283 -> {286 284}; 284 -> {285}; - - subgraph cluster_77 { - color=red - 286 [label="Enter function test_13" style="filled" fillcolor=red]; - subgraph cluster_78 { - color=blue - 287 [label="Enter block"]; - subgraph cluster_79 { - color=blue - 288 [label="Enter when"]; - subgraph cluster_80 { - color=blue - 289 [label="Enter when branch condition "]; - subgraph cluster_81 { - color=blue - 290 [label="Enter &&"]; - 291 [label="Const: Boolean(true)"]; - 292 [label="Exit left part of &&"]; - 293 [label="Enter right part of &&"]; - 294 [label="Access variable R|/x|"]; - 295 [label="Type operator: (R|/x| is R|A|)"]; - 296 [label="Exit &&"]; - } - 297 [label="Exit when branch condition"]; - } - 298 [label="Synthetic else branch"]; - 299 [label="Enter when branch result"]; - subgraph cluster_82 { - color=blue - 300 [label="Enter block"]; - 301 [label="Access variable R|/x|"]; - 302 [label="Function call: R|/x|.R|/A.foo|()"]; - 303 [label="Exit block"]; - } - 304 [label="Exit when branch result"]; - 305 [label="Exit when"]; - } - 306 [label="Exit block"]; - } - 307 [label="Exit function test_13" style="filled" fillcolor=red]; - } + 285 -> {286}; 286 -> {287}; - 287 -> {288}; - 288 -> {289}; + 287 -> {289 288}; + 288 -> {296}; 289 -> {290}; 290 -> {291}; 291 -> {292}; 292 -> {293}; - 292 -> {296} [style=dotted]; 293 -> {294}; 294 -> {295}; 295 -> {296}; 296 -> {297}; - 297 -> {299 298}; - 298 -> {305}; + 297 -> {298}; + + subgraph cluster_77 { + color=red + 299 [label="Enter function test_13" style="filled" fillcolor=red]; + subgraph cluster_78 { + color=blue + 300 [label="Enter block"]; + subgraph cluster_79 { + color=blue + 301 [label="Enter when"]; + subgraph cluster_80 { + color=blue + 302 [label="Enter when branch condition "]; + subgraph cluster_81 { + color=blue + 303 [label="Enter &&"]; + 304 [label="Const: Boolean(true)"]; + 305 [label="Exit left part of &&"]; + 306 [label="Enter right part of &&"]; + 307 [label="Access variable R|/x|"]; + 308 [label="Type operator: (R|/x| is R|A|)"]; + 309 [label="Exit &&"]; + } + 310 [label="Exit when branch condition"]; + } + 311 [label="Synthetic else branch"]; + 312 [label="Enter when branch result"]; + subgraph cluster_82 { + color=blue + 313 [label="Enter block"]; + 314 [label="Access variable R|/x|"]; + 315 [label="Smart cast: R|/x|"]; + 316 [label="Function call: R|/x|.R|/A.foo|()"]; + 317 [label="Exit block"]; + } + 318 [label="Exit when branch result"]; + 319 [label="Exit when"]; + } + 320 [label="Exit block"]; + } + 321 [label="Exit function test_13" style="filled" fillcolor=red]; + } 299 -> {300}; 300 -> {301}; 301 -> {302}; @@ -870,62 +883,64 @@ digraph booleanOperators_kt { 303 -> {304}; 304 -> {305}; 305 -> {306}; + 305 -> {309} [style=dotted]; 306 -> {307}; - - subgraph cluster_83 { - color=red - 308 [label="Enter function test_14" style="filled" fillcolor=red]; - subgraph cluster_84 { - color=blue - 309 [label="Enter block"]; - subgraph cluster_85 { - color=blue - 310 [label="Enter when"]; - subgraph cluster_86 { - color=blue - 311 [label="Enter when branch condition "]; - subgraph cluster_87 { - color=blue - 312 [label="Enter &&"]; - 313 [label="Access variable R|/x|"]; - 314 [label="Type operator: (R|/x| is R|A|)"]; - 315 [label="Exit left part of &&"]; - 316 [label="Enter right part of &&"]; - 317 [label="Const: Boolean(false)"]; - 318 [label="Exit &&"]; - } - 319 [label="Exit when branch condition"]; - } - 320 [label="Synthetic else branch"]; - 321 [label="Enter when branch result"]; - subgraph cluster_88 { - color=blue - 322 [label="Enter block"]; - 323 [label="Access variable R|/x|"]; - 324 [label="Function call: R|/x|.R|/A.foo|()"]; - 325 [label="Exit block"]; - } - 326 [label="Exit when branch result"]; - 327 [label="Exit when"]; - } - 328 [label="Exit block"]; - } - 329 [label="Exit function test_14" style="filled" fillcolor=red]; - } + 307 -> {308}; 308 -> {309}; 309 -> {310}; - 310 -> {311}; - 311 -> {312}; + 310 -> {312 311}; + 311 -> {319}; 312 -> {313}; 313 -> {314}; 314 -> {315}; - 315 -> {318 316}; + 315 -> {316}; 316 -> {317}; 317 -> {318}; 318 -> {319}; - 319 -> {321 320}; - 320 -> {327}; - 321 -> {322}; + 319 -> {320}; + 320 -> {321}; + + subgraph cluster_83 { + color=red + 322 [label="Enter function test_14" style="filled" fillcolor=red]; + subgraph cluster_84 { + color=blue + 323 [label="Enter block"]; + subgraph cluster_85 { + color=blue + 324 [label="Enter when"]; + subgraph cluster_86 { + color=blue + 325 [label="Enter when branch condition "]; + subgraph cluster_87 { + color=blue + 326 [label="Enter &&"]; + 327 [label="Access variable R|/x|"]; + 328 [label="Type operator: (R|/x| is R|A|)"]; + 329 [label="Exit left part of &&"]; + 330 [label="Enter right part of &&"]; + 331 [label="Const: Boolean(false)"]; + 332 [label="Exit &&"]; + } + 333 [label="Exit when branch condition"]; + } + 334 [label="Synthetic else branch"]; + 335 [label="Enter when branch result"]; + subgraph cluster_88 { + color=blue + 336 [label="Enter block"]; + 337 [label="Access variable R|/x|"]; + 338 [label="Smart cast: R|/x|"]; + 339 [label="Function call: R|/x|.R|/A.foo|()"]; + 340 [label="Exit block"]; + } + 341 [label="Exit when branch result"]; + 342 [label="Exit when"]; + } + 343 [label="Exit block"]; + } + 344 [label="Exit function test_14" style="filled" fillcolor=red]; + } 322 -> {323}; 323 -> {324}; 324 -> {325}; @@ -933,5 +948,20 @@ digraph booleanOperators_kt { 326 -> {327}; 327 -> {328}; 328 -> {329}; + 329 -> {332 330}; + 330 -> {331}; + 331 -> {332}; + 332 -> {333}; + 333 -> {335 334}; + 334 -> {342}; + 335 -> {336}; + 336 -> {337}; + 337 -> {338}; + 338 -> {339}; + 339 -> {340}; + 340 -> {341}; + 341 -> {342}; + 342 -> {343}; + 343 -> {344}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot index dfa78c46e0a..8aa9afaf4d1 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot @@ -55,15 +55,16 @@ digraph equalsToBoolean_kt { color=blue 23 [label="Enter block"]; 24 [label="Access variable R|/b|"]; - 25 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 26 [label="Exit block"]; + 25 [label="Smart cast: R|/b|"]; + 26 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 27 [label="Exit block"]; } - 27 [label="Exit when branch result"]; - 28 [label="Exit when"]; + 28 [label="Exit when branch result"]; + 29 [label="Exit when"]; } - 29 [label="Exit block"]; + 30 [label="Exit block"]; } - 30 [label="Exit function test_1" style="filled" fillcolor=red]; + 31 [label="Exit function test_1" style="filled" fillcolor=red]; } 4 -> {5}; 5 -> {6}; @@ -82,7 +83,7 @@ digraph equalsToBoolean_kt { 18 -> {19}; 19 -> {20}; 20 -> {21}; - 21 -> {28}; + 21 -> {29}; 22 -> {23}; 23 -> {24}; 24 -> {25}; @@ -91,56 +92,57 @@ digraph equalsToBoolean_kt { 27 -> {28}; 28 -> {29}; 29 -> {30}; + 30 -> {31}; subgraph cluster_9 { color=red - 31 [label="Enter function test_2" style="filled" fillcolor=red]; + 32 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 32 [label="Enter block"]; + 33 [label="Enter block"]; subgraph cluster_11 { color=blue - 33 [label="Enter when"]; + 34 [label="Enter when"]; subgraph cluster_12 { color=blue - 34 [label="Enter when branch condition "]; - 35 [label="Access variable R|/b|"]; - 36 [label="Const: Boolean(true)"]; - 37 [label="Equality operator =="]; - 38 [label="Const: Boolean(true)"]; - 39 [label="Equality operator !="]; - 40 [label="Exit when branch condition"]; + 35 [label="Enter when branch condition "]; + 36 [label="Access variable R|/b|"]; + 37 [label="Const: Boolean(true)"]; + 38 [label="Equality operator =="]; + 39 [label="Const: Boolean(true)"]; + 40 [label="Equality operator !="]; + 41 [label="Exit when branch condition"]; } subgraph cluster_13 { color=blue - 41 [label="Enter when branch condition else"]; - 42 [label="Exit when branch condition"]; + 42 [label="Enter when branch condition else"]; + 43 [label="Exit when branch condition"]; } - 43 [label="Enter when branch result"]; + 44 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 44 [label="Enter block"]; - 45 [label="Access variable R|/b|"]; - 46 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 47 [label="Exit block"]; + 45 [label="Enter block"]; + 46 [label="Access variable R|/b|"]; + 47 [label="Smart cast: R|/b|"]; + 48 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 49 [label="Exit block"]; } - 48 [label="Exit when branch result"]; - 49 [label="Enter when branch result"]; + 50 [label="Exit when branch result"]; + 51 [label="Enter when branch result"]; subgraph cluster_15 { color=blue - 50 [label="Enter block"]; - 51 [label="Access variable R|/b|"]; - 52 [label="Function call: R|/b|.#()"]; - 53 [label="Exit block"]; + 52 [label="Enter block"]; + 53 [label="Access variable R|/b|"]; + 54 [label="Function call: R|/b|.#()"]; + 55 [label="Exit block"]; } - 54 [label="Exit when branch result"]; - 55 [label="Exit when"]; + 56 [label="Exit when branch result"]; + 57 [label="Exit when"]; } - 56 [label="Exit block"]; + 58 [label="Exit block"]; } - 57 [label="Exit function test_2" style="filled" fillcolor=red]; + 59 [label="Exit function test_2" style="filled" fillcolor=red]; } - 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; @@ -149,74 +151,75 @@ digraph equalsToBoolean_kt { 37 -> {38}; 38 -> {39}; 39 -> {40}; - 40 -> {49 41}; - 41 -> {42}; + 40 -> {41}; + 41 -> {51 42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; 47 -> {48}; - 48 -> {55}; + 48 -> {49}; 49 -> {50}; - 50 -> {51}; + 50 -> {57}; 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; + 57 -> {58}; + 58 -> {59}; subgraph cluster_16 { color=red - 58 [label="Enter function test_3" style="filled" fillcolor=red]; + 60 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_17 { color=blue - 59 [label="Enter block"]; + 61 [label="Enter block"]; subgraph cluster_18 { color=blue - 60 [label="Enter when"]; + 62 [label="Enter when"]; subgraph cluster_19 { color=blue - 61 [label="Enter when branch condition "]; - 62 [label="Access variable R|/b|"]; - 63 [label="Const: Boolean(true)"]; - 64 [label="Equality operator =="]; - 65 [label="Const: Boolean(false)"]; + 63 [label="Enter when branch condition "]; + 64 [label="Access variable R|/b|"]; + 65 [label="Const: Boolean(true)"]; 66 [label="Equality operator =="]; - 67 [label="Exit when branch condition"]; + 67 [label="Const: Boolean(false)"]; + 68 [label="Equality operator =="]; + 69 [label="Exit when branch condition"]; } subgraph cluster_20 { color=blue - 68 [label="Enter when branch condition else"]; - 69 [label="Exit when branch condition"]; + 70 [label="Enter when branch condition else"]; + 71 [label="Exit when branch condition"]; } - 70 [label="Enter when branch result"]; + 72 [label="Enter when branch result"]; subgraph cluster_21 { color=blue - 71 [label="Enter block"]; - 72 [label="Access variable R|/b|"]; - 73 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 74 [label="Exit block"]; + 73 [label="Enter block"]; + 74 [label="Access variable R|/b|"]; + 75 [label="Smart cast: R|/b|"]; + 76 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 77 [label="Exit block"]; } - 75 [label="Exit when branch result"]; - 76 [label="Enter when branch result"]; + 78 [label="Exit when branch result"]; + 79 [label="Enter when branch result"]; subgraph cluster_22 { color=blue - 77 [label="Enter block"]; - 78 [label="Access variable R|/b|"]; - 79 [label="Function call: R|/b|.#()"]; - 80 [label="Exit block"]; + 80 [label="Enter block"]; + 81 [label="Access variable R|/b|"]; + 82 [label="Function call: R|/b|.#()"]; + 83 [label="Exit block"]; } - 81 [label="Exit when branch result"]; - 82 [label="Exit when"]; + 84 [label="Exit when branch result"]; + 85 [label="Exit when"]; } - 83 [label="Exit block"]; + 86 [label="Exit block"]; } - 84 [label="Exit function test_3" style="filled" fillcolor=red]; + 87 [label="Exit function test_3" style="filled" fillcolor=red]; } - 58 -> {59}; - 59 -> {60}; 60 -> {61}; 61 -> {62}; 62 -> {63}; @@ -224,390 +227,395 @@ digraph equalsToBoolean_kt { 64 -> {65}; 65 -> {66}; 66 -> {67}; - 67 -> {76 68}; + 67 -> {68}; 68 -> {69}; - 69 -> {70}; + 69 -> {79 70}; 70 -> {71}; 71 -> {72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {82}; + 75 -> {76}; 76 -> {77}; 77 -> {78}; - 78 -> {79}; + 78 -> {85}; 79 -> {80}; 80 -> {81}; 81 -> {82}; 82 -> {83}; 83 -> {84}; + 84 -> {85}; + 85 -> {86}; + 86 -> {87}; subgraph cluster_23 { color=red - 85 [label="Enter function test_4" style="filled" fillcolor=red]; + 88 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_24 { color=blue - 86 [label="Enter block"]; + 89 [label="Enter block"]; subgraph cluster_25 { color=blue - 87 [label="Enter when"]; + 90 [label="Enter when"]; subgraph cluster_26 { color=blue - 88 [label="Enter when branch condition "]; - 89 [label="Access variable R|/b|"]; - 90 [label="Const: Boolean(true)"]; - 91 [label="Equality operator =="]; - 92 [label="Const: Boolean(false)"]; - 93 [label="Equality operator !="]; - 94 [label="Exit when branch condition"]; + 91 [label="Enter when branch condition "]; + 92 [label="Access variable R|/b|"]; + 93 [label="Const: Boolean(true)"]; + 94 [label="Equality operator =="]; + 95 [label="Const: Boolean(false)"]; + 96 [label="Equality operator !="]; + 97 [label="Exit when branch condition"]; } subgraph cluster_27 { color=blue - 95 [label="Enter when branch condition else"]; - 96 [label="Exit when branch condition"]; + 98 [label="Enter when branch condition else"]; + 99 [label="Exit when branch condition"]; } - 97 [label="Enter when branch result"]; + 100 [label="Enter when branch result"]; subgraph cluster_28 { color=blue - 98 [label="Enter block"]; - 99 [label="Access variable R|/b|"]; - 100 [label="Function call: R|/b|.#()"]; - 101 [label="Exit block"]; + 101 [label="Enter block"]; + 102 [label="Access variable R|/b|"]; + 103 [label="Function call: R|/b|.#()"]; + 104 [label="Exit block"]; } - 102 [label="Exit when branch result"]; - 103 [label="Enter when branch result"]; + 105 [label="Exit when branch result"]; + 106 [label="Enter when branch result"]; subgraph cluster_29 { color=blue - 104 [label="Enter block"]; - 105 [label="Access variable R|/b|"]; - 106 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 107 [label="Exit block"]; + 107 [label="Enter block"]; + 108 [label="Access variable R|/b|"]; + 109 [label="Smart cast: R|/b|"]; + 110 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 111 [label="Exit block"]; } - 108 [label="Exit when branch result"]; - 109 [label="Exit when"]; + 112 [label="Exit when branch result"]; + 113 [label="Exit when"]; } - 110 [label="Exit block"]; + 114 [label="Exit block"]; } - 111 [label="Exit function test_4" style="filled" fillcolor=red]; + 115 [label="Exit function test_4" style="filled" fillcolor=red]; } - 85 -> {86}; - 86 -> {87}; - 87 -> {88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; 92 -> {93}; 93 -> {94}; - 94 -> {103 95}; + 94 -> {95}; 95 -> {96}; 96 -> {97}; - 97 -> {98}; + 97 -> {106 98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {109}; + 102 -> {103}; 103 -> {104}; 104 -> {105}; - 105 -> {106}; + 105 -> {113}; 106 -> {107}; 107 -> {108}; 108 -> {109}; 109 -> {110}; 110 -> {111}; - - subgraph cluster_30 { - color=red - 112 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_31 { - color=blue - 113 [label="Enter block"]; - subgraph cluster_32 { - color=blue - 114 [label="Enter when"]; - subgraph cluster_33 { - color=blue - 115 [label="Enter when branch condition "]; - 116 [label="Access variable R|/b|"]; - 117 [label="Const: Boolean(true)"]; - 118 [label="Equality operator !="]; - 119 [label="Const: Boolean(true)"]; - 120 [label="Equality operator =="]; - 121 [label="Exit when branch condition"]; - } - subgraph cluster_34 { - color=blue - 122 [label="Enter when branch condition else"]; - 123 [label="Exit when branch condition"]; - } - 124 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 125 [label="Enter block"]; - 126 [label="Access variable R|/b|"]; - 127 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 128 [label="Exit block"]; - } - 129 [label="Exit when branch result"]; - 130 [label="Enter when branch result"]; - subgraph cluster_36 { - color=blue - 131 [label="Enter block"]; - 132 [label="Access variable R|/b|"]; - 133 [label="Function call: R|/b|.#()"]; - 134 [label="Exit block"]; - } - 135 [label="Exit when branch result"]; - 136 [label="Exit when"]; - } - 137 [label="Exit block"]; - } - 138 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 111 -> {112}; 112 -> {113}; 113 -> {114}; 114 -> {115}; - 115 -> {116}; + + subgraph cluster_30 { + color=red + 116 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_31 { + color=blue + 117 [label="Enter block"]; + subgraph cluster_32 { + color=blue + 118 [label="Enter when"]; + subgraph cluster_33 { + color=blue + 119 [label="Enter when branch condition "]; + 120 [label="Access variable R|/b|"]; + 121 [label="Const: Boolean(true)"]; + 122 [label="Equality operator !="]; + 123 [label="Const: Boolean(true)"]; + 124 [label="Equality operator =="]; + 125 [label="Exit when branch condition"]; + } + subgraph cluster_34 { + color=blue + 126 [label="Enter when branch condition else"]; + 127 [label="Exit when branch condition"]; + } + 128 [label="Enter when branch result"]; + subgraph cluster_35 { + color=blue + 129 [label="Enter block"]; + 130 [label="Access variable R|/b|"]; + 131 [label="Smart cast: R|/b|"]; + 132 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 133 [label="Exit block"]; + } + 134 [label="Exit when branch result"]; + 135 [label="Enter when branch result"]; + subgraph cluster_36 { + color=blue + 136 [label="Enter block"]; + 137 [label="Access variable R|/b|"]; + 138 [label="Function call: R|/b|.#()"]; + 139 [label="Exit block"]; + } + 140 [label="Exit when branch result"]; + 141 [label="Exit when"]; + } + 142 [label="Exit block"]; + } + 143 [label="Exit function test_5" style="filled" fillcolor=red]; + } 116 -> {117}; 117 -> {118}; 118 -> {119}; 119 -> {120}; 120 -> {121}; - 121 -> {130 122}; + 121 -> {122}; 122 -> {123}; 123 -> {124}; 124 -> {125}; - 125 -> {126}; + 125 -> {135 126}; 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {136}; + 129 -> {130}; 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; - 134 -> {135}; + 134 -> {141}; 135 -> {136}; 136 -> {137}; 137 -> {138}; - - subgraph cluster_37 { - color=red - 139 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_38 { - color=blue - 140 [label="Enter block"]; - subgraph cluster_39 { - color=blue - 141 [label="Enter when"]; - subgraph cluster_40 { - color=blue - 142 [label="Enter when branch condition "]; - 143 [label="Access variable R|/b|"]; - 144 [label="Const: Boolean(true)"]; - 145 [label="Equality operator !="]; - 146 [label="Const: Boolean(true)"]; - 147 [label="Equality operator !="]; - 148 [label="Exit when branch condition"]; - } - subgraph cluster_41 { - color=blue - 149 [label="Enter when branch condition else"]; - 150 [label="Exit when branch condition"]; - } - 151 [label="Enter when branch result"]; - subgraph cluster_42 { - color=blue - 152 [label="Enter block"]; - 153 [label="Access variable R|/b|"]; - 154 [label="Function call: R|/b|.#()"]; - 155 [label="Exit block"]; - } - 156 [label="Exit when branch result"]; - 157 [label="Enter when branch result"]; - subgraph cluster_43 { - color=blue - 158 [label="Enter block"]; - 159 [label="Access variable R|/b|"]; - 160 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 161 [label="Exit block"]; - } - 162 [label="Exit when branch result"]; - 163 [label="Exit when"]; - } - 164 [label="Exit block"]; - } - 165 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 138 -> {139}; 139 -> {140}; 140 -> {141}; 141 -> {142}; 142 -> {143}; - 143 -> {144}; + + subgraph cluster_37 { + color=red + 144 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_38 { + color=blue + 145 [label="Enter block"]; + subgraph cluster_39 { + color=blue + 146 [label="Enter when"]; + subgraph cluster_40 { + color=blue + 147 [label="Enter when branch condition "]; + 148 [label="Access variable R|/b|"]; + 149 [label="Const: Boolean(true)"]; + 150 [label="Equality operator !="]; + 151 [label="Const: Boolean(true)"]; + 152 [label="Equality operator !="]; + 153 [label="Exit when branch condition"]; + } + subgraph cluster_41 { + color=blue + 154 [label="Enter when branch condition else"]; + 155 [label="Exit when branch condition"]; + } + 156 [label="Enter when branch result"]; + subgraph cluster_42 { + color=blue + 157 [label="Enter block"]; + 158 [label="Access variable R|/b|"]; + 159 [label="Function call: R|/b|.#()"]; + 160 [label="Exit block"]; + } + 161 [label="Exit when branch result"]; + 162 [label="Enter when branch result"]; + subgraph cluster_43 { + color=blue + 163 [label="Enter block"]; + 164 [label="Access variable R|/b|"]; + 165 [label="Smart cast: R|/b|"]; + 166 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 167 [label="Exit block"]; + } + 168 [label="Exit when branch result"]; + 169 [label="Exit when"]; + } + 170 [label="Exit block"]; + } + 171 [label="Exit function test_6" style="filled" fillcolor=red]; + } 144 -> {145}; 145 -> {146}; 146 -> {147}; 147 -> {148}; - 148 -> {157 149}; + 148 -> {149}; 149 -> {150}; 150 -> {151}; 151 -> {152}; 152 -> {153}; - 153 -> {154}; + 153 -> {162 154}; 154 -> {155}; 155 -> {156}; - 156 -> {163}; + 156 -> {157}; 157 -> {158}; 158 -> {159}; 159 -> {160}; 160 -> {161}; - 161 -> {162}; + 161 -> {169}; 162 -> {163}; 163 -> {164}; 164 -> {165}; - - subgraph cluster_44 { - color=red - 166 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_45 { - color=blue - 167 [label="Enter block"]; - subgraph cluster_46 { - color=blue - 168 [label="Enter when"]; - subgraph cluster_47 { - color=blue - 169 [label="Enter when branch condition "]; - 170 [label="Access variable R|/b|"]; - 171 [label="Const: Boolean(true)"]; - 172 [label="Equality operator !="]; - 173 [label="Const: Boolean(false)"]; - 174 [label="Equality operator =="]; - 175 [label="Exit when branch condition"]; - } - subgraph cluster_48 { - color=blue - 176 [label="Enter when branch condition else"]; - 177 [label="Exit when branch condition"]; - } - 178 [label="Enter when branch result"]; - subgraph cluster_49 { - color=blue - 179 [label="Enter block"]; - 180 [label="Access variable R|/b|"]; - 181 [label="Function call: R|/b|.#()"]; - 182 [label="Exit block"]; - } - 183 [label="Exit when branch result"]; - 184 [label="Enter when branch result"]; - subgraph cluster_50 { - color=blue - 185 [label="Enter block"]; - 186 [label="Access variable R|/b|"]; - 187 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 188 [label="Exit block"]; - } - 189 [label="Exit when branch result"]; - 190 [label="Exit when"]; - } - 191 [label="Exit block"]; - } - 192 [label="Exit function test_7" style="filled" fillcolor=red]; - } + 165 -> {166}; 166 -> {167}; 167 -> {168}; 168 -> {169}; 169 -> {170}; 170 -> {171}; - 171 -> {172}; + + subgraph cluster_44 { + color=red + 172 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_45 { + color=blue + 173 [label="Enter block"]; + subgraph cluster_46 { + color=blue + 174 [label="Enter when"]; + subgraph cluster_47 { + color=blue + 175 [label="Enter when branch condition "]; + 176 [label="Access variable R|/b|"]; + 177 [label="Const: Boolean(true)"]; + 178 [label="Equality operator !="]; + 179 [label="Const: Boolean(false)"]; + 180 [label="Equality operator =="]; + 181 [label="Exit when branch condition"]; + } + subgraph cluster_48 { + color=blue + 182 [label="Enter when branch condition else"]; + 183 [label="Exit when branch condition"]; + } + 184 [label="Enter when branch result"]; + subgraph cluster_49 { + color=blue + 185 [label="Enter block"]; + 186 [label="Access variable R|/b|"]; + 187 [label="Function call: R|/b|.#()"]; + 188 [label="Exit block"]; + } + 189 [label="Exit when branch result"]; + 190 [label="Enter when branch result"]; + subgraph cluster_50 { + color=blue + 191 [label="Enter block"]; + 192 [label="Access variable R|/b|"]; + 193 [label="Smart cast: R|/b|"]; + 194 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 195 [label="Exit block"]; + } + 196 [label="Exit when branch result"]; + 197 [label="Exit when"]; + } + 198 [label="Exit block"]; + } + 199 [label="Exit function test_7" style="filled" fillcolor=red]; + } 172 -> {173}; 173 -> {174}; 174 -> {175}; - 175 -> {184 176}; + 175 -> {176}; 176 -> {177}; 177 -> {178}; 178 -> {179}; 179 -> {180}; 180 -> {181}; - 181 -> {182}; + 181 -> {190 182}; 182 -> {183}; - 183 -> {190}; + 183 -> {184}; 184 -> {185}; 185 -> {186}; 186 -> {187}; 187 -> {188}; 188 -> {189}; - 189 -> {190}; + 189 -> {197}; 190 -> {191}; 191 -> {192}; - - subgraph cluster_51 { - color=red - 193 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_52 { - color=blue - 194 [label="Enter block"]; - subgraph cluster_53 { - color=blue - 195 [label="Enter when"]; - subgraph cluster_54 { - color=blue - 196 [label="Enter when branch condition "]; - 197 [label="Access variable R|/b|"]; - 198 [label="Const: Boolean(true)"]; - 199 [label="Equality operator !="]; - 200 [label="Const: Boolean(false)"]; - 201 [label="Equality operator !="]; - 202 [label="Exit when branch condition"]; - } - subgraph cluster_55 { - color=blue - 203 [label="Enter when branch condition else"]; - 204 [label="Exit when branch condition"]; - } - 205 [label="Enter when branch result"]; - subgraph cluster_56 { - color=blue - 206 [label="Enter block"]; - 207 [label="Access variable R|/b|"]; - 208 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 209 [label="Exit block"]; - } - 210 [label="Exit when branch result"]; - 211 [label="Enter when branch result"]; - subgraph cluster_57 { - color=blue - 212 [label="Enter block"]; - 213 [label="Access variable R|/b|"]; - 214 [label="Function call: R|/b|.#()"]; - 215 [label="Exit block"]; - } - 216 [label="Exit when branch result"]; - 217 [label="Exit when"]; - } - 218 [label="Exit block"]; - } - 219 [label="Exit function test_8" style="filled" fillcolor=red]; - } + 192 -> {193}; 193 -> {194}; 194 -> {195}; 195 -> {196}; 196 -> {197}; 197 -> {198}; 198 -> {199}; - 199 -> {200}; + + subgraph cluster_51 { + color=red + 200 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_52 { + color=blue + 201 [label="Enter block"]; + subgraph cluster_53 { + color=blue + 202 [label="Enter when"]; + subgraph cluster_54 { + color=blue + 203 [label="Enter when branch condition "]; + 204 [label="Access variable R|/b|"]; + 205 [label="Const: Boolean(true)"]; + 206 [label="Equality operator !="]; + 207 [label="Const: Boolean(false)"]; + 208 [label="Equality operator !="]; + 209 [label="Exit when branch condition"]; + } + subgraph cluster_55 { + color=blue + 210 [label="Enter when branch condition else"]; + 211 [label="Exit when branch condition"]; + } + 212 [label="Enter when branch result"]; + subgraph cluster_56 { + color=blue + 213 [label="Enter block"]; + 214 [label="Access variable R|/b|"]; + 215 [label="Smart cast: R|/b|"]; + 216 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 217 [label="Exit block"]; + } + 218 [label="Exit when branch result"]; + 219 [label="Enter when branch result"]; + subgraph cluster_57 { + color=blue + 220 [label="Enter block"]; + 221 [label="Access variable R|/b|"]; + 222 [label="Function call: R|/b|.#()"]; + 223 [label="Exit block"]; + } + 224 [label="Exit when branch result"]; + 225 [label="Exit when"]; + } + 226 [label="Exit block"]; + } + 227 [label="Exit function test_8" style="filled" fillcolor=red]; + } 200 -> {201}; 201 -> {202}; - 202 -> {211 203}; + 202 -> {203}; 203 -> {204}; 204 -> {205}; 205 -> {206}; 206 -> {207}; 207 -> {208}; 208 -> {209}; - 209 -> {210}; - 210 -> {217}; + 209 -> {219 210}; + 210 -> {211}; 211 -> {212}; 212 -> {213}; 213 -> {214}; @@ -615,6 +623,14 @@ digraph equalsToBoolean_kt { 215 -> {216}; 216 -> {217}; 217 -> {218}; - 218 -> {219}; + 218 -> {225}; + 219 -> {220}; + 220 -> {221}; + 221 -> {222}; + 222 -> {223}; + 223 -> {224}; + 224 -> {225}; + 225 -> {226}; + 226 -> {227}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot index 8e8ac55c49f..a6c351b20a7 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot @@ -37,10 +37,11 @@ digraph jumpFromRhsOfOperator_kt { 15 [label="Exit ||"]; } 16 [label="Access variable R|/a|"]; - 17 [label="Function call: R|/a|.R|/A.foo|()"]; - 18 [label="Exit block"]; + 17 [label="Smart cast: R|/a|"]; + 18 [label="Function call: R|/a|.R|/A.foo|()"]; + 19 [label="Exit block"]; } - 19 [label="Exit function test_1" style="filled" fillcolor=red]; + 20 [label="Exit function test_1" style="filled" fillcolor=red]; } 4 -> {5}; 5 -> {6}; @@ -51,120 +52,123 @@ digraph jumpFromRhsOfOperator_kt { 10 -> {15 11}; 11 -> {12}; 12 -> {13}; - 13 -> {19} [label=onUncaughtException]; + 13 -> {20} [label=onUncaughtException]; 13 -> {14} [style=dotted]; 14 -> {15} [style=dotted]; 15 -> {16}; 16 -> {17}; 17 -> {18}; 18 -> {19}; + 19 -> {20}; subgraph cluster_5 { color=red - 20 [label="Enter function teat_2" style="filled" fillcolor=red]; + 21 [label="Enter function teat_2" style="filled" fillcolor=red]; subgraph cluster_6 { color=blue - 21 [label="Enter block"]; + 22 [label="Enter block"]; subgraph cluster_7 { color=blue - 22 [label="Enter &&"]; - 23 [label="Access variable R|/a|"]; - 24 [label="Const: Null(null)"]; - 25 [label="Equality operator =="]; - 26 [label="Exit left part of &&"]; - 27 [label="Enter right part of &&"]; - 28 [label="Function call: R|java/lang/Exception.Exception|()"]; - 29 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 30 [label="Stub" style="filled" fillcolor=gray]; - 31 [label="Exit &&"]; + 23 [label="Enter &&"]; + 24 [label="Access variable R|/a|"]; + 25 [label="Const: Null(null)"]; + 26 [label="Equality operator =="]; + 27 [label="Exit left part of &&"]; + 28 [label="Enter right part of &&"]; + 29 [label="Function call: R|java/lang/Exception.Exception|()"]; + 30 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 31 [label="Stub" style="filled" fillcolor=gray]; + 32 [label="Exit &&"]; } - 32 [label="Access variable R|/a|"]; - 33 [label="Function call: R|/a|.R|/A.foo|()"]; - 34 [label="Exit block"]; + 33 [label="Access variable R|/a|"]; + 34 [label="Smart cast: R|/a|"]; + 35 [label="Function call: R|/a|.R|/A.foo|()"]; + 36 [label="Exit block"]; } - 35 [label="Exit function teat_2" style="filled" fillcolor=red]; + 37 [label="Exit function teat_2" style="filled" fillcolor=red]; } - 20 -> {21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {31 27}; - 27 -> {28}; + 26 -> {27}; + 27 -> {32 28}; 28 -> {29}; - 29 -> {35} [label=onUncaughtException]; - 29 -> {30} [style=dotted]; + 29 -> {30}; + 30 -> {37} [label=onUncaughtException]; 30 -> {31} [style=dotted]; - 31 -> {32}; + 31 -> {32} [style=dotted]; 32 -> {33}; 33 -> {34}; 34 -> {35}; + 35 -> {36}; + 36 -> {37}; subgraph cluster_8 { color=red - 36 [label="Enter function test_3" style="filled" fillcolor=red]; + 38 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_9 { color=blue - 37 [label="Enter block"]; + 39 [label="Enter block"]; subgraph cluster_10 { color=blue - 38 [label="Enter when"]; + 40 [label="Enter when"]; subgraph cluster_11 { color=blue - 39 [label="Enter when branch condition "]; + 41 [label="Enter when branch condition "]; subgraph cluster_12 { color=blue - 40 [label="Enter ||"]; - 41 [label="Access variable R|/a|"]; - 42 [label="Const: Null(null)"]; - 43 [label="Equality operator !="]; - 44 [label="Exit left part of ||"]; - 45 [label="Enter right part of ||"]; - 46 [label="Function call: R|java/lang/Exception.Exception|()"]; - 47 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 48 [label="Stub" style="filled" fillcolor=gray]; - 49 [label="Exit ||"]; + 42 [label="Enter ||"]; + 43 [label="Access variable R|/a|"]; + 44 [label="Const: Null(null)"]; + 45 [label="Equality operator !="]; + 46 [label="Exit left part of ||"]; + 47 [label="Enter right part of ||"]; + 48 [label="Function call: R|java/lang/Exception.Exception|()"]; + 49 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 50 [label="Stub" style="filled" fillcolor=gray]; + 51 [label="Exit ||"]; } - 50 [label="Exit when branch condition"]; + 52 [label="Exit when branch condition"]; } - 51 [label="Synthetic else branch"]; - 52 [label="Enter when branch result"]; + 53 [label="Synthetic else branch"]; + 54 [label="Enter when branch result"]; subgraph cluster_13 { color=blue - 53 [label="Enter block"]; - 54 [label="Access variable R|/a|"]; - 55 [label="Function call: R|/a|.R|/A.foo|()"]; - 56 [label="Exit block"]; + 55 [label="Enter block"]; + 56 [label="Access variable R|/a|"]; + 57 [label="Smart cast: R|/a|"]; + 58 [label="Function call: R|/a|.R|/A.foo|()"]; + 59 [label="Exit block"]; } - 57 [label="Exit when branch result"]; - 58 [label="Exit when"]; + 60 [label="Exit when branch result"]; + 61 [label="Exit when"]; } - 59 [label="Access variable R|/a|"]; - 60 [label="Function call: R|/a|.R|/A.foo|()"]; - 61 [label="Exit block"]; + 62 [label="Access variable R|/a|"]; + 63 [label="Smart cast: R|/a|"]; + 64 [label="Function call: R|/a|.R|/A.foo|()"]; + 65 [label="Exit block"]; } - 62 [label="Exit function test_3" style="filled" fillcolor=red]; + 66 [label="Exit function test_3" style="filled" fillcolor=red]; } - 36 -> {37}; - 37 -> {38}; 38 -> {39}; 39 -> {40}; 40 -> {41}; 41 -> {42}; 42 -> {43}; 43 -> {44}; - 44 -> {49 45}; + 44 -> {45}; 45 -> {46}; - 46 -> {47}; - 47 -> {62} [label=onUncaughtException]; - 47 -> {48} [style=dotted]; - 48 -> {49} [style=dotted]; - 49 -> {50}; - 50 -> {52 51}; - 51 -> {58}; - 52 -> {53}; - 53 -> {54}; + 46 -> {51 47}; + 47 -> {48}; + 48 -> {49}; + 49 -> {66} [label=onUncaughtException]; + 49 -> {50} [style=dotted]; + 50 -> {51} [style=dotted]; + 51 -> {52}; + 52 -> {54 53}; + 53 -> {61}; 54 -> {55}; 55 -> {56}; 56 -> {57}; @@ -173,282 +177,243 @@ digraph jumpFromRhsOfOperator_kt { 59 -> {60}; 60 -> {61}; 61 -> {62}; - - subgraph cluster_14 { - color=red - 63 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_15 { - color=blue - 64 [label="Enter block"]; - subgraph cluster_16 { - color=blue - 65 [label="Enter when"]; - subgraph cluster_17 { - color=blue - 66 [label="Enter when branch condition "]; - subgraph cluster_18 { - color=blue - 67 [label="Enter &&"]; - 68 [label="Access variable R|/a|"]; - 69 [label="Const: Null(null)"]; - 70 [label="Equality operator =="]; - 71 [label="Exit left part of &&"]; - 72 [label="Enter right part of &&"]; - 73 [label="Function call: R|java/lang/Exception.Exception|()"]; - 74 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 75 [label="Stub" style="filled" fillcolor=gray]; - 76 [label="Exit &&"]; - } - 77 [label="Exit when branch condition"]; - } - 78 [label="Synthetic else branch"]; - 79 [label="Enter when branch result"]; - subgraph cluster_19 { - color=blue - 80 [label="Enter block"]; - 81 [label="Access variable R|/a|"]; - 82 [label="Function call: R|/a|.R|/A.foo|()"]; - 83 [label="Exit block"]; - } - 84 [label="Exit when branch result"]; - 85 [label="Exit when"]; - } - 86 [label="Access variable R|/a|"]; - 87 [label="Function call: R|/a|.R|/A.foo|()"]; - 88 [label="Exit block"]; - } - 89 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 62 -> {63}; 63 -> {64}; 64 -> {65}; 65 -> {66}; - 66 -> {67}; + + subgraph cluster_14 { + color=red + 67 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_15 { + color=blue + 68 [label="Enter block"]; + subgraph cluster_16 { + color=blue + 69 [label="Enter when"]; + subgraph cluster_17 { + color=blue + 70 [label="Enter when branch condition "]; + subgraph cluster_18 { + color=blue + 71 [label="Enter &&"]; + 72 [label="Access variable R|/a|"]; + 73 [label="Const: Null(null)"]; + 74 [label="Equality operator =="]; + 75 [label="Exit left part of &&"]; + 76 [label="Enter right part of &&"]; + 77 [label="Function call: R|java/lang/Exception.Exception|()"]; + 78 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 79 [label="Stub" style="filled" fillcolor=gray]; + 80 [label="Exit &&"]; + } + 81 [label="Exit when branch condition"]; + } + 82 [label="Synthetic else branch"]; + 83 [label="Enter when branch result"]; + subgraph cluster_19 { + color=blue + 84 [label="Enter block"]; + 85 [label="Access variable R|/a|"]; + 86 [label="Smart cast: R|/a|"]; + 87 [label="Function call: R|/a|.R|/A.foo|()"]; + 88 [label="Exit block"]; + } + 89 [label="Exit when branch result"]; + 90 [label="Exit when"]; + } + 91 [label="Access variable R|/a|"]; + 92 [label="Smart cast: R|/a|"]; + 93 [label="Function call: R|/a|.R|/A.foo|()"]; + 94 [label="Exit block"]; + } + 95 [label="Exit function test_4" style="filled" fillcolor=red]; + } 67 -> {68}; 68 -> {69}; 69 -> {70}; 70 -> {71}; - 71 -> {76 72}; + 71 -> {72}; 72 -> {73}; 73 -> {74}; - 74 -> {89} [label=onUncaughtException]; - 74 -> {75} [style=dotted]; - 75 -> {76} [style=dotted]; + 74 -> {75}; + 75 -> {80 76}; 76 -> {77}; - 77 -> {79 78}; - 78 -> {85}; - 79 -> {80}; + 77 -> {78}; + 78 -> {95} [label=onUncaughtException]; + 78 -> {79} [style=dotted]; + 79 -> {80} [style=dotted]; 80 -> {81}; - 81 -> {82}; - 82 -> {83}; + 81 -> {83 82}; + 82 -> {90}; 83 -> {84}; 84 -> {85}; 85 -> {86}; 86 -> {87}; 87 -> {88}; 88 -> {89}; - - subgraph cluster_20 { - color=red - 90 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_21 { - color=blue - 91 [label="Enter block"]; - subgraph cluster_22 { - color=blue - 92 [label="Enter ||"]; - 93 [label="Access variable R|/a|"]; - 94 [label="Const: Null(null)"]; - 95 [label="Equality operator =="]; - 96 [label="Exit left part of ||"]; - 97 [label="Enter right part of ||"]; - 98 [label="Function call: R|java/lang/Exception.Exception|()"]; - 99 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 100 [label="Stub" style="filled" fillcolor=gray]; - 101 [label="Exit ||"]; - } - 102 [label="Access variable R|/a|"]; - 103 [label="Function call: R|/a|.#()"]; - 104 [label="Exit block"]; - } - 105 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 89 -> {90}; 90 -> {91}; 91 -> {92}; 92 -> {93}; 93 -> {94}; 94 -> {95}; - 95 -> {96}; - 96 -> {101 97}; + + subgraph cluster_20 { + color=red + 96 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 97 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 98 [label="Enter ||"]; + 99 [label="Access variable R|/a|"]; + 100 [label="Const: Null(null)"]; + 101 [label="Equality operator =="]; + 102 [label="Exit left part of ||"]; + 103 [label="Enter right part of ||"]; + 104 [label="Function call: R|java/lang/Exception.Exception|()"]; + 105 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 106 [label="Stub" style="filled" fillcolor=gray]; + 107 [label="Exit ||"]; + } + 108 [label="Access variable R|/a|"]; + 109 [label="Smart cast: R|/a|"]; + 110 [label="Function call: R|/a|.#()"]; + 111 [label="Exit block"]; + } + 112 [label="Exit function test_5" style="filled" fillcolor=red]; + } + 96 -> {97}; 97 -> {98}; 98 -> {99}; - 99 -> {105} [label=onUncaughtException]; - 99 -> {100} [style=dotted]; - 100 -> {101} [style=dotted]; + 99 -> {100}; + 100 -> {101}; 101 -> {102}; - 102 -> {103}; + 102 -> {107 103}; 103 -> {104}; 104 -> {105}; - - subgraph cluster_23 { - color=red - 106 [label="Enter function teat_6" style="filled" fillcolor=red]; - subgraph cluster_24 { - color=blue - 107 [label="Enter block"]; - subgraph cluster_25 { - color=blue - 108 [label="Enter &&"]; - 109 [label="Access variable R|/a|"]; - 110 [label="Const: Null(null)"]; - 111 [label="Equality operator !="]; - 112 [label="Exit left part of &&"]; - 113 [label="Enter right part of &&"]; - 114 [label="Function call: R|java/lang/Exception.Exception|()"]; - 115 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 116 [label="Stub" style="filled" fillcolor=gray]; - 117 [label="Exit &&"]; - } - 118 [label="Access variable R|/a|"]; - 119 [label="Function call: R|/a|.#()"]; - 120 [label="Exit block"]; - } - 121 [label="Exit function teat_6" style="filled" fillcolor=red]; - } - 106 -> {107}; + 105 -> {112} [label=onUncaughtException]; + 105 -> {106} [style=dotted]; + 106 -> {107} [style=dotted]; 107 -> {108}; 108 -> {109}; 109 -> {110}; 110 -> {111}; 111 -> {112}; - 112 -> {117 113}; + + subgraph cluster_23 { + color=red + 113 [label="Enter function teat_6" style="filled" fillcolor=red]; + subgraph cluster_24 { + color=blue + 114 [label="Enter block"]; + subgraph cluster_25 { + color=blue + 115 [label="Enter &&"]; + 116 [label="Access variable R|/a|"]; + 117 [label="Const: Null(null)"]; + 118 [label="Equality operator !="]; + 119 [label="Exit left part of &&"]; + 120 [label="Enter right part of &&"]; + 121 [label="Function call: R|java/lang/Exception.Exception|()"]; + 122 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 123 [label="Stub" style="filled" fillcolor=gray]; + 124 [label="Exit &&"]; + } + 125 [label="Access variable R|/a|"]; + 126 [label="Smart cast: R|/a|"]; + 127 [label="Function call: R|/a|.#()"]; + 128 [label="Exit block"]; + } + 129 [label="Exit function teat_6" style="filled" fillcolor=red]; + } 113 -> {114}; 114 -> {115}; - 115 -> {121} [label=onUncaughtException]; - 115 -> {116} [style=dotted]; - 116 -> {117} [style=dotted]; + 115 -> {116}; + 116 -> {117}; 117 -> {118}; 118 -> {119}; - 119 -> {120}; + 119 -> {124 120}; 120 -> {121}; - - subgraph cluster_26 { - color=red - 122 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_27 { - color=blue - 123 [label="Enter block"]; - subgraph cluster_28 { - color=blue - 124 [label="Enter when"]; - subgraph cluster_29 { - color=blue - 125 [label="Enter when branch condition "]; - subgraph cluster_30 { - color=blue - 126 [label="Enter ||"]; - 127 [label="Access variable R|/a|"]; - 128 [label="Const: Null(null)"]; - 129 [label="Equality operator =="]; - 130 [label="Exit left part of ||"]; - 131 [label="Enter right part of ||"]; - 132 [label="Function call: R|java/lang/Exception.Exception|()"]; - 133 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 134 [label="Stub" style="filled" fillcolor=gray]; - 135 [label="Exit ||"]; - } - 136 [label="Exit when branch condition"]; - } - 137 [label="Synthetic else branch"]; - 138 [label="Enter when branch result"]; - subgraph cluster_31 { - color=blue - 139 [label="Enter block"]; - 140 [label="Access variable R|/a|"]; - 141 [label="Function call: R|/a|.#()"]; - 142 [label="Exit block"]; - } - 143 [label="Exit when branch result"]; - 144 [label="Exit when"]; - } - 145 [label="Access variable R|/a|"]; - 146 [label="Function call: R|/a|.#()"]; - 147 [label="Exit block"]; - } - 148 [label="Exit function test_7" style="filled" fillcolor=red]; - } - 122 -> {123}; - 123 -> {124}; + 121 -> {122}; + 122 -> {129} [label=onUncaughtException]; + 122 -> {123} [style=dotted]; + 123 -> {124} [style=dotted]; 124 -> {125}; 125 -> {126}; 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {130}; - 130 -> {135 131}; + + subgraph cluster_26 { + color=red + 130 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_27 { + color=blue + 131 [label="Enter block"]; + subgraph cluster_28 { + color=blue + 132 [label="Enter when"]; + subgraph cluster_29 { + color=blue + 133 [label="Enter when branch condition "]; + subgraph cluster_30 { + color=blue + 134 [label="Enter ||"]; + 135 [label="Access variable R|/a|"]; + 136 [label="Const: Null(null)"]; + 137 [label="Equality operator =="]; + 138 [label="Exit left part of ||"]; + 139 [label="Enter right part of ||"]; + 140 [label="Function call: R|java/lang/Exception.Exception|()"]; + 141 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 142 [label="Stub" style="filled" fillcolor=gray]; + 143 [label="Exit ||"]; + } + 144 [label="Exit when branch condition"]; + } + 145 [label="Synthetic else branch"]; + 146 [label="Enter when branch result"]; + subgraph cluster_31 { + color=blue + 147 [label="Enter block"]; + 148 [label="Access variable R|/a|"]; + 149 [label="Smart cast: R|/a|"]; + 150 [label="Function call: R|/a|.#()"]; + 151 [label="Exit block"]; + } + 152 [label="Exit when branch result"]; + 153 [label="Exit when"]; + } + 154 [label="Access variable R|/a|"]; + 155 [label="Smart cast: R|/a|"]; + 156 [label="Function call: R|/a|.#()"]; + 157 [label="Exit block"]; + } + 158 [label="Exit function test_7" style="filled" fillcolor=red]; + } + 130 -> {131}; 131 -> {132}; 132 -> {133}; - 133 -> {148} [label=onUncaughtException]; - 133 -> {134} [style=dotted]; - 134 -> {135} [style=dotted]; + 133 -> {134}; + 134 -> {135}; 135 -> {136}; - 136 -> {138 137}; - 137 -> {144}; - 138 -> {139}; + 136 -> {137}; + 137 -> {138}; + 138 -> {143 139}; 139 -> {140}; 140 -> {141}; - 141 -> {142}; - 142 -> {143}; + 141 -> {158} [label=onUncaughtException]; + 141 -> {142} [style=dotted]; + 142 -> {143} [style=dotted]; 143 -> {144}; - 144 -> {145}; - 145 -> {146}; + 144 -> {146 145}; + 145 -> {153}; 146 -> {147}; 147 -> {148}; - - subgraph cluster_32 { - color=red - 149 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_33 { - color=blue - 150 [label="Enter block"]; - subgraph cluster_34 { - color=blue - 151 [label="Enter when"]; - subgraph cluster_35 { - color=blue - 152 [label="Enter when branch condition "]; - subgraph cluster_36 { - color=blue - 153 [label="Enter &&"]; - 154 [label="Access variable R|/a|"]; - 155 [label="Const: Null(null)"]; - 156 [label="Equality operator !="]; - 157 [label="Exit left part of &&"]; - 158 [label="Enter right part of &&"]; - 159 [label="Function call: R|java/lang/Exception.Exception|()"]; - 160 [label="Throw: throw R|java/lang/Exception.Exception|()"]; - 161 [label="Stub" style="filled" fillcolor=gray]; - 162 [label="Exit &&"]; - } - 163 [label="Exit when branch condition"]; - } - 164 [label="Synthetic else branch"]; - 165 [label="Enter when branch result"]; - subgraph cluster_37 { - color=blue - 166 [label="Enter block"]; - 167 [label="Access variable R|/a|"]; - 168 [label="Function call: R|/a|.#()"]; - 169 [label="Exit block"]; - } - 170 [label="Exit when branch result"]; - 171 [label="Exit when"]; - } - 172 [label="Access variable R|/a|"]; - 173 [label="Function call: R|/a|.#()"]; - 174 [label="Exit block"]; - } - 175 [label="Exit function test_8" style="filled" fillcolor=red]; - } + 148 -> {149}; 149 -> {150}; 150 -> {151}; 151 -> {152}; @@ -457,24 +422,83 @@ digraph jumpFromRhsOfOperator_kt { 154 -> {155}; 155 -> {156}; 156 -> {157}; - 157 -> {162 158}; - 158 -> {159}; + 157 -> {158}; + + subgraph cluster_32 { + color=red + 159 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_33 { + color=blue + 160 [label="Enter block"]; + subgraph cluster_34 { + color=blue + 161 [label="Enter when"]; + subgraph cluster_35 { + color=blue + 162 [label="Enter when branch condition "]; + subgraph cluster_36 { + color=blue + 163 [label="Enter &&"]; + 164 [label="Access variable R|/a|"]; + 165 [label="Const: Null(null)"]; + 166 [label="Equality operator !="]; + 167 [label="Exit left part of &&"]; + 168 [label="Enter right part of &&"]; + 169 [label="Function call: R|java/lang/Exception.Exception|()"]; + 170 [label="Throw: throw R|java/lang/Exception.Exception|()"]; + 171 [label="Stub" style="filled" fillcolor=gray]; + 172 [label="Exit &&"]; + } + 173 [label="Exit when branch condition"]; + } + 174 [label="Synthetic else branch"]; + 175 [label="Enter when branch result"]; + subgraph cluster_37 { + color=blue + 176 [label="Enter block"]; + 177 [label="Access variable R|/a|"]; + 178 [label="Smart cast: R|/a|"]; + 179 [label="Function call: R|/a|.#()"]; + 180 [label="Exit block"]; + } + 181 [label="Exit when branch result"]; + 182 [label="Exit when"]; + } + 183 [label="Access variable R|/a|"]; + 184 [label="Smart cast: R|/a|"]; + 185 [label="Function call: R|/a|.#()"]; + 186 [label="Exit block"]; + } + 187 [label="Exit function test_8" style="filled" fillcolor=red]; + } 159 -> {160}; - 160 -> {175} [label=onUncaughtException]; - 160 -> {161} [style=dotted]; - 161 -> {162} [style=dotted]; + 160 -> {161}; + 161 -> {162}; 162 -> {163}; - 163 -> {165 164}; - 164 -> {171}; + 163 -> {164}; + 164 -> {165}; 165 -> {166}; 166 -> {167}; - 167 -> {168}; + 167 -> {172 168}; 168 -> {169}; 169 -> {170}; - 170 -> {171}; - 171 -> {172}; + 170 -> {187} [label=onUncaughtException]; + 170 -> {171} [style=dotted]; + 171 -> {172} [style=dotted]; 172 -> {173}; - 173 -> {174}; - 174 -> {175}; + 173 -> {175 174}; + 174 -> {182}; + 175 -> {176}; + 176 -> {177}; + 177 -> {178}; + 178 -> {179}; + 179 -> {180}; + 180 -> {181}; + 181 -> {182}; + 182 -> {183}; + 183 -> {184}; + 184 -> {185}; + 185 -> {186}; + 186 -> {187}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot index cff31420500..81e735d9183 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.dot @@ -55,17 +55,19 @@ digraph boundSmartcasts_kt { color=blue 19 [label="Enter block"]; 20 [label="Access variable R|/x|"]; - 21 [label="Function call: R|/x|.R|/A.foo|()"]; - 22 [label="Access variable R|/y|"]; - 23 [label="Function call: R|/y|.R|/A.foo|()"]; - 24 [label="Exit block"]; + 21 [label="Smart cast: R|/x|"]; + 22 [label="Function call: R|/x|.R|/A.foo|()"]; + 23 [label="Access variable R|/y|"]; + 24 [label="Smart cast: R|/y|"]; + 25 [label="Function call: R|/y|.R|/A.foo|()"]; + 26 [label="Exit block"]; } - 25 [label="Exit when branch result"]; - 26 [label="Exit when"]; + 27 [label="Exit when branch result"]; + 28 [label="Exit when"]; } - 27 [label="Exit block"]; + 29 [label="Exit block"]; } - 28 [label="Exit function test_1" style="filled" fillcolor=red]; + 30 [label="Exit function test_1" style="filled" fillcolor=red]; } 8 -> {9}; 9 -> {10}; @@ -76,7 +78,7 @@ digraph boundSmartcasts_kt { 14 -> {15}; 15 -> {16}; 16 -> {18 17}; - 17 -> {26}; + 17 -> {28}; 18 -> {19}; 19 -> {20}; 20 -> {21}; @@ -87,55 +89,57 @@ digraph boundSmartcasts_kt { 25 -> {26}; 26 -> {27}; 27 -> {28}; + 28 -> {29}; + 29 -> {30}; subgraph cluster_9 { color=red - 29 [label="Enter function test_2" style="filled" fillcolor=red]; + 31 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 30 [label="Enter block"]; - 31 [label="Access variable R|/x|"]; - 32 [label="Variable declaration: lval y: R|kotlin/Any|"]; + 32 [label="Enter block"]; + 33 [label="Access variable R|/x|"]; + 34 [label="Variable declaration: lval y: R|kotlin/Any|"]; subgraph cluster_11 { color=blue - 33 [label="Enter when"]; + 35 [label="Enter when"]; subgraph cluster_12 { color=blue - 34 [label="Enter when branch condition "]; - 35 [label="Access variable R|/y|"]; - 36 [label="Type operator: (R|/y| is R|A|)"]; - 37 [label="Exit when branch condition"]; + 36 [label="Enter when branch condition "]; + 37 [label="Access variable R|/y|"]; + 38 [label="Type operator: (R|/y| is R|A|)"]; + 39 [label="Exit when branch condition"]; } - 38 [label="Synthetic else branch"]; - 39 [label="Enter when branch result"]; + 40 [label="Synthetic else branch"]; + 41 [label="Enter when branch result"]; subgraph cluster_13 { color=blue - 40 [label="Enter block"]; - 41 [label="Access variable R|/x|"]; - 42 [label="Function call: R|/x|.R|/A.foo|()"]; - 43 [label="Access variable R|/y|"]; - 44 [label="Function call: R|/y|.R|/A.foo|()"]; - 45 [label="Exit block"]; + 42 [label="Enter block"]; + 43 [label="Access variable R|/x|"]; + 44 [label="Smart cast: R|/x|"]; + 45 [label="Function call: R|/x|.R|/A.foo|()"]; + 46 [label="Access variable R|/y|"]; + 47 [label="Smart cast: R|/y|"]; + 48 [label="Function call: R|/y|.R|/A.foo|()"]; + 49 [label="Exit block"]; } - 46 [label="Exit when branch result"]; - 47 [label="Exit when"]; + 50 [label="Exit when branch result"]; + 51 [label="Exit when"]; } - 48 [label="Exit block"]; + 52 [label="Exit block"]; } - 49 [label="Exit function test_2" style="filled" fillcolor=red]; + 53 [label="Exit function test_2" style="filled" fillcolor=red]; } - 29 -> {30}; - 30 -> {31}; 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; - 37 -> {39 38}; - 38 -> {47}; - 39 -> {40}; - 40 -> {41}; + 37 -> {38}; + 38 -> {39}; + 39 -> {41 40}; + 40 -> {51}; 41 -> {42}; 42 -> {43}; 43 -> {44}; @@ -144,81 +148,84 @@ digraph boundSmartcasts_kt { 46 -> {47}; 47 -> {48}; 48 -> {49}; - - subgraph cluster_14 { - color=red - 50 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_15 { - color=blue - 51 [label="Enter block"]; - 52 [label="Access variable R|/x|"]; - 53 [label="Variable declaration: lvar z: R|kotlin/Any|"]; - subgraph cluster_16 { - color=blue - 54 [label="Enter when"]; - subgraph cluster_17 { - color=blue - 55 [label="Enter when branch condition "]; - 56 [label="Access variable R|/x|"]; - 57 [label="Type operator: (R|/x| is R|A|)"]; - 58 [label="Exit when branch condition"]; - } - 59 [label="Synthetic else branch"]; - 60 [label="Enter when branch result"]; - subgraph cluster_18 { - color=blue - 61 [label="Enter block"]; - 62 [label="Access variable R|/z|"]; - 63 [label="Function call: R|/z|.R|/A.foo|()"]; - 64 [label="Exit block"]; - } - 65 [label="Exit when branch result"]; - 66 [label="Exit when"]; - } - 67 [label="Access variable R|/y|"]; - 68 [label="Assignment: R|/z|"]; - subgraph cluster_19 { - color=blue - 69 [label="Enter when"]; - subgraph cluster_20 { - color=blue - 70 [label="Enter when branch condition "]; - 71 [label="Access variable R|/y|"]; - 72 [label="Type operator: (R|/y| is R|B|)"]; - 73 [label="Exit when branch condition"]; - } - 74 [label="Synthetic else branch"]; - 75 [label="Enter when branch result"]; - subgraph cluster_21 { - color=blue - 76 [label="Enter block"]; - 77 [label="Access variable R|/z|"]; - 78 [label="Function call: R|/z|.#()"]; - 79 [label="Access variable R|/z|"]; - 80 [label="Function call: R|/z|.R|/B.bar|()"]; - 81 [label="Exit block"]; - } - 82 [label="Exit when branch result"]; - 83 [label="Exit when"]; - } - 84 [label="Exit block"]; - } - 85 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {54}; + + subgraph cluster_14 { + color=red + 54 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_15 { + color=blue + 55 [label="Enter block"]; + 56 [label="Access variable R|/x|"]; + 57 [label="Variable declaration: lvar z: R|kotlin/Any|"]; + subgraph cluster_16 { + color=blue + 58 [label="Enter when"]; + subgraph cluster_17 { + color=blue + 59 [label="Enter when branch condition "]; + 60 [label="Access variable R|/x|"]; + 61 [label="Type operator: (R|/x| is R|A|)"]; + 62 [label="Exit when branch condition"]; + } + 63 [label="Synthetic else branch"]; + 64 [label="Enter when branch result"]; + subgraph cluster_18 { + color=blue + 65 [label="Enter block"]; + 66 [label="Access variable R|/z|"]; + 67 [label="Smart cast: R|/z|"]; + 68 [label="Function call: R|/z|.R|/A.foo|()"]; + 69 [label="Exit block"]; + } + 70 [label="Exit when branch result"]; + 71 [label="Exit when"]; + } + 72 [label="Access variable R|/y|"]; + 73 [label="Assignment: R|/z|"]; + subgraph cluster_19 { + color=blue + 74 [label="Enter when"]; + subgraph cluster_20 { + color=blue + 75 [label="Enter when branch condition "]; + 76 [label="Access variable R|/y|"]; + 77 [label="Type operator: (R|/y| is R|B|)"]; + 78 [label="Exit when branch condition"]; + } + 79 [label="Synthetic else branch"]; + 80 [label="Enter when branch result"]; + subgraph cluster_21 { + color=blue + 81 [label="Enter block"]; + 82 [label="Access variable R|/z|"]; + 83 [label="Smart cast: R|/z|"]; + 84 [label="Function call: R|/z|.#()"]; + 85 [label="Access variable R|/z|"]; + 86 [label="Smart cast: R|/z|"]; + 87 [label="Function call: R|/z|.R|/B.bar|()"]; + 88 [label="Exit block"]; + } + 89 [label="Exit when branch result"]; + 90 [label="Exit when"]; + } + 91 [label="Exit block"]; + } + 92 [label="Exit function test_3" style="filled" fillcolor=red]; + } 54 -> {55}; 55 -> {56}; 56 -> {57}; 57 -> {58}; - 58 -> {60 59}; - 59 -> {66}; + 58 -> {59}; + 59 -> {60}; 60 -> {61}; 61 -> {62}; - 62 -> {63}; - 63 -> {64}; + 62 -> {64 63}; + 63 -> {71}; 64 -> {65}; 65 -> {66}; 66 -> {67}; @@ -228,70 +235,73 @@ digraph boundSmartcasts_kt { 70 -> {71}; 71 -> {72}; 72 -> {73}; - 73 -> {75 74}; - 74 -> {83}; + 73 -> {74}; + 74 -> {75}; 75 -> {76}; 76 -> {77}; 77 -> {78}; - 78 -> {79}; - 79 -> {80}; + 78 -> {80 79}; + 79 -> {90}; 80 -> {81}; 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; - - subgraph cluster_22 { - color=red - 86 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_23 { - color=blue - 87 [label="Enter block"]; - 88 [label="Const: Int(1)"]; - 89 [label="Variable declaration: lvar x: R|kotlin/Any|"]; - 90 [label="Access variable R|/x|"]; - 91 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - 92 [label="Access variable R|/x|"]; - 93 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 94 [label="Access variable R|/y|"]; - 95 [label="Assignment: R|/x|"]; - 96 [label="Access variable R|/x|"]; - 97 [label="Function call: R|/x|.#()"]; - subgraph cluster_24 { - color=blue - 98 [label="Enter when"]; - subgraph cluster_25 { - color=blue - 99 [label="Enter when branch condition "]; - 100 [label="Access variable R|/y|"]; - 101 [label="Type operator: (R|/y| is R|A|)"]; - 102 [label="Exit when branch condition"]; - } - 103 [label="Synthetic else branch"]; - 104 [label="Enter when branch result"]; - subgraph cluster_26 { - color=blue - 105 [label="Enter block"]; - 106 [label="Access variable R|/x|"]; - 107 [label="Function call: R|/x|.R|/A.foo|()"]; - 108 [label="Access variable R|/y|"]; - 109 [label="Function call: R|/y|.R|/A.foo|()"]; - 110 [label="Exit block"]; - } - 111 [label="Exit when branch result"]; - 112 [label="Exit when"]; - } - 113 [label="Exit block"]; - } - 114 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 85 -> {86}; 86 -> {87}; 87 -> {88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; - 92 -> {93}; + + subgraph cluster_22 { + color=red + 93 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_23 { + color=blue + 94 [label="Enter block"]; + 95 [label="Const: Int(1)"]; + 96 [label="Variable declaration: lvar x: R|kotlin/Any|"]; + 97 [label="Access variable R|/x|"]; + 98 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + 99 [label="Access variable R|/x|"]; + 100 [label="Smart cast: R|/x|"]; + 101 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 102 [label="Access variable R|/y|"]; + 103 [label="Assignment: R|/x|"]; + 104 [label="Access variable R|/x|"]; + 105 [label="Function call: R|/x|.#()"]; + subgraph cluster_24 { + color=blue + 106 [label="Enter when"]; + subgraph cluster_25 { + color=blue + 107 [label="Enter when branch condition "]; + 108 [label="Access variable R|/y|"]; + 109 [label="Type operator: (R|/y| is R|A|)"]; + 110 [label="Exit when branch condition"]; + } + 111 [label="Synthetic else branch"]; + 112 [label="Enter when branch result"]; + subgraph cluster_26 { + color=blue + 113 [label="Enter block"]; + 114 [label="Access variable R|/x|"]; + 115 [label="Smart cast: R|/x|"]; + 116 [label="Function call: R|/x|.R|/A.foo|()"]; + 117 [label="Access variable R|/y|"]; + 118 [label="Smart cast: R|/y|"]; + 119 [label="Function call: R|/y|.R|/A.foo|()"]; + 120 [label="Exit block"]; + } + 121 [label="Exit when branch result"]; + 122 [label="Exit when"]; + } + 123 [label="Exit block"]; + } + 124 [label="Exit function test_4" style="filled" fillcolor=red]; + } 93 -> {94}; 94 -> {95}; 95 -> {96}; @@ -301,137 +311,116 @@ digraph boundSmartcasts_kt { 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {104 103}; - 103 -> {112}; + 102 -> {103}; + 103 -> {104}; 104 -> {105}; 105 -> {106}; 106 -> {107}; 107 -> {108}; 108 -> {109}; 109 -> {110}; - 110 -> {111}; - 111 -> {112}; + 110 -> {112 111}; + 111 -> {122}; 112 -> {113}; 113 -> {114}; + 114 -> {115}; + 115 -> {116}; + 116 -> {117}; + 117 -> {118}; + 118 -> {119}; + 119 -> {120}; + 120 -> {121}; + 121 -> {122}; + 122 -> {123}; + 123 -> {124}; subgraph cluster_27 { color=red - 115 [label="Enter function " style="filled" fillcolor=red]; - 116 [label="Delegated constructor call: super()"]; - 117 [label="Exit function " style="filled" fillcolor=red]; + 125 [label="Enter function " style="filled" fillcolor=red]; + 126 [label="Delegated constructor call: super()"]; + 127 [label="Exit function " style="filled" fillcolor=red]; } - 115 -> {116}; - 116 -> {117}; - - subgraph cluster_28 { - color=red - 118 [label="Enter property" style="filled" fillcolor=red]; - 119 [label="Access variable R|/any|"]; - 120 [label="Exit property" style="filled" fillcolor=red]; - } - 118 -> {119}; - 119 -> {120}; - 120 -> {123} [color=green]; - - subgraph cluster_29 { - color=red - 121 [label="Enter class D" style="filled" fillcolor=red]; - 122 [label="Part of class initialization"]; - 123 [label="Exit class D" style="filled" fillcolor=red]; - } - 121 -> {122} [color=green]; - 122 -> {123} [style=dotted]; - 122 -> {118} [color=green]; - 122 -> {118} [style=dashed]; - - subgraph cluster_30 { - color=red - 124 [label="Enter function baz" style="filled" fillcolor=red]; - subgraph cluster_31 { - color=blue - 125 [label="Enter block"]; - 126 [label="Exit block"]; - } - 127 [label="Exit function baz" style="filled" fillcolor=red]; - } - 124 -> {125}; 125 -> {126}; 126 -> {127}; - subgraph cluster_32 { + subgraph cluster_28 { color=red - 128 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_33 { - color=blue - 129 [label="Enter block"]; - 130 [label="Access variable R|/d|"]; - 131 [label="Access variable R|/D.any|"]; - 132 [label="Exit lhs of ?:"]; - 133 [label="Enter rhs of ?:"]; - 134 [label="Jump: ^test_5 Unit"]; - 135 [label="Stub" style="filled" fillcolor=gray]; - 136 [label="Lhs of ?: is not null"]; - 137 [label="Exit ?:"]; - 138 [label="Variable declaration: lval a: R|kotlin/Any|"]; - 139 [label="Access variable R|/a|"]; - 140 [label="Function call: R|/a|.R|/baz|()"]; - 141 [label="Access variable R|/d|"]; - 142 [label="Access variable R|/D.any|"]; - 143 [label="Function call: R|/d|.R|/D.any|.R|/baz|()"]; - 144 [label="Access variable R|/a|"]; - 145 [label="Type operator: (R|/a| as R|A|)"]; - 146 [label="Access variable R|/a|"]; - 147 [label="Function call: R|/a|.R|/A.foo|()"]; - 148 [label="Exit block"]; - } - 149 [label="Exit function test_5" style="filled" fillcolor=red]; + 128 [label="Enter property" style="filled" fillcolor=red]; + 129 [label="Access variable R|/any|"]; + 130 [label="Exit property" style="filled" fillcolor=red]; } 128 -> {129}; 129 -> {130}; - 130 -> {131}; - 131 -> {132}; - 132 -> {136 133}; - 133 -> {134}; - 134 -> {149}; - 134 -> {135} [style=dotted]; - 135 -> {137} [style=dotted]; + 130 -> {133} [color=green]; + + subgraph cluster_29 { + color=red + 131 [label="Enter class D" style="filled" fillcolor=red]; + 132 [label="Part of class initialization"]; + 133 [label="Exit class D" style="filled" fillcolor=red]; + } + 131 -> {132} [color=green]; + 132 -> {133} [style=dotted]; + 132 -> {128} [color=green]; + 132 -> {128} [style=dashed]; + + subgraph cluster_30 { + color=red + 134 [label="Enter function baz" style="filled" fillcolor=red]; + subgraph cluster_31 { + color=blue + 135 [label="Enter block"]; + 136 [label="Exit block"]; + } + 137 [label="Exit function baz" style="filled" fillcolor=red]; + } + 134 -> {135}; + 135 -> {136}; 136 -> {137}; - 137 -> {138}; + + subgraph cluster_32 { + color=red + 138 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_33 { + color=blue + 139 [label="Enter block"]; + 140 [label="Access variable R|/d|"]; + 141 [label="Access variable R|/D.any|"]; + 142 [label="Exit lhs of ?:"]; + 143 [label="Enter rhs of ?:"]; + 144 [label="Jump: ^test_5 Unit"]; + 145 [label="Stub" style="filled" fillcolor=gray]; + 146 [label="Lhs of ?: is not null"]; + 147 [label="Exit ?:"]; + 148 [label="Variable declaration: lval a: R|kotlin/Any|"]; + 149 [label="Access variable R|/a|"]; + 150 [label="Function call: R|/a|.R|/baz|()"]; + 151 [label="Access variable R|/d|"]; + 152 [label="Access variable R|/D.any|"]; + 153 [label="Smart cast: R|/d|.R|/D.any|"]; + 154 [label="Function call: R|/d|.R|/D.any|.R|/baz|()"]; + 155 [label="Access variable R|/a|"]; + 156 [label="Type operator: (R|/a| as R|A|)"]; + 157 [label="Access variable R|/a|"]; + 158 [label="Smart cast: R|/a|"]; + 159 [label="Function call: R|/a|.R|/A.foo|()"]; + 160 [label="Exit block"]; + } + 161 [label="Exit function test_5" style="filled" fillcolor=red]; + } 138 -> {139}; 139 -> {140}; 140 -> {141}; 141 -> {142}; - 142 -> {143}; + 142 -> {146 143}; 143 -> {144}; - 144 -> {145}; - 145 -> {146}; + 144 -> {161}; + 144 -> {145} [style=dotted]; + 145 -> {147} [style=dotted]; 146 -> {147}; 147 -> {148}; 148 -> {149}; - - subgraph cluster_34 { - color=red - 150 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_35 { - color=blue - 151 [label="Enter block"]; - 152 [label="Access variable R|/d1|"]; - 153 [label="Access variable R|/D.any|"]; - 154 [label="Variable declaration: lval a: R|kotlin/Any?|"]; - 155 [label="Access variable R|/a|"]; - 156 [label="Type operator: (R|/a| as R|A|)"]; - 157 [label="Access variable R|/a|"]; - 158 [label="Function call: R|/a|.R|/A.foo|()"]; - 159 [label="Access variable R|/d1|"]; - 160 [label="Access variable R|/D.any|"]; - 161 [label="Function call: R|/d1|.R|/D.any|.R|/A.foo|()"]; - 162 [label="Access variable R|/d1|"]; - 163 [label="Access variable R|/D.any|"]; - 164 [label="Function call: R|/d1|.R|/D.any|.R|/baz|()"]; - 165 [label="Exit block"]; - } - 166 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 149 -> {150}; 150 -> {151}; 151 -> {152}; 152 -> {153}; @@ -443,60 +432,105 @@ digraph boundSmartcasts_kt { 158 -> {159}; 159 -> {160}; 160 -> {161}; - 161 -> {162}; + + subgraph cluster_34 { + color=red + 162 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_35 { + color=blue + 163 [label="Enter block"]; + 164 [label="Access variable R|/d1|"]; + 165 [label="Access variable R|/D.any|"]; + 166 [label="Variable declaration: lval a: R|kotlin/Any?|"]; + 167 [label="Access variable R|/a|"]; + 168 [label="Type operator: (R|/a| as R|A|)"]; + 169 [label="Access variable R|/a|"]; + 170 [label="Smart cast: R|/a|"]; + 171 [label="Function call: R|/a|.R|/A.foo|()"]; + 172 [label="Access variable R|/d1|"]; + 173 [label="Access variable R|/D.any|"]; + 174 [label="Smart cast: R|/d1|.R|/D.any|"]; + 175 [label="Function call: R|/d1|.R|/D.any|.R|/A.foo|()"]; + 176 [label="Access variable R|/d1|"]; + 177 [label="Access variable R|/D.any|"]; + 178 [label="Smart cast: R|/d1|.R|/D.any|"]; + 179 [label="Function call: R|/d1|.R|/D.any|.R|/baz|()"]; + 180 [label="Exit block"]; + } + 181 [label="Exit function test_6" style="filled" fillcolor=red]; + } 162 -> {163}; 163 -> {164}; 164 -> {165}; 165 -> {166}; - - subgraph cluster_36 { - color=red - 167 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_37 { - color=blue - 168 [label="Enter block"]; - 169 [label="Access variable R|/d1|"]; - 170 [label="Enter safe call"]; - 171 [label="Access variable R|/D.any|"]; - 172 [label="Exit safe call"]; - 173 [label="Variable declaration: lval a: R|kotlin/Any?|"]; - 174 [label="Access variable R|/d2|"]; - 175 [label="Enter safe call"]; - 176 [label="Access variable R|/D.any|"]; - 177 [label="Exit safe call"]; - 178 [label="Variable declaration: lval b: R|kotlin/Any?|"]; - 179 [label="Access variable R|/a|"]; - 180 [label="Type operator: (R|/a| as R|A|)"]; - 181 [label="Access variable R|/a|"]; - 182 [label="Function call: R|/a|.R|/A.foo|()"]; - 183 [label="Access variable R|/b|"]; - 184 [label="Type operator: (R|/b| as R|B|)"]; - 185 [label="Access variable R|/b|"]; - 186 [label="Function call: R|/b|.R|/B.bar|()"]; - 187 [label="Exit block"]; - } - 188 [label="Exit function test_7" style="filled" fillcolor=red]; - } + 166 -> {167}; 167 -> {168}; 168 -> {169}; - 169 -> {170 172}; + 169 -> {170}; 170 -> {171}; 171 -> {172}; 172 -> {173}; 173 -> {174}; - 174 -> {175 177}; + 174 -> {175}; 175 -> {176}; 176 -> {177}; 177 -> {178}; 178 -> {179}; 179 -> {180}; 180 -> {181}; - 181 -> {182}; + + subgraph cluster_36 { + color=red + 182 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_37 { + color=blue + 183 [label="Enter block"]; + 184 [label="Access variable R|/d1|"]; + 185 [label="Enter safe call"]; + 186 [label="Access variable R|/D.any|"]; + 187 [label="Exit safe call"]; + 188 [label="Variable declaration: lval a: R|kotlin/Any?|"]; + 189 [label="Access variable R|/d2|"]; + 190 [label="Enter safe call"]; + 191 [label="Access variable R|/D.any|"]; + 192 [label="Exit safe call"]; + 193 [label="Variable declaration: lval b: R|kotlin/Any?|"]; + 194 [label="Access variable R|/a|"]; + 195 [label="Type operator: (R|/a| as R|A|)"]; + 196 [label="Access variable R|/a|"]; + 197 [label="Smart cast: R|/a|"]; + 198 [label="Function call: R|/a|.R|/A.foo|()"]; + 199 [label="Access variable R|/b|"]; + 200 [label="Type operator: (R|/b| as R|B|)"]; + 201 [label="Access variable R|/b|"]; + 202 [label="Smart cast: R|/b|"]; + 203 [label="Function call: R|/b|.R|/B.bar|()"]; + 204 [label="Exit block"]; + } + 205 [label="Exit function test_7" style="filled" fillcolor=red]; + } 182 -> {183}; 183 -> {184}; - 184 -> {185}; + 184 -> {185 187}; 185 -> {186}; 186 -> {187}; 187 -> {188}; + 188 -> {189}; + 189 -> {190 192}; + 190 -> {191}; + 191 -> {192}; + 192 -> {193}; + 193 -> {194}; + 194 -> {195}; + 195 -> {196}; + 196 -> {197}; + 197 -> {198}; + 198 -> {199}; + 199 -> {200}; + 200 -> {201}; + 201 -> {202}; + 202 -> {203}; + 203 -> {204}; + 204 -> {205}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot index d32a8f5f26f..0cce71a1bd9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot @@ -92,18 +92,19 @@ digraph boundSmartcastsInBranches_kt { 42 [label="Exit when"]; } 43 [label="Access variable R|/goodA|"]; - 44 [label="Access variable R|/A.s|"]; - 45 [label="Exit block"]; + 44 [label="Smart cast: R|/goodA|"]; + 45 [label="Access variable R|/A.s|"]; + 46 [label="Exit block"]; } - 46 [label="Exit loop block"]; + 47 [label="Exit loop block"]; } - 47 [label="Exit whileloop"]; + 48 [label="Exit whileloop"]; } - 48 [label="Exit block"]; + 49 [label="Exit block"]; } - 49 [label="Exit block"]; + 50 [label="Exit block"]; } - 50 [label="Exit function test_0" style="filled" fillcolor=red]; + 51 [label="Exit function test_0" style="filled" fillcolor=red]; } 9 -> {10}; 10 -> {11}; @@ -117,7 +118,7 @@ digraph boundSmartcastsInBranches_kt { 18 -> {19}; 19 -> {20}; 20 -> {21}; - 21 -> {47 22}; + 21 -> {48 22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; @@ -143,74 +144,75 @@ digraph boundSmartcastsInBranches_kt { 43 -> {44}; 44 -> {45}; 45 -> {46}; - 46 -> {18} [color=green style=dashed]; - 47 -> {48}; + 46 -> {47}; + 47 -> {18} [color=green style=dashed]; 48 -> {49}; 49 -> {50}; + 50 -> {51}; subgraph cluster_13 { color=red - 51 [label="Enter function test_1" style="filled" fillcolor=red]; + 52 [label="Enter function test_1" style="filled" fillcolor=red]; subgraph cluster_14 { color=blue - 52 [label="Enter block"]; - 53 [label="Variable declaration: lval x: R|kotlin/Any|"]; + 53 [label="Enter block"]; + 54 [label="Variable declaration: lval x: R|kotlin/Any|"]; subgraph cluster_15 { color=blue - 54 [label="Enter when"]; + 55 [label="Enter when"]; subgraph cluster_16 { color=blue - 55 [label="Enter when branch condition "]; - 56 [label="Access variable R|/b|"]; - 57 [label="Exit when branch condition"]; + 56 [label="Enter when branch condition "]; + 57 [label="Access variable R|/b|"]; + 58 [label="Exit when branch condition"]; } subgraph cluster_17 { color=blue - 58 [label="Enter when branch condition else"]; - 59 [label="Exit when branch condition"]; + 59 [label="Enter when branch condition else"]; + 60 [label="Exit when branch condition"]; } - 60 [label="Enter when branch result"]; + 61 [label="Enter when branch result"]; subgraph cluster_18 { color=blue - 61 [label="Enter block"]; - 62 [label="Access variable R|/a|"]; - 63 [label="Assignment: R|/x|"]; - 64 [label="Exit block"]; + 62 [label="Enter block"]; + 63 [label="Access variable R|/a|"]; + 64 [label="Assignment: R|/x|"]; + 65 [label="Exit block"]; } - 65 [label="Exit when branch result"]; - 66 [label="Enter when branch result"]; + 66 [label="Exit when branch result"]; + 67 [label="Enter when branch result"]; subgraph cluster_19 { color=blue - 67 [label="Enter block"]; - 68 [label="Function call: R|/A.A|()"]; - 69 [label="Assignment: R|/x|"]; - 70 [label="Exit block"]; + 68 [label="Enter block"]; + 69 [label="Function call: R|/A.A|()"]; + 70 [label="Assignment: R|/x|"]; + 71 [label="Exit block"]; } - 71 [label="Exit when branch result"]; - 72 [label="Exit when"]; + 72 [label="Exit when branch result"]; + 73 [label="Exit when"]; } - 73 [label="Access variable R|/x|"]; - 74 [label="Access variable R|/A.s|"]; - 75 [label="Exit block"]; + 74 [label="Access variable R|/x|"]; + 75 [label="Smart cast: R|/x|"]; + 76 [label="Access variable R|/A.s|"]; + 77 [label="Exit block"]; } - 76 [label="Exit function test_1" style="filled" fillcolor=red]; + 78 [label="Exit function test_1" style="filled" fillcolor=red]; } - 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; - 57 -> {66 58}; - 58 -> {59}; + 57 -> {58}; + 58 -> {67 59}; 59 -> {60}; 60 -> {61}; 61 -> {62}; 62 -> {63}; 63 -> {64}; 64 -> {65}; - 65 -> {72}; - 66 -> {67}; + 65 -> {66}; + 66 -> {73}; 67 -> {68}; 68 -> {69}; 69 -> {70}; @@ -220,65 +222,66 @@ digraph boundSmartcastsInBranches_kt { 73 -> {74}; 74 -> {75}; 75 -> {76}; + 76 -> {77}; + 77 -> {78}; subgraph cluster_20 { color=red - 77 [label="Enter function test_2" style="filled" fillcolor=red]; + 79 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 78 [label="Enter block"]; - 79 [label="Variable declaration: lval x: R|kotlin/Any|"]; + 80 [label="Enter block"]; + 81 [label="Variable declaration: lval x: R|kotlin/Any|"]; subgraph cluster_22 { color=blue - 80 [label="Enter when"]; + 82 [label="Enter when"]; subgraph cluster_23 { color=blue - 81 [label="Enter when branch condition "]; - 82 [label="Access variable R|/b|"]; - 83 [label="Exit when branch condition"]; + 83 [label="Enter when branch condition "]; + 84 [label="Access variable R|/b|"]; + 85 [label="Exit when branch condition"]; } subgraph cluster_24 { color=blue - 84 [label="Enter when branch condition else"]; - 85 [label="Exit when branch condition"]; + 86 [label="Enter when branch condition else"]; + 87 [label="Exit when branch condition"]; } - 86 [label="Enter when branch result"]; + 88 [label="Enter when branch result"]; subgraph cluster_25 { color=blue - 87 [label="Enter block"]; - 88 [label="Access variable R|/a|"]; - 89 [label="Assignment: R|/x|"]; + 89 [label="Enter block"]; 90 [label="Access variable R|/a|"]; - 91 [label="Type operator: (R|/a| as R|A|)"]; - 92 [label="Exit block"]; + 91 [label="Assignment: R|/x|"]; + 92 [label="Access variable R|/a|"]; + 93 [label="Type operator: (R|/a| as R|A|)"]; + 94 [label="Exit block"]; } - 93 [label="Exit when branch result"]; - 94 [label="Enter when branch result"]; + 95 [label="Exit when branch result"]; + 96 [label="Enter when branch result"]; subgraph cluster_26 { color=blue - 95 [label="Enter block"]; - 96 [label="Function call: R|/A.A|()"]; - 97 [label="Assignment: R|/x|"]; - 98 [label="Exit block"]; + 97 [label="Enter block"]; + 98 [label="Function call: R|/A.A|()"]; + 99 [label="Assignment: R|/x|"]; + 100 [label="Exit block"]; } - 99 [label="Exit when branch result"]; - 100 [label="Exit when"]; + 101 [label="Exit when branch result"]; + 102 [label="Exit when"]; } - 101 [label="Access variable R|/x|"]; - 102 [label="Access variable R|/A.s|"]; - 103 [label="Exit block"]; + 103 [label="Access variable R|/x|"]; + 104 [label="Smart cast: R|/x|"]; + 105 [label="Access variable R|/A.s|"]; + 106 [label="Exit block"]; } - 104 [label="Exit function test_2" style="filled" fillcolor=red]; + 107 [label="Exit function test_2" style="filled" fillcolor=red]; } - 77 -> {78}; - 78 -> {79}; 79 -> {80}; 80 -> {81}; 81 -> {82}; 82 -> {83}; - 83 -> {94 84}; + 83 -> {84}; 84 -> {85}; - 85 -> {86}; + 85 -> {96 86}; 86 -> {87}; 87 -> {88}; 88 -> {89}; @@ -286,9 +289,9 @@ digraph boundSmartcastsInBranches_kt { 90 -> {91}; 91 -> {92}; 92 -> {93}; - 93 -> {100}; + 93 -> {94}; 94 -> {95}; - 95 -> {96}; + 95 -> {102}; 96 -> {97}; 97 -> {98}; 98 -> {99}; @@ -297,155 +300,159 @@ digraph boundSmartcastsInBranches_kt { 101 -> {102}; 102 -> {103}; 103 -> {104}; + 104 -> {105}; + 105 -> {106}; + 106 -> {107}; subgraph cluster_27 { color=red - 105 [label="Enter function test_3" style="filled" fillcolor=red]; + 108 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_28 { color=blue - 106 [label="Enter block"]; - 107 [label="Variable declaration: lval x: R|kotlin/Any|"]; + 109 [label="Enter block"]; + 110 [label="Variable declaration: lval x: R|kotlin/Any|"]; subgraph cluster_29 { color=blue - 108 [label="Enter when"]; + 111 [label="Enter when"]; subgraph cluster_30 { color=blue - 109 [label="Enter when branch condition "]; - 110 [label="Access variable R|/b|"]; - 111 [label="Exit when branch condition"]; + 112 [label="Enter when branch condition "]; + 113 [label="Access variable R|/b|"]; + 114 [label="Exit when branch condition"]; } subgraph cluster_31 { color=blue - 112 [label="Enter when branch condition else"]; - 113 [label="Exit when branch condition"]; + 115 [label="Enter when branch condition else"]; + 116 [label="Exit when branch condition"]; } - 114 [label="Enter when branch result"]; + 117 [label="Enter when branch result"]; subgraph cluster_32 { color=blue - 115 [label="Enter block"]; - 116 [label="Access variable R|/a|"]; - 117 [label="Type operator: (R|/a| as R|A|)"]; - 118 [label="Access variable R|/a|"]; - 119 [label="Assignment: R|/x|"]; - 120 [label="Exit block"]; + 118 [label="Enter block"]; + 119 [label="Access variable R|/a|"]; + 120 [label="Type operator: (R|/a| as R|A|)"]; + 121 [label="Access variable R|/a|"]; + 122 [label="Smart cast: R|/a|"]; + 123 [label="Assignment: R|/x|"]; + 124 [label="Exit block"]; } - 121 [label="Exit when branch result"]; - 122 [label="Enter when branch result"]; + 125 [label="Exit when branch result"]; + 126 [label="Enter when branch result"]; subgraph cluster_33 { color=blue - 123 [label="Enter block"]; - 124 [label="Function call: R|/A.A|()"]; - 125 [label="Assignment: R|/x|"]; - 126 [label="Exit block"]; + 127 [label="Enter block"]; + 128 [label="Function call: R|/A.A|()"]; + 129 [label="Assignment: R|/x|"]; + 130 [label="Exit block"]; } - 127 [label="Exit when branch result"]; - 128 [label="Exit when"]; + 131 [label="Exit when branch result"]; + 132 [label="Exit when"]; } - 129 [label="Access variable R|/x|"]; - 130 [label="Access variable R|/A.s|"]; - 131 [label="Exit block"]; + 133 [label="Access variable R|/x|"]; + 134 [label="Smart cast: R|/x|"]; + 135 [label="Access variable R|/A.s|"]; + 136 [label="Exit block"]; } - 132 [label="Exit function test_3" style="filled" fillcolor=red]; + 137 [label="Exit function test_3" style="filled" fillcolor=red]; } - 105 -> {106}; - 106 -> {107}; - 107 -> {108}; 108 -> {109}; 109 -> {110}; 110 -> {111}; - 111 -> {122 112}; + 111 -> {112}; 112 -> {113}; 113 -> {114}; - 114 -> {115}; + 114 -> {126 115}; 115 -> {116}; 116 -> {117}; 117 -> {118}; 118 -> {119}; 119 -> {120}; 120 -> {121}; - 121 -> {128}; + 121 -> {122}; 122 -> {123}; 123 -> {124}; 124 -> {125}; - 125 -> {126}; + 125 -> {132}; 126 -> {127}; 127 -> {128}; 128 -> {129}; 129 -> {130}; 130 -> {131}; 131 -> {132}; - - subgraph cluster_34 { - color=red - 133 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_35 { - color=blue - 134 [label="Enter block"]; - 135 [label="Variable declaration: lval x: R|kotlin/Any|"]; - subgraph cluster_36 { - color=blue - 136 [label="Enter when"]; - subgraph cluster_37 { - color=blue - 137 [label="Enter when branch condition "]; - 138 [label="Access variable R|/b|"]; - 139 [label="Exit when branch condition"]; - } - subgraph cluster_38 { - color=blue - 140 [label="Enter when branch condition else"]; - 141 [label="Exit when branch condition"]; - } - 142 [label="Enter when branch result"]; - subgraph cluster_39 { - color=blue - 143 [label="Enter block"]; - 144 [label="Access variable R|/a|"]; - 145 [label="Assignment: R|/x|"]; - 146 [label="Exit block"]; - } - 147 [label="Exit when branch result"]; - 148 [label="Enter when branch result"]; - subgraph cluster_40 { - color=blue - 149 [label="Enter block"]; - 150 [label="Access variable R|/a|"]; - 151 [label="Assignment: R|/x|"]; - 152 [label="Exit block"]; - } - 153 [label="Exit when branch result"]; - 154 [label="Exit when"]; - } - 155 [label="Access variable R|/x|"]; - 156 [label="Type operator: (R|/x| as R|A|)"]; - 157 [label="Access variable R|/x|"]; - 158 [label="Access variable R|/A.s|"]; - 159 [label="Access variable R|/a|"]; - 160 [label="Access variable R|/A.s|"]; - 161 [label="Exit block"]; - } - 162 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 132 -> {133}; 133 -> {134}; 134 -> {135}; 135 -> {136}; 136 -> {137}; - 137 -> {138}; + + subgraph cluster_34 { + color=red + 138 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_35 { + color=blue + 139 [label="Enter block"]; + 140 [label="Variable declaration: lval x: R|kotlin/Any|"]; + subgraph cluster_36 { + color=blue + 141 [label="Enter when"]; + subgraph cluster_37 { + color=blue + 142 [label="Enter when branch condition "]; + 143 [label="Access variable R|/b|"]; + 144 [label="Exit when branch condition"]; + } + subgraph cluster_38 { + color=blue + 145 [label="Enter when branch condition else"]; + 146 [label="Exit when branch condition"]; + } + 147 [label="Enter when branch result"]; + subgraph cluster_39 { + color=blue + 148 [label="Enter block"]; + 149 [label="Access variable R|/a|"]; + 150 [label="Assignment: R|/x|"]; + 151 [label="Exit block"]; + } + 152 [label="Exit when branch result"]; + 153 [label="Enter when branch result"]; + subgraph cluster_40 { + color=blue + 154 [label="Enter block"]; + 155 [label="Access variable R|/a|"]; + 156 [label="Assignment: R|/x|"]; + 157 [label="Exit block"]; + } + 158 [label="Exit when branch result"]; + 159 [label="Exit when"]; + } + 160 [label="Access variable R|/x|"]; + 161 [label="Type operator: (R|/x| as R|A|)"]; + 162 [label="Access variable R|/x|"]; + 163 [label="Smart cast: R|/x|"]; + 164 [label="Access variable R|/A.s|"]; + 165 [label="Access variable R|/a|"]; + 166 [label="Smart cast: R|/a|"]; + 167 [label="Access variable R|/A.s|"]; + 168 [label="Exit block"]; + } + 169 [label="Exit function test_4" style="filled" fillcolor=red]; + } 138 -> {139}; - 139 -> {148 140}; + 139 -> {140}; 140 -> {141}; 141 -> {142}; 142 -> {143}; 143 -> {144}; - 144 -> {145}; + 144 -> {153 145}; 145 -> {146}; 146 -> {147}; - 147 -> {154}; + 147 -> {148}; 148 -> {149}; 149 -> {150}; 150 -> {151}; 151 -> {152}; - 152 -> {153}; + 152 -> {159}; 153 -> {154}; 154 -> {155}; 155 -> {156}; @@ -455,80 +462,82 @@ digraph boundSmartcastsInBranches_kt { 159 -> {160}; 160 -> {161}; 161 -> {162}; - - subgraph cluster_41 { - color=red - 163 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_42 { - color=blue - 164 [label="Enter block"]; - 165 [label="Variable declaration: lval x: R|kotlin/Any|"]; - subgraph cluster_43 { - color=blue - 166 [label="Enter when"]; - subgraph cluster_44 { - color=blue - 167 [label="Enter when branch condition "]; - 168 [label="Access variable R|/b|"]; - 169 [label="Exit when branch condition"]; - } - subgraph cluster_45 { - color=blue - 170 [label="Enter when branch condition else"]; - 171 [label="Exit when branch condition"]; - } - 172 [label="Enter when branch result"]; - subgraph cluster_46 { - color=blue - 173 [label="Enter block"]; - 174 [label="Access variable R|/a|"]; - 175 [label="Assignment: R|/x|"]; - 176 [label="Exit block"]; - } - 177 [label="Exit when branch result"]; - 178 [label="Enter when branch result"]; - subgraph cluster_47 { - color=blue - 179 [label="Enter block"]; - 180 [label="Access variable R|/a|"]; - 181 [label="Assignment: R|/x|"]; - 182 [label="Exit block"]; - } - 183 [label="Exit when branch result"]; - 184 [label="Exit when"]; - } - 185 [label="Access variable R|/a|"]; - 186 [label="Type operator: (R|/a| as R|A|)"]; - 187 [label="Access variable R|/x|"]; - 188 [label="Access variable R|/A.s|"]; - 189 [label="Access variable R|/a|"]; - 190 [label="Access variable R|/A.s|"]; - 191 [label="Exit block"]; - } - 192 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 162 -> {163}; 163 -> {164}; 164 -> {165}; 165 -> {166}; 166 -> {167}; 167 -> {168}; 168 -> {169}; - 169 -> {178 170}; + + subgraph cluster_41 { + color=red + 170 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_42 { + color=blue + 171 [label="Enter block"]; + 172 [label="Variable declaration: lval x: R|kotlin/Any|"]; + subgraph cluster_43 { + color=blue + 173 [label="Enter when"]; + subgraph cluster_44 { + color=blue + 174 [label="Enter when branch condition "]; + 175 [label="Access variable R|/b|"]; + 176 [label="Exit when branch condition"]; + } + subgraph cluster_45 { + color=blue + 177 [label="Enter when branch condition else"]; + 178 [label="Exit when branch condition"]; + } + 179 [label="Enter when branch result"]; + subgraph cluster_46 { + color=blue + 180 [label="Enter block"]; + 181 [label="Access variable R|/a|"]; + 182 [label="Assignment: R|/x|"]; + 183 [label="Exit block"]; + } + 184 [label="Exit when branch result"]; + 185 [label="Enter when branch result"]; + subgraph cluster_47 { + color=blue + 186 [label="Enter block"]; + 187 [label="Access variable R|/a|"]; + 188 [label="Assignment: R|/x|"]; + 189 [label="Exit block"]; + } + 190 [label="Exit when branch result"]; + 191 [label="Exit when"]; + } + 192 [label="Access variable R|/a|"]; + 193 [label="Type operator: (R|/a| as R|A|)"]; + 194 [label="Access variable R|/x|"]; + 195 [label="Smart cast: R|/x|"]; + 196 [label="Access variable R|/A.s|"]; + 197 [label="Access variable R|/a|"]; + 198 [label="Smart cast: R|/a|"]; + 199 [label="Access variable R|/A.s|"]; + 200 [label="Exit block"]; + } + 201 [label="Exit function test_5" style="filled" fillcolor=red]; + } 170 -> {171}; 171 -> {172}; 172 -> {173}; 173 -> {174}; 174 -> {175}; 175 -> {176}; - 176 -> {177}; - 177 -> {184}; + 176 -> {185 177}; + 177 -> {178}; 178 -> {179}; 179 -> {180}; 180 -> {181}; 181 -> {182}; 182 -> {183}; 183 -> {184}; - 184 -> {185}; + 184 -> {191}; 185 -> {186}; 186 -> {187}; 187 -> {188}; @@ -536,22 +545,7 @@ digraph boundSmartcastsInBranches_kt { 189 -> {190}; 190 -> {191}; 191 -> {192}; - - subgraph cluster_48 { - color=red - 193 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_49 { - color=blue - 194 [label="Enter block"]; - 195 [label="Variable declaration: lval x: R|kotlin/Any|"]; - 196 [label="Access variable R|/a|"]; - 197 [label="Assignment: R|/x|"]; - 198 [label="Access variable R|/x|"]; - 199 [label="Access variable R|/A.s|"]; - 200 [label="Exit block"]; - } - 201 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 192 -> {193}; 193 -> {194}; 194 -> {195}; 195 -> {196}; @@ -561,186 +555,21 @@ digraph boundSmartcastsInBranches_kt { 199 -> {200}; 200 -> {201}; - subgraph cluster_50 { + subgraph cluster_48 { color=red - 202 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_51 { + 202 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_49 { color=blue 203 [label="Enter block"]; - 204 [label="Const: Null(null)"]; - 205 [label="Variable declaration: lval z: R|kotlin/String?|"]; - 206 [label="Access variable R|/z|"]; - 207 [label="Variable declaration: lvar y: R|kotlin/String?|"]; - 208 [label="Access variable R|/y|"]; - 209 [label="Variable declaration: lval x: R|kotlin/String?|"]; - subgraph cluster_52 { - color=blue - 210 [label="Enter when"]; - subgraph cluster_53 { - color=blue - 211 [label="Enter when branch condition "]; - 212 [label="Access variable R|/x|"]; - 213 [label="Const: Null(null)"]; - 214 [label="Equality operator !="]; - 215 [label="Exit when branch condition"]; - } - 216 [label="Synthetic else branch"]; - 217 [label="Enter when branch result"]; - subgraph cluster_54 { - color=blue - 218 [label="Enter block"]; - 219 [label="Access variable R|/x|"]; - 220 [label="Access variable R|kotlin/String.length|"]; - 221 [label="Access variable R|/y|"]; - 222 [label="Access variable #"]; - 223 [label="Access variable R|/z|"]; - 224 [label="Access variable #"]; - 225 [label="Exit block"]; - } - 226 [label="Exit when branch result"]; - 227 [label="Exit when"]; - } - subgraph cluster_55 { - color=blue - 228 [label="Enter when"]; - subgraph cluster_56 { - color=blue - 229 [label="Enter when branch condition "]; - 230 [label="Access variable R|/y|"]; - 231 [label="Const: Null(null)"]; - 232 [label="Equality operator !="]; - 233 [label="Exit when branch condition"]; - } - 234 [label="Synthetic else branch"]; - 235 [label="Enter when branch result"]; - subgraph cluster_57 { - color=blue - 236 [label="Enter block"]; - 237 [label="Access variable R|/x|"]; - 238 [label="Access variable #"]; - 239 [label="Access variable R|/y|"]; - 240 [label="Access variable R|kotlin/String.length|"]; - 241 [label="Access variable R|/z|"]; - 242 [label="Access variable #"]; - 243 [label="Exit block"]; - } - 244 [label="Exit when branch result"]; - 245 [label="Exit when"]; - } - subgraph cluster_58 { - color=blue - 246 [label="Enter when"]; - subgraph cluster_59 { - color=blue - 247 [label="Enter when branch condition "]; - 248 [label="Access variable R|/z|"]; - 249 [label="Const: Null(null)"]; - 250 [label="Equality operator !="]; - 251 [label="Exit when branch condition"]; - } - 252 [label="Synthetic else branch"]; - 253 [label="Enter when branch result"]; - subgraph cluster_60 { - color=blue - 254 [label="Enter block"]; - 255 [label="Access variable R|/x|"]; - 256 [label="Access variable #"]; - 257 [label="Access variable R|/y|"]; - 258 [label="Access variable #"]; - 259 [label="Access variable R|/z|"]; - 260 [label="Access variable R|kotlin/String.length|"]; - 261 [label="Exit block"]; - } - 262 [label="Exit when branch result"]; - 263 [label="Exit when"]; - } - 264 [label="Const: Null(null)"]; - 265 [label="Assignment: R|/y|"]; - subgraph cluster_61 { - color=blue - 266 [label="Enter when"]; - subgraph cluster_62 { - color=blue - 267 [label="Enter when branch condition "]; - 268 [label="Access variable R|/x|"]; - 269 [label="Const: Null(null)"]; - 270 [label="Equality operator !="]; - 271 [label="Exit when branch condition"]; - } - 272 [label="Synthetic else branch"]; - 273 [label="Enter when branch result"]; - subgraph cluster_63 { - color=blue - 274 [label="Enter block"]; - 275 [label="Access variable R|/x|"]; - 276 [label="Access variable R|kotlin/String.length|"]; - 277 [label="Access variable R|/y|"]; - 278 [label="Access variable #"]; - 279 [label="Access variable R|/z|"]; - 280 [label="Access variable #"]; - 281 [label="Exit block"]; - } - 282 [label="Exit when branch result"]; - 283 [label="Exit when"]; - } - subgraph cluster_64 { - color=blue - 284 [label="Enter when"]; - subgraph cluster_65 { - color=blue - 285 [label="Enter when branch condition "]; - 286 [label="Access variable R|/y|"]; - 287 [label="Const: Null(null)"]; - 288 [label="Equality operator !="]; - 289 [label="Exit when branch condition"]; - } - 290 [label="Synthetic else branch"]; - 291 [label="Enter when branch result"]; - subgraph cluster_66 { - color=blue - 292 [label="Enter block"]; - 293 [label="Access variable R|/x|"]; - 294 [label="Access variable #"]; - 295 [label="Access variable R|/y|"]; - 296 [label="Stub" style="filled" fillcolor=gray]; - 297 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray]; - 298 [label="Access variable R|/z|" style="filled" fillcolor=gray]; - 299 [label="Access variable #" style="filled" fillcolor=gray]; - 300 [label="Exit block" style="filled" fillcolor=gray]; - } - 301 [label="Exit when branch result" style="filled" fillcolor=gray]; - 302 [label="Exit when"]; - } - subgraph cluster_67 { - color=blue - 303 [label="Enter when"]; - subgraph cluster_68 { - color=blue - 304 [label="Enter when branch condition "]; - 305 [label="Access variable R|/z|"]; - 306 [label="Const: Null(null)"]; - 307 [label="Equality operator !="]; - 308 [label="Exit when branch condition"]; - } - 309 [label="Synthetic else branch"]; - 310 [label="Enter when branch result"]; - subgraph cluster_69 { - color=blue - 311 [label="Enter block"]; - 312 [label="Access variable R|/x|"]; - 313 [label="Access variable #"]; - 314 [label="Access variable R|/y|"]; - 315 [label="Access variable #"]; - 316 [label="Access variable R|/z|"]; - 317 [label="Access variable R|kotlin/String.length|"]; - 318 [label="Exit block"]; - } - 319 [label="Exit when branch result"]; - 320 [label="Exit when"]; - } - 321 [label="Exit block"]; + 204 [label="Variable declaration: lval x: R|kotlin/Any|"]; + 205 [label="Access variable R|/a|"]; + 206 [label="Assignment: R|/x|"]; + 207 [label="Access variable R|/x|"]; + 208 [label="Smart cast: R|/x|"]; + 209 [label="Access variable R|/A.s|"]; + 210 [label="Exit block"]; } - 322 [label="Exit function test_7" style="filled" fillcolor=red]; + 211 [label="Exit function test_6" style="filled" fillcolor=red]; } 202 -> {203}; 203 -> {204}; @@ -751,12 +580,202 @@ digraph boundSmartcastsInBranches_kt { 208 -> {209}; 209 -> {210}; 210 -> {211}; - 211 -> {212}; + + subgraph cluster_50 { + color=red + 212 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_51 { + color=blue + 213 [label="Enter block"]; + 214 [label="Const: Null(null)"]; + 215 [label="Variable declaration: lval z: R|kotlin/String?|"]; + 216 [label="Access variable R|/z|"]; + 217 [label="Variable declaration: lvar y: R|kotlin/String?|"]; + 218 [label="Access variable R|/y|"]; + 219 [label="Variable declaration: lval x: R|kotlin/String?|"]; + subgraph cluster_52 { + color=blue + 220 [label="Enter when"]; + subgraph cluster_53 { + color=blue + 221 [label="Enter when branch condition "]; + 222 [label="Access variable R|/x|"]; + 223 [label="Const: Null(null)"]; + 224 [label="Equality operator !="]; + 225 [label="Exit when branch condition"]; + } + 226 [label="Synthetic else branch"]; + 227 [label="Enter when branch result"]; + subgraph cluster_54 { + color=blue + 228 [label="Enter block"]; + 229 [label="Access variable R|/x|"]; + 230 [label="Smart cast: R|/x|"]; + 231 [label="Access variable R|kotlin/String.length|"]; + 232 [label="Access variable R|/y|"]; + 233 [label="Access variable #"]; + 234 [label="Access variable R|/z|"]; + 235 [label="Access variable #"]; + 236 [label="Exit block"]; + } + 237 [label="Exit when branch result"]; + 238 [label="Exit when"]; + } + subgraph cluster_55 { + color=blue + 239 [label="Enter when"]; + subgraph cluster_56 { + color=blue + 240 [label="Enter when branch condition "]; + 241 [label="Access variable R|/y|"]; + 242 [label="Const: Null(null)"]; + 243 [label="Equality operator !="]; + 244 [label="Exit when branch condition"]; + } + 245 [label="Synthetic else branch"]; + 246 [label="Enter when branch result"]; + subgraph cluster_57 { + color=blue + 247 [label="Enter block"]; + 248 [label="Access variable R|/x|"]; + 249 [label="Access variable #"]; + 250 [label="Access variable R|/y|"]; + 251 [label="Smart cast: R|/y|"]; + 252 [label="Access variable R|kotlin/String.length|"]; + 253 [label="Access variable R|/z|"]; + 254 [label="Access variable #"]; + 255 [label="Exit block"]; + } + 256 [label="Exit when branch result"]; + 257 [label="Exit when"]; + } + subgraph cluster_58 { + color=blue + 258 [label="Enter when"]; + subgraph cluster_59 { + color=blue + 259 [label="Enter when branch condition "]; + 260 [label="Access variable R|/z|"]; + 261 [label="Const: Null(null)"]; + 262 [label="Equality operator !="]; + 263 [label="Exit when branch condition"]; + } + 264 [label="Synthetic else branch"]; + 265 [label="Enter when branch result"]; + subgraph cluster_60 { + color=blue + 266 [label="Enter block"]; + 267 [label="Access variable R|/x|"]; + 268 [label="Access variable #"]; + 269 [label="Access variable R|/y|"]; + 270 [label="Access variable #"]; + 271 [label="Access variable R|/z|"]; + 272 [label="Smart cast: R|/z|"]; + 273 [label="Access variable R|kotlin/String.length|"]; + 274 [label="Exit block"]; + } + 275 [label="Exit when branch result"]; + 276 [label="Exit when"]; + } + 277 [label="Const: Null(null)"]; + 278 [label="Assignment: R|/y|"]; + subgraph cluster_61 { + color=blue + 279 [label="Enter when"]; + subgraph cluster_62 { + color=blue + 280 [label="Enter when branch condition "]; + 281 [label="Access variable R|/x|"]; + 282 [label="Const: Null(null)"]; + 283 [label="Equality operator !="]; + 284 [label="Exit when branch condition"]; + } + 285 [label="Synthetic else branch"]; + 286 [label="Enter when branch result"]; + subgraph cluster_63 { + color=blue + 287 [label="Enter block"]; + 288 [label="Access variable R|/x|"]; + 289 [label="Smart cast: R|/x|"]; + 290 [label="Access variable R|kotlin/String.length|"]; + 291 [label="Access variable R|/y|"]; + 292 [label="Smart cast: R|/y|"]; + 293 [label="Access variable #"]; + 294 [label="Access variable R|/z|"]; + 295 [label="Access variable #"]; + 296 [label="Exit block"]; + } + 297 [label="Exit when branch result"]; + 298 [label="Exit when"]; + } + subgraph cluster_64 { + color=blue + 299 [label="Enter when"]; + subgraph cluster_65 { + color=blue + 300 [label="Enter when branch condition "]; + 301 [label="Access variable R|/y|"]; + 302 [label="Smart cast: R|/y|"]; + 303 [label="Const: Null(null)"]; + 304 [label="Equality operator !="]; + 305 [label="Exit when branch condition"]; + } + 306 [label="Synthetic else branch"]; + 307 [label="Enter when branch result"]; + subgraph cluster_66 { + color=blue + 308 [label="Enter block"]; + 309 [label="Access variable R|/x|"]; + 310 [label="Access variable #"]; + 311 [label="Access variable R|/y|"]; + 312 [label="Smart cast: R|/y|"]; + 313 [label="Stub" style="filled" fillcolor=gray]; + 314 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray]; + 315 [label="Access variable R|/z|" style="filled" fillcolor=gray]; + 316 [label="Access variable #" style="filled" fillcolor=gray]; + 317 [label="Exit block" style="filled" fillcolor=gray]; + } + 318 [label="Exit when branch result" style="filled" fillcolor=gray]; + 319 [label="Exit when"]; + } + subgraph cluster_67 { + color=blue + 320 [label="Enter when"]; + subgraph cluster_68 { + color=blue + 321 [label="Enter when branch condition "]; + 322 [label="Access variable R|/z|"]; + 323 [label="Const: Null(null)"]; + 324 [label="Equality operator !="]; + 325 [label="Exit when branch condition"]; + } + 326 [label="Synthetic else branch"]; + 327 [label="Enter when branch result"]; + subgraph cluster_69 { + color=blue + 328 [label="Enter block"]; + 329 [label="Access variable R|/x|"]; + 330 [label="Access variable #"]; + 331 [label="Access variable R|/y|"]; + 332 [label="Smart cast: R|/y|"]; + 333 [label="Access variable #"]; + 334 [label="Access variable R|/z|"]; + 335 [label="Smart cast: R|/z|"]; + 336 [label="Access variable R|kotlin/String.length|"]; + 337 [label="Exit block"]; + } + 338 [label="Exit when branch result"]; + 339 [label="Exit when"]; + } + 340 [label="Exit block"]; + } + 341 [label="Exit function test_7" style="filled" fillcolor=red]; + } 212 -> {213}; 213 -> {214}; 214 -> {215}; - 215 -> {217 216}; - 216 -> {227}; + 215 -> {216}; + 216 -> {217}; 217 -> {218}; 218 -> {219}; 219 -> {220}; @@ -765,16 +784,16 @@ digraph boundSmartcastsInBranches_kt { 222 -> {223}; 223 -> {224}; 224 -> {225}; - 225 -> {226}; - 226 -> {227}; + 225 -> {227 226}; + 226 -> {238}; 227 -> {228}; 228 -> {229}; 229 -> {230}; 230 -> {231}; 231 -> {232}; 232 -> {233}; - 233 -> {235 234}; - 234 -> {245}; + 233 -> {234}; + 234 -> {235}; 235 -> {236}; 236 -> {237}; 237 -> {238}; @@ -784,15 +803,15 @@ digraph boundSmartcastsInBranches_kt { 241 -> {242}; 242 -> {243}; 243 -> {244}; - 244 -> {245}; - 245 -> {246}; + 244 -> {246 245}; + 245 -> {257}; 246 -> {247}; 247 -> {248}; 248 -> {249}; 249 -> {250}; 250 -> {251}; - 251 -> {253 252}; - 252 -> {263}; + 251 -> {252}; + 252 -> {253}; 253 -> {254}; 254 -> {255}; 255 -> {256}; @@ -803,16 +822,16 @@ digraph boundSmartcastsInBranches_kt { 260 -> {261}; 261 -> {262}; 262 -> {263}; - 263 -> {264}; - 264 -> {265}; + 263 -> {265 264}; + 264 -> {276}; 265 -> {266}; 266 -> {267}; 267 -> {268}; 268 -> {269}; 269 -> {270}; 270 -> {271}; - 271 -> {273 272}; - 272 -> {283}; + 271 -> {272}; + 272 -> {273}; 273 -> {274}; 274 -> {275}; 275 -> {276}; @@ -824,231 +843,50 @@ digraph boundSmartcastsInBranches_kt { 281 -> {282}; 282 -> {283}; 283 -> {284}; - 284 -> {285}; - 285 -> {286}; + 284 -> {286 285}; + 285 -> {298}; 286 -> {287}; 287 -> {288}; 288 -> {289}; - 289 -> {291 290}; - 290 -> {302}; + 289 -> {290}; + 290 -> {291}; 291 -> {292}; 292 -> {293}; 293 -> {294}; 294 -> {295}; - 295 -> {322} [label=onUncaughtException]; - 295 -> {296} [style=dotted]; - 296 -> {297} [style=dotted]; - 297 -> {298} [style=dotted]; - 298 -> {299} [style=dotted]; - 299 -> {300} [style=dotted]; - 300 -> {301} [style=dotted]; - 301 -> {302} [style=dotted]; + 295 -> {296}; + 296 -> {297}; + 297 -> {298}; + 298 -> {299}; + 299 -> {300}; + 300 -> {301}; + 301 -> {302}; 302 -> {303}; 303 -> {304}; 304 -> {305}; - 305 -> {306}; - 306 -> {307}; + 305 -> {307 306}; + 306 -> {319}; 307 -> {308}; - 308 -> {310 309}; - 309 -> {320}; + 308 -> {309}; + 309 -> {310}; 310 -> {311}; 311 -> {312}; - 312 -> {313}; - 313 -> {314}; - 314 -> {315}; - 315 -> {316}; - 316 -> {317}; - 317 -> {318}; - 318 -> {319}; + 312 -> {341} [label=onUncaughtException]; + 312 -> {313} [style=dotted]; + 313 -> {314} [style=dotted]; + 314 -> {315} [style=dotted]; + 315 -> {316} [style=dotted]; + 316 -> {317} [style=dotted]; + 317 -> {318} [style=dotted]; + 318 -> {319} [style=dotted]; 319 -> {320}; 320 -> {321}; 321 -> {322}; - - subgraph cluster_70 { - color=red - 323 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_71 { - color=blue - 324 [label="Enter block"]; - 325 [label="Const: Null(null)"]; - 326 [label="Variable declaration: lval z: R|kotlin/String?|"]; - 327 [label="Access variable R|/z|"]; - 328 [label="Variable declaration: lvar y: R|kotlin/String?|"]; - 329 [label="Access variable R|/y|"]; - 330 [label="Variable declaration: lval x: R|kotlin/String?|"]; - subgraph cluster_72 { - color=blue - 331 [label="Enter when"]; - subgraph cluster_73 { - color=blue - 332 [label="Enter when branch condition "]; - 333 [label="Access variable R|/x|"]; - 334 [label="Const: Null(null)"]; - 335 [label="Equality operator !="]; - 336 [label="Exit when branch condition"]; - } - 337 [label="Synthetic else branch"]; - 338 [label="Enter when branch result"]; - subgraph cluster_74 { - color=blue - 339 [label="Enter block"]; - 340 [label="Access variable R|/x|"]; - 341 [label="Access variable R|kotlin/String.length|"]; - 342 [label="Access variable R|/y|"]; - 343 [label="Access variable R|kotlin/String.length|"]; - 344 [label="Access variable R|/z|"]; - 345 [label="Access variable R|kotlin/String.length|"]; - 346 [label="Exit block"]; - } - 347 [label="Exit when branch result"]; - 348 [label="Exit when"]; - } - subgraph cluster_75 { - color=blue - 349 [label="Enter when"]; - subgraph cluster_76 { - color=blue - 350 [label="Enter when branch condition "]; - 351 [label="Access variable R|/y|"]; - 352 [label="Const: Null(null)"]; - 353 [label="Equality operator !="]; - 354 [label="Exit when branch condition"]; - } - 355 [label="Synthetic else branch"]; - 356 [label="Enter when branch result"]; - subgraph cluster_77 { - color=blue - 357 [label="Enter block"]; - 358 [label="Access variable R|/x|"]; - 359 [label="Access variable R|kotlin/String.length|"]; - 360 [label="Access variable R|/y|"]; - 361 [label="Access variable R|kotlin/String.length|"]; - 362 [label="Access variable R|/z|"]; - 363 [label="Access variable R|kotlin/String.length|"]; - 364 [label="Exit block"]; - } - 365 [label="Exit when branch result"]; - 366 [label="Exit when"]; - } - subgraph cluster_78 { - color=blue - 367 [label="Enter when"]; - subgraph cluster_79 { - color=blue - 368 [label="Enter when branch condition "]; - 369 [label="Access variable R|/z|"]; - 370 [label="Const: Null(null)"]; - 371 [label="Equality operator !="]; - 372 [label="Exit when branch condition"]; - } - 373 [label="Synthetic else branch"]; - 374 [label="Enter when branch result"]; - subgraph cluster_80 { - color=blue - 375 [label="Enter block"]; - 376 [label="Access variable R|/x|"]; - 377 [label="Access variable R|kotlin/String.length|"]; - 378 [label="Access variable R|/y|"]; - 379 [label="Access variable R|kotlin/String.length|"]; - 380 [label="Access variable R|/z|"]; - 381 [label="Access variable R|kotlin/String.length|"]; - 382 [label="Exit block"]; - } - 383 [label="Exit when branch result"]; - 384 [label="Exit when"]; - } - 385 [label="Const: Null(null)"]; - 386 [label="Assignment: R|/y|"]; - subgraph cluster_81 { - color=blue - 387 [label="Enter when"]; - subgraph cluster_82 { - color=blue - 388 [label="Enter when branch condition "]; - 389 [label="Access variable R|/x|"]; - 390 [label="Const: Null(null)"]; - 391 [label="Equality operator !="]; - 392 [label="Exit when branch condition"]; - } - 393 [label="Synthetic else branch"]; - 394 [label="Enter when branch result"]; - subgraph cluster_83 { - color=blue - 395 [label="Enter block"]; - 396 [label="Access variable R|/x|"]; - 397 [label="Access variable R|kotlin/String.length|"]; - 398 [label="Access variable R|/y|"]; - 399 [label="Access variable #"]; - 400 [label="Access variable R|/z|"]; - 401 [label="Access variable R|kotlin/String.length|"]; - 402 [label="Exit block"]; - } - 403 [label="Exit when branch result"]; - 404 [label="Exit when"]; - } - subgraph cluster_84 { - color=blue - 405 [label="Enter when"]; - subgraph cluster_85 { - color=blue - 406 [label="Enter when branch condition "]; - 407 [label="Access variable R|/y|"]; - 408 [label="Const: Null(null)"]; - 409 [label="Equality operator !="]; - 410 [label="Exit when branch condition"]; - } - 411 [label="Synthetic else branch"]; - 412 [label="Enter when branch result"]; - subgraph cluster_86 { - color=blue - 413 [label="Enter block"]; - 414 [label="Access variable R|/x|"]; - 415 [label="Access variable #"]; - 416 [label="Access variable R|/y|"]; - 417 [label="Stub" style="filled" fillcolor=gray]; - 418 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray]; - 419 [label="Access variable R|/z|" style="filled" fillcolor=gray]; - 420 [label="Access variable #" style="filled" fillcolor=gray]; - 421 [label="Exit block" style="filled" fillcolor=gray]; - } - 422 [label="Exit when branch result" style="filled" fillcolor=gray]; - 423 [label="Exit when"]; - } - subgraph cluster_87 { - color=blue - 424 [label="Enter when"]; - subgraph cluster_88 { - color=blue - 425 [label="Enter when branch condition "]; - 426 [label="Access variable R|/z|"]; - 427 [label="Const: Null(null)"]; - 428 [label="Equality operator !="]; - 429 [label="Exit when branch condition"]; - } - 430 [label="Synthetic else branch"]; - 431 [label="Enter when branch result"]; - subgraph cluster_89 { - color=blue - 432 [label="Enter block"]; - 433 [label="Access variable R|/x|"]; - 434 [label="Access variable R|kotlin/String.length|"]; - 435 [label="Access variable R|/y|"]; - 436 [label="Access variable #"]; - 437 [label="Access variable R|/z|"]; - 438 [label="Access variable R|kotlin/String.length|"]; - 439 [label="Exit block"]; - } - 440 [label="Exit when branch result"]; - 441 [label="Exit when"]; - } - 442 [label="Exit block"]; - } - 443 [label="Exit function test_8" style="filled" fillcolor=red]; - } + 322 -> {323}; 323 -> {324}; 324 -> {325}; - 325 -> {326}; - 326 -> {327}; + 325 -> {327 326}; + 326 -> {339}; 327 -> {328}; 328 -> {329}; 329 -> {330}; @@ -1058,12 +896,210 @@ digraph boundSmartcastsInBranches_kt { 333 -> {334}; 334 -> {335}; 335 -> {336}; - 336 -> {338 337}; - 337 -> {348}; + 336 -> {337}; + 337 -> {338}; 338 -> {339}; 339 -> {340}; 340 -> {341}; - 341 -> {342}; + + subgraph cluster_70 { + color=red + 342 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_71 { + color=blue + 343 [label="Enter block"]; + 344 [label="Const: Null(null)"]; + 345 [label="Variable declaration: lval z: R|kotlin/String?|"]; + 346 [label="Access variable R|/z|"]; + 347 [label="Variable declaration: lvar y: R|kotlin/String?|"]; + 348 [label="Access variable R|/y|"]; + 349 [label="Variable declaration: lval x: R|kotlin/String?|"]; + subgraph cluster_72 { + color=blue + 350 [label="Enter when"]; + subgraph cluster_73 { + color=blue + 351 [label="Enter when branch condition "]; + 352 [label="Access variable R|/x|"]; + 353 [label="Const: Null(null)"]; + 354 [label="Equality operator !="]; + 355 [label="Exit when branch condition"]; + } + 356 [label="Synthetic else branch"]; + 357 [label="Enter when branch result"]; + subgraph cluster_74 { + color=blue + 358 [label="Enter block"]; + 359 [label="Access variable R|/x|"]; + 360 [label="Smart cast: R|/x|"]; + 361 [label="Access variable R|kotlin/String.length|"]; + 362 [label="Access variable R|/y|"]; + 363 [label="Smart cast: R|/y|"]; + 364 [label="Access variable R|kotlin/String.length|"]; + 365 [label="Access variable R|/z|"]; + 366 [label="Smart cast: R|/z|"]; + 367 [label="Access variable R|kotlin/String.length|"]; + 368 [label="Exit block"]; + } + 369 [label="Exit when branch result"]; + 370 [label="Exit when"]; + } + subgraph cluster_75 { + color=blue + 371 [label="Enter when"]; + subgraph cluster_76 { + color=blue + 372 [label="Enter when branch condition "]; + 373 [label="Access variable R|/y|"]; + 374 [label="Const: Null(null)"]; + 375 [label="Equality operator !="]; + 376 [label="Exit when branch condition"]; + } + 377 [label="Synthetic else branch"]; + 378 [label="Enter when branch result"]; + subgraph cluster_77 { + color=blue + 379 [label="Enter block"]; + 380 [label="Access variable R|/x|"]; + 381 [label="Smart cast: R|/x|"]; + 382 [label="Access variable R|kotlin/String.length|"]; + 383 [label="Access variable R|/y|"]; + 384 [label="Smart cast: R|/y|"]; + 385 [label="Access variable R|kotlin/String.length|"]; + 386 [label="Access variable R|/z|"]; + 387 [label="Smart cast: R|/z|"]; + 388 [label="Access variable R|kotlin/String.length|"]; + 389 [label="Exit block"]; + } + 390 [label="Exit when branch result"]; + 391 [label="Exit when"]; + } + subgraph cluster_78 { + color=blue + 392 [label="Enter when"]; + subgraph cluster_79 { + color=blue + 393 [label="Enter when branch condition "]; + 394 [label="Access variable R|/z|"]; + 395 [label="Const: Null(null)"]; + 396 [label="Equality operator !="]; + 397 [label="Exit when branch condition"]; + } + 398 [label="Synthetic else branch"]; + 399 [label="Enter when branch result"]; + subgraph cluster_80 { + color=blue + 400 [label="Enter block"]; + 401 [label="Access variable R|/x|"]; + 402 [label="Smart cast: R|/x|"]; + 403 [label="Access variable R|kotlin/String.length|"]; + 404 [label="Access variable R|/y|"]; + 405 [label="Smart cast: R|/y|"]; + 406 [label="Access variable R|kotlin/String.length|"]; + 407 [label="Access variable R|/z|"]; + 408 [label="Smart cast: R|/z|"]; + 409 [label="Access variable R|kotlin/String.length|"]; + 410 [label="Exit block"]; + } + 411 [label="Exit when branch result"]; + 412 [label="Exit when"]; + } + 413 [label="Const: Null(null)"]; + 414 [label="Assignment: R|/y|"]; + subgraph cluster_81 { + color=blue + 415 [label="Enter when"]; + subgraph cluster_82 { + color=blue + 416 [label="Enter when branch condition "]; + 417 [label="Access variable R|/x|"]; + 418 [label="Const: Null(null)"]; + 419 [label="Equality operator !="]; + 420 [label="Exit when branch condition"]; + } + 421 [label="Synthetic else branch"]; + 422 [label="Enter when branch result"]; + subgraph cluster_83 { + color=blue + 423 [label="Enter block"]; + 424 [label="Access variable R|/x|"]; + 425 [label="Smart cast: R|/x|"]; + 426 [label="Access variable R|kotlin/String.length|"]; + 427 [label="Access variable R|/y|"]; + 428 [label="Smart cast: R|/y|"]; + 429 [label="Access variable #"]; + 430 [label="Access variable R|/z|"]; + 431 [label="Smart cast: R|/z|"]; + 432 [label="Access variable R|kotlin/String.length|"]; + 433 [label="Exit block"]; + } + 434 [label="Exit when branch result"]; + 435 [label="Exit when"]; + } + subgraph cluster_84 { + color=blue + 436 [label="Enter when"]; + subgraph cluster_85 { + color=blue + 437 [label="Enter when branch condition "]; + 438 [label="Access variable R|/y|"]; + 439 [label="Smart cast: R|/y|"]; + 440 [label="Const: Null(null)"]; + 441 [label="Equality operator !="]; + 442 [label="Exit when branch condition"]; + } + 443 [label="Synthetic else branch"]; + 444 [label="Enter when branch result"]; + subgraph cluster_86 { + color=blue + 445 [label="Enter block"]; + 446 [label="Access variable R|/x|"]; + 447 [label="Access variable #"]; + 448 [label="Access variable R|/y|"]; + 449 [label="Smart cast: R|/y|"]; + 450 [label="Stub" style="filled" fillcolor=gray]; + 451 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray]; + 452 [label="Access variable R|/z|" style="filled" fillcolor=gray]; + 453 [label="Access variable #" style="filled" fillcolor=gray]; + 454 [label="Exit block" style="filled" fillcolor=gray]; + } + 455 [label="Exit when branch result" style="filled" fillcolor=gray]; + 456 [label="Exit when"]; + } + subgraph cluster_87 { + color=blue + 457 [label="Enter when"]; + subgraph cluster_88 { + color=blue + 458 [label="Enter when branch condition "]; + 459 [label="Access variable R|/z|"]; + 460 [label="Const: Null(null)"]; + 461 [label="Equality operator !="]; + 462 [label="Exit when branch condition"]; + } + 463 [label="Synthetic else branch"]; + 464 [label="Enter when branch result"]; + subgraph cluster_89 { + color=blue + 465 [label="Enter block"]; + 466 [label="Access variable R|/x|"]; + 467 [label="Smart cast: R|/x|"]; + 468 [label="Access variable R|kotlin/String.length|"]; + 469 [label="Access variable R|/y|"]; + 470 [label="Smart cast: R|/y|"]; + 471 [label="Access variable #"]; + 472 [label="Access variable R|/z|"]; + 473 [label="Smart cast: R|/z|"]; + 474 [label="Access variable R|kotlin/String.length|"]; + 475 [label="Exit block"]; + } + 476 [label="Exit when branch result"]; + 477 [label="Exit when"]; + } + 478 [label="Exit block"]; + } + 479 [label="Exit function test_8" style="filled" fillcolor=red]; + } 342 -> {343}; 343 -> {344}; 344 -> {345}; @@ -1076,9 +1112,9 @@ digraph boundSmartcastsInBranches_kt { 351 -> {352}; 352 -> {353}; 353 -> {354}; - 354 -> {356 355}; - 355 -> {366}; - 356 -> {357}; + 354 -> {355}; + 355 -> {357 356}; + 356 -> {370}; 357 -> {358}; 358 -> {359}; 359 -> {360}; @@ -1094,12 +1130,12 @@ digraph boundSmartcastsInBranches_kt { 369 -> {370}; 370 -> {371}; 371 -> {372}; - 372 -> {374 373}; - 373 -> {384}; + 372 -> {373}; + 373 -> {374}; 374 -> {375}; 375 -> {376}; - 376 -> {377}; - 377 -> {378}; + 376 -> {378 377}; + 377 -> {391}; 378 -> {379}; 379 -> {380}; 380 -> {381}; @@ -1114,13 +1150,13 @@ digraph boundSmartcastsInBranches_kt { 389 -> {390}; 390 -> {391}; 391 -> {392}; - 392 -> {394 393}; - 393 -> {404}; + 392 -> {393}; + 393 -> {394}; 394 -> {395}; 395 -> {396}; 396 -> {397}; - 397 -> {398}; - 398 -> {399}; + 397 -> {399 398}; + 398 -> {412}; 399 -> {400}; 400 -> {401}; 401 -> {402}; @@ -1132,28 +1168,27 @@ digraph boundSmartcastsInBranches_kt { 407 -> {408}; 408 -> {409}; 409 -> {410}; - 410 -> {412 411}; - 411 -> {423}; + 410 -> {411}; + 411 -> {412}; 412 -> {413}; 413 -> {414}; 414 -> {415}; 415 -> {416}; - 416 -> {443} [label=onUncaughtException]; - 416 -> {417} [style=dotted]; - 417 -> {418} [style=dotted]; - 418 -> {419} [style=dotted]; - 419 -> {420} [style=dotted]; - 420 -> {421} [style=dotted]; - 421 -> {422} [style=dotted]; - 422 -> {423} [style=dotted]; + 416 -> {417}; + 417 -> {418}; + 418 -> {419}; + 419 -> {420}; + 420 -> {422 421}; + 421 -> {435}; + 422 -> {423}; 423 -> {424}; 424 -> {425}; 425 -> {426}; 426 -> {427}; 427 -> {428}; 428 -> {429}; - 429 -> {431 430}; - 430 -> {441}; + 429 -> {430}; + 430 -> {431}; 431 -> {432}; 432 -> {433}; 433 -> {434}; @@ -1165,6 +1200,43 @@ digraph boundSmartcastsInBranches_kt { 439 -> {440}; 440 -> {441}; 441 -> {442}; - 442 -> {443}; + 442 -> {444 443}; + 443 -> {456}; + 444 -> {445}; + 445 -> {446}; + 446 -> {447}; + 447 -> {448}; + 448 -> {449}; + 449 -> {479} [label=onUncaughtException]; + 449 -> {450} [style=dotted]; + 450 -> {451} [style=dotted]; + 451 -> {452} [style=dotted]; + 452 -> {453} [style=dotted]; + 453 -> {454} [style=dotted]; + 454 -> {455} [style=dotted]; + 455 -> {456} [style=dotted]; + 456 -> {457}; + 457 -> {458}; + 458 -> {459}; + 459 -> {460}; + 460 -> {461}; + 461 -> {462}; + 462 -> {464 463}; + 463 -> {477}; + 464 -> {465}; + 465 -> {466}; + 466 -> {467}; + 467 -> {468}; + 468 -> {469}; + 469 -> {470}; + 470 -> {471}; + 471 -> {472}; + 472 -> {473}; + 473 -> {474}; + 474 -> {475}; + 475 -> {476}; + 476 -> {477}; + 477 -> {478}; + 478 -> {479}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot index de1a195e905..1b36d7b1b4c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.dot @@ -109,13 +109,14 @@ digraph functionCallBound_kt { color=blue 41 [label="Enter block"]; 42 [label="Access variable R|/base|"]; - 43 [label="Access variable R|/Sub.data|"]; - 44 [label="Exit block"]; + 43 [label="Smart cast: R|/base|"]; + 44 [label="Access variable R|/Sub.data|"]; + 45 [label="Exit block"]; } - 45 [label="Exit when branch result"]; - 46 [label="Exit when"]; + 46 [label="Exit when branch result"]; + 47 [label="Exit when"]; } - 47 [label="Jump: ^check when () { + 48 [label="Jump: ^check when () { ==((R|/base| as? R|Sub|)?.{ $subj$.R|/isOk|() }, Boolean(true)) -> { R|/base|.R|/Sub.data| } @@ -124,10 +125,10 @@ digraph functionCallBound_kt { } } "]; - 48 [label="Stub" style="filled" fillcolor=gray]; - 49 [label="Exit block" style="filled" fillcolor=gray]; + 49 [label="Stub" style="filled" fillcolor=gray]; + 50 [label="Exit block" style="filled" fillcolor=gray]; } - 50 [label="Exit function check" style="filled" fillcolor=red]; + 51 [label="Exit function check" style="filled" fillcolor=red]; } 21 -> {22}; 22 -> {23}; @@ -147,7 +148,7 @@ digraph functionCallBound_kt { 36 -> {37}; 37 -> {38}; 38 -> {39}; - 39 -> {46}; + 39 -> {47}; 40 -> {41}; 41 -> {42}; 42 -> {43}; @@ -155,9 +156,10 @@ digraph functionCallBound_kt { 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {50}; - 47 -> {48} [style=dotted]; + 47 -> {48}; + 48 -> {51}; 48 -> {49} [style=dotted]; 49 -> {50} [style=dotted]; + 50 -> {51} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.dot index 91f3f1cae39..0b65c59f402 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/casts.dot @@ -12,10 +12,11 @@ digraph casts_kt { 2 [label="Access variable R|/x|"]; 3 [label="Type operator: (R|/x| as R|kotlin/String|)"]; 4 [label="Access variable R|/x|"]; - 5 [label="Access variable R|kotlin/String.length|"]; - 6 [label="Exit block"]; + 5 [label="Smart cast: R|/x|"]; + 6 [label="Access variable R|kotlin/String.length|"]; + 7 [label="Exit block"]; } - 7 [label="Exit function test_1" style="filled" fillcolor=red]; + 8 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -24,50 +25,52 @@ digraph casts_kt { 4 -> {5}; 5 -> {6}; 6 -> {7}; + 7 -> {8}; subgraph cluster_2 { color=red - 8 [label="Enter function test_2" style="filled" fillcolor=red]; + 9 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_3 { color=blue - 9 [label="Enter block"]; + 10 [label="Enter block"]; subgraph cluster_4 { color=blue - 10 [label="Enter when"]; + 11 [label="Enter when"]; subgraph cluster_5 { color=blue - 11 [label="Enter when branch condition "]; - 12 [label="Access variable R|/x|"]; - 13 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; - 14 [label="Exit when branch condition"]; + 12 [label="Enter when branch condition "]; + 13 [label="Access variable R|/x|"]; + 14 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; + 15 [label="Exit when branch condition"]; } - 15 [label="Synthetic else branch"]; - 16 [label="Enter when branch result"]; + 16 [label="Synthetic else branch"]; + 17 [label="Enter when branch result"]; subgraph cluster_6 { color=blue - 17 [label="Enter block"]; - 18 [label="Access variable R|/x|"]; - 19 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 20 [label="Exit block"]; + 18 [label="Enter block"]; + 19 [label="Access variable R|/x|"]; + 20 [label="Smart cast: R|/x|"]; + 21 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 22 [label="Exit block"]; } - 21 [label="Exit when branch result"]; - 22 [label="Exit when"]; + 23 [label="Exit when branch result"]; + 24 [label="Exit when"]; } - 23 [label="Access variable R|/x|"]; - 24 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 25 [label="Exit block"]; + 25 [label="Access variable R|/x|"]; + 26 [label="Smart cast: R|/x|"]; + 27 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 28 [label="Exit block"]; } - 26 [label="Exit function test_2" style="filled" fillcolor=red]; + 29 [label="Exit function test_2" style="filled" fillcolor=red]; } - 8 -> {9}; 9 -> {10}; 10 -> {11}; 11 -> {12}; 12 -> {13}; 13 -> {14}; - 14 -> {16 15}; - 15 -> {22}; - 16 -> {17}; + 14 -> {15}; + 15 -> {17 16}; + 16 -> {24}; 17 -> {18}; 18 -> {19}; 19 -> {20}; @@ -77,131 +80,133 @@ digraph casts_kt { 23 -> {24}; 24 -> {25}; 25 -> {26}; + 26 -> {27}; + 27 -> {28}; + 28 -> {29}; subgraph cluster_7 { color=red - 27 [label="Enter function test_3" style="filled" fillcolor=red]; + 30 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_8 { color=blue - 28 [label="Enter block"]; + 31 [label="Enter block"]; subgraph cluster_9 { color=blue - 29 [label="Enter when"]; + 32 [label="Enter when"]; subgraph cluster_10 { color=blue - 30 [label="Enter when branch condition "]; + 33 [label="Enter when branch condition "]; subgraph cluster_11 { color=blue - 31 [label="Enter &&"]; - 32 [label="Access variable R|/b|"]; - 33 [label="Exit left part of &&"]; - 34 [label="Enter right part of &&"]; - 35 [label="Access variable R|/x|"]; - 36 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; - 37 [label="Exit &&"]; + 34 [label="Enter &&"]; + 35 [label="Access variable R|/b|"]; + 36 [label="Exit left part of &&"]; + 37 [label="Enter right part of &&"]; + 38 [label="Access variable R|/x|"]; + 39 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; + 40 [label="Exit &&"]; } - 38 [label="Exit when branch condition"]; + 41 [label="Exit when branch condition"]; } - 39 [label="Synthetic else branch"]; - 40 [label="Enter when branch result"]; + 42 [label="Synthetic else branch"]; + 43 [label="Enter when branch result"]; subgraph cluster_12 { color=blue - 41 [label="Enter block"]; - 42 [label="Access variable R|/x|"]; - 43 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 44 [label="Exit block"]; + 44 [label="Enter block"]; + 45 [label="Access variable R|/x|"]; + 46 [label="Smart cast: R|/x|"]; + 47 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 48 [label="Exit block"]; } - 45 [label="Exit when branch result"]; - 46 [label="Exit when"]; + 49 [label="Exit when branch result"]; + 50 [label="Exit when"]; } - 47 [label="Access variable R|/x|"]; - 48 [label="Function call: R|/x|.#()"]; + 51 [label="Access variable R|/x|"]; + 52 [label="Function call: R|/x|.#()"]; subgraph cluster_13 { color=blue - 49 [label="Enter when"]; + 53 [label="Enter when"]; subgraph cluster_14 { color=blue - 50 [label="Enter when branch condition "]; + 54 [label="Enter when branch condition "]; subgraph cluster_15 { color=blue - 51 [label="Enter &&"]; - 52 [label="Access variable R|/b|"]; - 53 [label="Exit left part of &&"]; - 54 [label="Enter right part of &&"]; - 55 [label="Access variable R|/x|"]; - 56 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; - 57 [label="Const: Boolean(true)"]; - 58 [label="Equality operator =="]; - 59 [label="Exit &&"]; + 55 [label="Enter &&"]; + 56 [label="Access variable R|/b|"]; + 57 [label="Exit left part of &&"]; + 58 [label="Enter right part of &&"]; + 59 [label="Access variable R|/x|"]; + 60 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; + 61 [label="Const: Boolean(true)"]; + 62 [label="Equality operator =="]; + 63 [label="Exit &&"]; } - 60 [label="Exit when branch condition"]; + 64 [label="Exit when branch condition"]; } - 61 [label="Synthetic else branch"]; - 62 [label="Enter when branch result"]; + 65 [label="Synthetic else branch"]; + 66 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 63 [label="Enter block"]; - 64 [label="Access variable R|/x|"]; - 65 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 66 [label="Exit block"]; + 67 [label="Enter block"]; + 68 [label="Access variable R|/x|"]; + 69 [label="Smart cast: R|/x|"]; + 70 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 71 [label="Exit block"]; } - 67 [label="Exit when branch result"]; - 68 [label="Exit when"]; + 72 [label="Exit when branch result"]; + 73 [label="Exit when"]; } - 69 [label="Access variable R|/x|"]; - 70 [label="Function call: R|/x|.#()"]; + 74 [label="Access variable R|/x|"]; + 75 [label="Function call: R|/x|.#()"]; subgraph cluster_17 { color=blue - 71 [label="Enter when"]; + 76 [label="Enter when"]; subgraph cluster_18 { color=blue - 72 [label="Enter when branch condition "]; + 77 [label="Enter when branch condition "]; subgraph cluster_19 { color=blue - 73 [label="Enter ||"]; - 74 [label="Access variable R|/b|"]; - 75 [label="Exit left part of ||"]; - 76 [label="Enter right part of ||"]; - 77 [label="Access variable R|/x|"]; - 78 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; - 79 [label="Exit ||"]; + 78 [label="Enter ||"]; + 79 [label="Access variable R|/b|"]; + 80 [label="Exit left part of ||"]; + 81 [label="Enter right part of ||"]; + 82 [label="Access variable R|/x|"]; + 83 [label="Type operator: (R|/x| as R|kotlin/Boolean|)"]; + 84 [label="Exit ||"]; } - 80 [label="Exit when branch condition"]; + 85 [label="Exit when branch condition"]; } - 81 [label="Synthetic else branch"]; - 82 [label="Enter when branch result"]; + 86 [label="Synthetic else branch"]; + 87 [label="Enter when branch result"]; subgraph cluster_20 { color=blue - 83 [label="Enter block"]; - 84 [label="Access variable R|/x|"]; - 85 [label="Function call: R|/x|.#()"]; - 86 [label="Exit block"]; + 88 [label="Enter block"]; + 89 [label="Access variable R|/x|"]; + 90 [label="Function call: R|/x|.#()"]; + 91 [label="Exit block"]; } - 87 [label="Exit when branch result"]; - 88 [label="Exit when"]; + 92 [label="Exit when branch result"]; + 93 [label="Exit when"]; } - 89 [label="Access variable R|/x|"]; - 90 [label="Function call: R|/x|.#()"]; - 91 [label="Exit block"]; + 94 [label="Access variable R|/x|"]; + 95 [label="Function call: R|/x|.#()"]; + 96 [label="Exit block"]; } - 92 [label="Exit function test_3" style="filled" fillcolor=red]; + 97 [label="Exit function test_3" style="filled" fillcolor=red]; } - 27 -> {28}; - 28 -> {29}; - 29 -> {30}; 30 -> {31}; 31 -> {32}; 32 -> {33}; - 33 -> {37 34}; + 33 -> {34}; 34 -> {35}; 35 -> {36}; - 36 -> {37}; + 36 -> {40 37}; 37 -> {38}; - 38 -> {40 39}; - 39 -> {46}; + 38 -> {39}; + 39 -> {40}; 40 -> {41}; - 41 -> {42}; - 42 -> {43}; + 41 -> {43 42}; + 42 -> {50}; 43 -> {44}; 44 -> {45}; 45 -> {46}; @@ -212,19 +217,19 @@ digraph casts_kt { 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {59 54}; + 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; - 57 -> {58}; + 57 -> {63 58}; 58 -> {59}; 59 -> {60}; - 60 -> {62 61}; - 61 -> {68}; + 60 -> {61}; + 61 -> {62}; 62 -> {63}; 63 -> {64}; - 64 -> {65}; - 65 -> {66}; + 64 -> {66 65}; + 65 -> {73}; 66 -> {67}; 67 -> {68}; 68 -> {69}; @@ -234,134 +239,136 @@ digraph casts_kt { 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {79 76}; + 75 -> {76}; 76 -> {77}; 77 -> {78}; 78 -> {79}; 79 -> {80}; - 80 -> {82 81}; - 81 -> {88}; + 80 -> {84 81}; + 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; - 85 -> {86}; - 86 -> {87}; + 85 -> {87 86}; + 86 -> {93}; 87 -> {88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; - - subgraph cluster_21 { - color=red - 93 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_22 { - color=blue - 94 [label="Enter block"]; - subgraph cluster_23 { - color=blue - 95 [label="Enter when"]; - subgraph cluster_24 { - color=blue - 96 [label="Enter when branch condition "]; - 97 [label="Access variable R|/b|"]; - 98 [label="Type operator: (R|/b| as? R|kotlin/Boolean|)"]; - 99 [label="Const: Null(null)"]; - 100 [label="Equality operator !="]; - 101 [label="Exit when branch condition"]; - } - subgraph cluster_25 { - color=blue - 102 [label="Enter when branch condition else"]; - 103 [label="Exit when branch condition"]; - } - 104 [label="Enter when branch result"]; - subgraph cluster_26 { - color=blue - 105 [label="Enter block"]; - 106 [label="Access variable R|/b|"]; - 107 [label="Function call: R|/b|.#()"]; - 108 [label="Exit block"]; - } - 109 [label="Exit when branch result"]; - 110 [label="Enter when branch result"]; - subgraph cluster_27 { - color=blue - 111 [label="Enter block"]; - 112 [label="Access variable R|/b|"]; - 113 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 114 [label="Exit block"]; - } - 115 [label="Exit when branch result"]; - 116 [label="Exit when"]; - } - 117 [label="Access variable R|/b|"]; - 118 [label="Function call: R|/b|.#()"]; - subgraph cluster_28 { - color=blue - 119 [label="Enter when"]; - subgraph cluster_29 { - color=blue - 120 [label="Enter when branch condition "]; - 121 [label="Access variable R|/b|"]; - 122 [label="Type operator: (R|/b| as? R|kotlin/Boolean|)"]; - 123 [label="Const: Null(null)"]; - 124 [label="Equality operator =="]; - 125 [label="Exit when branch condition"]; - } - subgraph cluster_30 { - color=blue - 126 [label="Enter when branch condition else"]; - 127 [label="Exit when branch condition"]; - } - 128 [label="Enter when branch result"]; - subgraph cluster_31 { - color=blue - 129 [label="Enter block"]; - 130 [label="Access variable R|/b|"]; - 131 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 132 [label="Exit block"]; - } - 133 [label="Exit when branch result"]; - 134 [label="Enter when branch result"]; - subgraph cluster_32 { - color=blue - 135 [label="Enter block"]; - 136 [label="Access variable R|/b|"]; - 137 [label="Function call: R|/b|.#()"]; - 138 [label="Exit block"]; - } - 139 [label="Exit when branch result"]; - 140 [label="Exit when"]; - } - 141 [label="Access variable R|/b|"]; - 142 [label="Function call: R|/b|.#()"]; - 143 [label="Exit block"]; - } - 144 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 92 -> {93}; 93 -> {94}; 94 -> {95}; 95 -> {96}; 96 -> {97}; - 97 -> {98}; + + subgraph cluster_21 { + color=red + 98 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_22 { + color=blue + 99 [label="Enter block"]; + subgraph cluster_23 { + color=blue + 100 [label="Enter when"]; + subgraph cluster_24 { + color=blue + 101 [label="Enter when branch condition "]; + 102 [label="Access variable R|/b|"]; + 103 [label="Type operator: (R|/b| as? R|kotlin/Boolean|)"]; + 104 [label="Const: Null(null)"]; + 105 [label="Equality operator !="]; + 106 [label="Exit when branch condition"]; + } + subgraph cluster_25 { + color=blue + 107 [label="Enter when branch condition else"]; + 108 [label="Exit when branch condition"]; + } + 109 [label="Enter when branch result"]; + subgraph cluster_26 { + color=blue + 110 [label="Enter block"]; + 111 [label="Access variable R|/b|"]; + 112 [label="Function call: R|/b|.#()"]; + 113 [label="Exit block"]; + } + 114 [label="Exit when branch result"]; + 115 [label="Enter when branch result"]; + subgraph cluster_27 { + color=blue + 116 [label="Enter block"]; + 117 [label="Access variable R|/b|"]; + 118 [label="Smart cast: R|/b|"]; + 119 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 120 [label="Exit block"]; + } + 121 [label="Exit when branch result"]; + 122 [label="Exit when"]; + } + 123 [label="Access variable R|/b|"]; + 124 [label="Function call: R|/b|.#()"]; + subgraph cluster_28 { + color=blue + 125 [label="Enter when"]; + subgraph cluster_29 { + color=blue + 126 [label="Enter when branch condition "]; + 127 [label="Access variable R|/b|"]; + 128 [label="Type operator: (R|/b| as? R|kotlin/Boolean|)"]; + 129 [label="Const: Null(null)"]; + 130 [label="Equality operator =="]; + 131 [label="Exit when branch condition"]; + } + subgraph cluster_30 { + color=blue + 132 [label="Enter when branch condition else"]; + 133 [label="Exit when branch condition"]; + } + 134 [label="Enter when branch result"]; + subgraph cluster_31 { + color=blue + 135 [label="Enter block"]; + 136 [label="Access variable R|/b|"]; + 137 [label="Smart cast: R|/b|"]; + 138 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 139 [label="Exit block"]; + } + 140 [label="Exit when branch result"]; + 141 [label="Enter when branch result"]; + subgraph cluster_32 { + color=blue + 142 [label="Enter block"]; + 143 [label="Access variable R|/b|"]; + 144 [label="Function call: R|/b|.#()"]; + 145 [label="Exit block"]; + } + 146 [label="Exit when branch result"]; + 147 [label="Exit when"]; + } + 148 [label="Access variable R|/b|"]; + 149 [label="Function call: R|/b|.#()"]; + 150 [label="Exit block"]; + } + 151 [label="Exit function test_4" style="filled" fillcolor=red]; + } 98 -> {99}; 99 -> {100}; 100 -> {101}; - 101 -> {110 102}; + 101 -> {102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; - 106 -> {107}; + 106 -> {115 107}; 107 -> {108}; 108 -> {109}; - 109 -> {116}; + 109 -> {110}; 110 -> {111}; 111 -> {112}; 112 -> {113}; 113 -> {114}; - 114 -> {115}; + 114 -> {122}; 115 -> {116}; 116 -> {117}; 117 -> {118}; @@ -372,24 +379,31 @@ digraph casts_kt { 122 -> {123}; 123 -> {124}; 124 -> {125}; - 125 -> {134 126}; + 125 -> {126}; 126 -> {127}; 127 -> {128}; 128 -> {129}; 129 -> {130}; 130 -> {131}; - 131 -> {132}; + 131 -> {141 132}; 132 -> {133}; - 133 -> {140}; + 133 -> {134}; 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; 138 -> {139}; 139 -> {140}; - 140 -> {141}; + 140 -> {147}; 141 -> {142}; 142 -> {143}; 143 -> {144}; + 144 -> {145}; + 145 -> {146}; + 146 -> {147}; + 147 -> {148}; + 148 -> {149}; + 149 -> {150}; + 150 -> {151}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.dot index 185546a1b5d..fb9870e7817 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.dot @@ -47,15 +47,16 @@ digraph elvis_kt { color=blue 21 [label="Enter block"]; 22 [label="Access variable R|/x|"]; - 23 [label="Function call: R|/x|.R|/A.foo|()"]; - 24 [label="Exit block"]; + 23 [label="Smart cast: R|/x|"]; + 24 [label="Function call: R|/x|.R|/A.foo|()"]; + 25 [label="Exit block"]; } - 25 [label="Exit when branch result"]; - 26 [label="Exit when"]; + 26 [label="Exit when branch result"]; + 27 [label="Exit when"]; } - 27 [label="Exit block"]; + 28 [label="Exit block"]; } - 28 [label="Exit function test_1" style="filled" fillcolor=red]; + 29 [label="Exit function test_1" style="filled" fillcolor=red]; } 4 -> {5}; 5 -> {6}; @@ -69,13 +70,13 @@ digraph elvis_kt { 11 -> {12}; 12 -> {16 13}; 13 -> {14}; - 14 -> {28}; + 14 -> {29}; 14 -> {15} [style=dotted]; 15 -> {17} [style=dotted]; 16 -> {17}; 17 -> {18}; 18 -> {20 19}; - 19 -> {26}; + 19 -> {27}; 20 -> {21}; 21 -> {22}; 22 -> {23}; @@ -84,112 +85,117 @@ digraph elvis_kt { 25 -> {26}; 26 -> {27}; 27 -> {28}; + 28 -> {29}; subgraph cluster_7 { color=red - 29 [label="Enter function test2" style="filled" fillcolor=red]; + 30 [label="Enter function test2" style="filled" fillcolor=red]; subgraph cluster_8 { color=blue - 30 [label="Enter block"]; + 31 [label="Enter block"]; subgraph cluster_9 { color=blue - 31 [label="Enter when"]; + 32 [label="Enter when"]; subgraph cluster_10 { color=blue - 32 [label="Enter when branch condition "]; - 33 [label="Access variable R|/b|"]; - 34 [label="Type operator: (R|/b| !is R|kotlin/String|)"]; - 35 [label="Exit when branch condition"]; + 33 [label="Enter when branch condition "]; + 34 [label="Access variable R|/b|"]; + 35 [label="Type operator: (R|/b| !is R|kotlin/String|)"]; + 36 [label="Exit when branch condition"]; } - 36 [label="Synthetic else branch"]; - 37 [label="Enter when branch result"]; + 37 [label="Synthetic else branch"]; + 38 [label="Enter when branch result"]; subgraph cluster_11 { color=blue - 38 [label="Enter block"]; - 39 [label="Const: String()"]; - 40 [label="Jump: ^test2 String()"]; - 41 [label="Stub" style="filled" fillcolor=gray]; - 42 [label="Exit block" style="filled" fillcolor=gray]; + 39 [label="Enter block"]; + 40 [label="Const: String()"]; + 41 [label="Jump: ^test2 String()"]; + 42 [label="Stub" style="filled" fillcolor=gray]; + 43 [label="Exit block" style="filled" fillcolor=gray]; } - 43 [label="Exit when branch result" style="filled" fillcolor=gray]; - 44 [label="Exit when"]; + 44 [label="Exit when branch result" style="filled" fillcolor=gray]; + 45 [label="Exit when"]; } subgraph cluster_12 { color=blue - 45 [label="Enter when"]; + 46 [label="Enter when"]; subgraph cluster_13 { color=blue - 46 [label="Enter when branch condition "]; - 47 [label="Access variable R|/a|"]; - 48 [label="Type operator: (R|/a| !is R|kotlin/String?|)"]; - 49 [label="Exit when branch condition"]; + 47 [label="Enter when branch condition "]; + 48 [label="Access variable R|/a|"]; + 49 [label="Type operator: (R|/a| !is R|kotlin/String?|)"]; + 50 [label="Exit when branch condition"]; } - 50 [label="Synthetic else branch"]; - 51 [label="Enter when branch result"]; + 51 [label="Synthetic else branch"]; + 52 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 52 [label="Enter block"]; - 53 [label="Const: String()"]; - 54 [label="Jump: ^test2 String()"]; - 55 [label="Stub" style="filled" fillcolor=gray]; - 56 [label="Exit block" style="filled" fillcolor=gray]; + 53 [label="Enter block"]; + 54 [label="Const: String()"]; + 55 [label="Jump: ^test2 String()"]; + 56 [label="Stub" style="filled" fillcolor=gray]; + 57 [label="Exit block" style="filled" fillcolor=gray]; } - 57 [label="Exit when branch result" style="filled" fillcolor=gray]; - 58 [label="Exit when"]; + 58 [label="Exit when branch result" style="filled" fillcolor=gray]; + 59 [label="Exit when"]; } - 59 [label="Access variable R|/a|"]; - 60 [label="Exit lhs of ?:"]; - 61 [label="Enter rhs of ?:"]; - 62 [label="Access variable R|/b|"]; - 63 [label="Lhs of ?: is not null"]; - 64 [label="Exit ?:"]; - 65 [label="Jump: ^test2 R|/a| ?: R|/b|"]; - 66 [label="Stub" style="filled" fillcolor=gray]; - 67 [label="Exit block" style="filled" fillcolor=gray]; + 60 [label="Access variable R|/a|"]; + 61 [label="Smart cast: R|/a|"]; + 62 [label="Exit lhs of ?:"]; + 63 [label="Enter rhs of ?:"]; + 64 [label="Access variable R|/b|"]; + 65 [label="Smart cast: R|/b|"]; + 66 [label="Lhs of ?: is not null"]; + 67 [label="Exit ?:"]; + 68 [label="Jump: ^test2 R|/a| ?: R|/b|"]; + 69 [label="Stub" style="filled" fillcolor=gray]; + 70 [label="Exit block" style="filled" fillcolor=gray]; } - 68 [label="Exit function test2" style="filled" fillcolor=red]; + 71 [label="Exit function test2" style="filled" fillcolor=red]; } - 29 -> {30}; 30 -> {31}; 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; - 35 -> {37 36}; - 36 -> {44}; - 37 -> {38}; + 35 -> {36}; + 36 -> {38 37}; + 37 -> {45}; 38 -> {39}; 39 -> {40}; - 40 -> {68}; - 40 -> {41} [style=dotted]; + 40 -> {41}; + 41 -> {71}; 41 -> {42} [style=dotted]; 42 -> {43} [style=dotted]; 43 -> {44} [style=dotted]; - 44 -> {45}; + 44 -> {45} [style=dotted]; 45 -> {46}; 46 -> {47}; 47 -> {48}; 48 -> {49}; - 49 -> {51 50}; - 50 -> {58}; - 51 -> {52}; + 49 -> {50}; + 50 -> {52 51}; + 51 -> {59}; 52 -> {53}; 53 -> {54}; - 54 -> {68}; - 54 -> {55} [style=dotted]; + 54 -> {55}; + 55 -> {71}; 55 -> {56} [style=dotted]; 56 -> {57} [style=dotted]; 57 -> {58} [style=dotted]; - 58 -> {59}; + 58 -> {59} [style=dotted]; 59 -> {60}; - 60 -> {63 61}; + 60 -> {61}; 61 -> {62}; - 62 -> {64}; + 62 -> {66 63}; 63 -> {64}; 64 -> {65}; - 65 -> {68}; - 65 -> {66} [style=dotted]; - 66 -> {67} [style=dotted]; - 67 -> {68} [style=dotted]; + 65 -> {67}; + 66 -> {67}; + 67 -> {68}; + 68 -> {71}; + 68 -> {69} [style=dotted]; + 69 -> {70} [style=dotted]; + 70 -> {71} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.dot index bbd3f775303..8d5d2067783 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.dot @@ -36,17 +36,18 @@ digraph returns_kt { color=blue 14 [label="Enter block"]; 15 [label="Access variable R|/x|"]; - 16 [label="Access variable R|kotlin/String.length|"]; - 17 [label="Exit block"]; + 16 [label="Smart cast: R|/x|"]; + 17 [label="Access variable R|kotlin/String.length|"]; + 18 [label="Exit block"]; } - 18 [label="Exit when branch result"]; - 19 [label="Exit when"]; + 19 [label="Exit when branch result"]; + 20 [label="Exit when"]; } - 20 [label="Access variable R|/x|"]; - 21 [label="Access variable #"]; - 22 [label="Exit block"]; + 21 [label="Access variable R|/x|"]; + 22 [label="Access variable #"]; + 23 [label="Exit block"]; } - 23 [label="Exit function test_0" style="filled" fillcolor=red]; + 24 [label="Exit function test_0" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -60,7 +61,7 @@ digraph returns_kt { 9 -> {10}; 10 -> {11}; 11 -> {12}; - 12 -> {19}; + 12 -> {20}; 13 -> {14}; 14 -> {15}; 15 -> {16}; @@ -71,71 +72,73 @@ digraph returns_kt { 20 -> {21}; 21 -> {22}; 22 -> {23}; + 23 -> {24}; subgraph cluster_7 { color=red - 24 [label="Enter function test_1" style="filled" fillcolor=red]; + 25 [label="Enter function test_1" style="filled" fillcolor=red]; subgraph cluster_8 { color=blue - 25 [label="Enter block"]; + 26 [label="Enter block"]; subgraph cluster_9 { color=blue - 26 [label="Enter when"]; + 27 [label="Enter when"]; subgraph cluster_10 { color=blue - 27 [label="Enter when branch condition "]; - 28 [label="Access variable R|/x|"]; - 29 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 30 [label="Exit when branch condition"]; + 28 [label="Enter when branch condition "]; + 29 [label="Access variable R|/x|"]; + 30 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 31 [label="Exit when branch condition"]; } subgraph cluster_11 { color=blue - 31 [label="Enter when branch condition else"]; - 32 [label="Exit when branch condition"]; + 32 [label="Enter when branch condition else"]; + 33 [label="Exit when branch condition"]; } - 33 [label="Enter when branch result"]; + 34 [label="Enter when branch result"]; subgraph cluster_12 { color=blue - 34 [label="Enter block"]; - 35 [label="Jump: ^test_1 Unit"]; - 36 [label="Stub" style="filled" fillcolor=gray]; - 37 [label="Exit block" style="filled" fillcolor=gray]; + 35 [label="Enter block"]; + 36 [label="Jump: ^test_1 Unit"]; + 37 [label="Stub" style="filled" fillcolor=gray]; + 38 [label="Exit block" style="filled" fillcolor=gray]; } - 38 [label="Exit when branch result" style="filled" fillcolor=gray]; - 39 [label="Enter when branch result"]; + 39 [label="Exit when branch result" style="filled" fillcolor=gray]; + 40 [label="Enter when branch result"]; subgraph cluster_13 { color=blue - 40 [label="Enter block"]; - 41 [label="Access variable R|/x|"]; - 42 [label="Access variable R|kotlin/String.length|"]; - 43 [label="Exit block"]; + 41 [label="Enter block"]; + 42 [label="Access variable R|/x|"]; + 43 [label="Smart cast: R|/x|"]; + 44 [label="Access variable R|kotlin/String.length|"]; + 45 [label="Exit block"]; } - 44 [label="Exit when branch result"]; - 45 [label="Exit when"]; + 46 [label="Exit when branch result"]; + 47 [label="Exit when"]; } - 46 [label="Access variable R|/x|"]; - 47 [label="Access variable R|kotlin/String.length|"]; - 48 [label="Exit block"]; + 48 [label="Access variable R|/x|"]; + 49 [label="Smart cast: R|/x|"]; + 50 [label="Access variable R|kotlin/String.length|"]; + 51 [label="Exit block"]; } - 49 [label="Exit function test_1" style="filled" fillcolor=red]; + 52 [label="Exit function test_1" style="filled" fillcolor=red]; } - 24 -> {25}; 25 -> {26}; 26 -> {27}; 27 -> {28}; 28 -> {29}; 29 -> {30}; - 30 -> {39 31}; - 31 -> {32}; + 30 -> {31}; + 31 -> {40 32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; - 35 -> {49}; - 35 -> {36} [style=dotted]; + 35 -> {36}; + 36 -> {52}; 36 -> {37} [style=dotted]; 37 -> {38} [style=dotted]; - 38 -> {45} [style=dotted]; - 39 -> {40}; + 38 -> {39} [style=dotted]; + 39 -> {47} [style=dotted]; 40 -> {41}; 41 -> {42}; 42 -> {43}; @@ -145,146 +148,151 @@ digraph returns_kt { 46 -> {47}; 47 -> {48}; 48 -> {49}; + 49 -> {50}; + 50 -> {51}; + 51 -> {52}; subgraph cluster_14 { color=red - 50 [label="Enter function foo" style="filled" fillcolor=red]; - 51 [label="Exit function foo" style="filled" fillcolor=red]; + 53 [label="Enter function foo" style="filled" fillcolor=red]; + 54 [label="Exit function foo" style="filled" fillcolor=red]; } - 50 -> {51}; + 53 -> {54}; subgraph cluster_15 { color=red - 52 [label="Enter class A" style="filled" fillcolor=red]; - 53 [label="Exit class A" style="filled" fillcolor=red]; + 55 [label="Enter class A" style="filled" fillcolor=red]; + 56 [label="Exit class A" style="filled" fillcolor=red]; } - 52 -> {53} [color=green]; + 55 -> {56} [color=green]; subgraph cluster_16 { color=red - 54 [label="Enter function bar" style="filled" fillcolor=red]; - 55 [label="Exit function bar" style="filled" fillcolor=red]; + 57 [label="Enter function bar" style="filled" fillcolor=red]; + 58 [label="Exit function bar" style="filled" fillcolor=red]; } - 54 -> {55}; + 57 -> {58}; subgraph cluster_17 { color=red - 56 [label="Enter class B" style="filled" fillcolor=red]; - 57 [label="Exit class B" style="filled" fillcolor=red]; + 59 [label="Enter class B" style="filled" fillcolor=red]; + 60 [label="Exit class B" style="filled" fillcolor=red]; } - 56 -> {57} [color=green]; + 59 -> {60} [color=green]; subgraph cluster_18 { color=red - 58 [label="Enter function baz" style="filled" fillcolor=red]; - 59 [label="Exit function baz" style="filled" fillcolor=red]; + 61 [label="Enter function baz" style="filled" fillcolor=red]; + 62 [label="Exit function baz" style="filled" fillcolor=red]; } - 58 -> {59}; + 61 -> {62}; subgraph cluster_19 { color=red - 60 [label="Enter class C" style="filled" fillcolor=red]; - 61 [label="Exit class C" style="filled" fillcolor=red]; + 63 [label="Enter class C" style="filled" fillcolor=red]; + 64 [label="Exit class C" style="filled" fillcolor=red]; } - 60 -> {61} [color=green]; + 63 -> {64} [color=green]; subgraph cluster_20 { color=red - 62 [label="Enter function test_2" style="filled" fillcolor=red]; + 65 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 63 [label="Enter block"]; + 66 [label="Enter block"]; subgraph cluster_22 { color=blue - 64 [label="Enter when"]; + 67 [label="Enter when"]; subgraph cluster_23 { color=blue - 65 [label="Enter when branch condition "]; - 66 [label="Access variable R|/x|"]; - 67 [label="Type operator: (R|/x| is R|B|)"]; - 68 [label="Exit when branch condition"]; + 68 [label="Enter when branch condition "]; + 69 [label="Access variable R|/x|"]; + 70 [label="Type operator: (R|/x| is R|B|)"]; + 71 [label="Exit when branch condition"]; } subgraph cluster_24 { color=blue - 69 [label="Enter when branch condition "]; - 70 [label="Access variable R|/x|"]; - 71 [label="Type operator: (R|/x| is R|C|)"]; - 72 [label="Exit when branch condition"]; + 72 [label="Enter when branch condition "]; + 73 [label="Access variable R|/x|"]; + 74 [label="Type operator: (R|/x| is R|C|)"]; + 75 [label="Exit when branch condition"]; } subgraph cluster_25 { color=blue - 73 [label="Enter when branch condition else"]; - 74 [label="Exit when branch condition"]; + 76 [label="Enter when branch condition else"]; + 77 [label="Exit when branch condition"]; } - 75 [label="Enter when branch result"]; + 78 [label="Enter when branch result"]; subgraph cluster_26 { color=blue - 76 [label="Enter block"]; - 77 [label="Jump: ^test_2 Unit"]; - 78 [label="Stub" style="filled" fillcolor=gray]; - 79 [label="Exit block" style="filled" fillcolor=gray]; + 79 [label="Enter block"]; + 80 [label="Jump: ^test_2 Unit"]; + 81 [label="Stub" style="filled" fillcolor=gray]; + 82 [label="Exit block" style="filled" fillcolor=gray]; } - 80 [label="Exit when branch result" style="filled" fillcolor=gray]; - 81 [label="Enter when branch result"]; + 83 [label="Exit when branch result" style="filled" fillcolor=gray]; + 84 [label="Enter when branch result"]; subgraph cluster_27 { color=blue - 82 [label="Enter block"]; - 83 [label="Access variable R|/x|"]; - 84 [label="Function call: R|/x|.R|/C.baz|()"]; - 85 [label="Exit block"]; + 85 [label="Enter block"]; + 86 [label="Access variable R|/x|"]; + 87 [label="Smart cast: R|/x|"]; + 88 [label="Function call: R|/x|.R|/C.baz|()"]; + 89 [label="Exit block"]; } - 86 [label="Exit when branch result"]; - 87 [label="Enter when branch result"]; + 90 [label="Exit when branch result"]; + 91 [label="Enter when branch result"]; subgraph cluster_28 { color=blue - 88 [label="Enter block"]; - 89 [label="Access variable R|/x|"]; - 90 [label="Function call: R|/x|.R|/B.bar|()"]; - 91 [label="Exit block"]; + 92 [label="Enter block"]; + 93 [label="Access variable R|/x|"]; + 94 [label="Smart cast: R|/x|"]; + 95 [label="Function call: R|/x|.R|/B.bar|()"]; + 96 [label="Exit block"]; } - 92 [label="Exit when branch result"]; - 93 [label="Exit when"]; + 97 [label="Exit when branch result"]; + 98 [label="Exit when"]; } - 94 [label="Access variable R|/x|"]; - 95 [label="Function call: R|/x|.R|/A.foo|()"]; - 96 [label="Access variable R|/x|"]; - 97 [label="Function call: R|/x|.#()"]; - 98 [label="Access variable R|/x|"]; - 99 [label="Function call: R|/x|.#()"]; - 100 [label="Exit block"]; + 99 [label="Access variable R|/x|"]; + 100 [label="Smart cast: R|/x|"]; + 101 [label="Function call: R|/x|.R|/A.foo|()"]; + 102 [label="Access variable R|/x|"]; + 103 [label="Smart cast: R|/x|"]; + 104 [label="Function call: R|/x|.#()"]; + 105 [label="Access variable R|/x|"]; + 106 [label="Smart cast: R|/x|"]; + 107 [label="Function call: R|/x|.#()"]; + 108 [label="Exit block"]; } - 101 [label="Exit function test_2" style="filled" fillcolor=red]; + 109 [label="Exit function test_2" style="filled" fillcolor=red]; } - 62 -> {63}; - 63 -> {64}; - 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; - 68 -> {87 69}; + 68 -> {69}; 69 -> {70}; 70 -> {71}; - 71 -> {72}; - 72 -> {81 73}; + 71 -> {91 72}; + 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {76}; + 75 -> {84 76}; 76 -> {77}; - 77 -> {101}; - 77 -> {78} [style=dotted]; - 78 -> {79} [style=dotted]; - 79 -> {80} [style=dotted]; - 80 -> {93} [style=dotted]; - 81 -> {82}; - 82 -> {83}; - 83 -> {84}; + 77 -> {78}; + 78 -> {79}; + 79 -> {80}; + 80 -> {109}; + 80 -> {81} [style=dotted]; + 81 -> {82} [style=dotted]; + 82 -> {83} [style=dotted]; + 83 -> {98} [style=dotted]; 84 -> {85}; 85 -> {86}; - 86 -> {93}; + 86 -> {87}; 87 -> {88}; 88 -> {89}; 89 -> {90}; - 90 -> {91}; + 90 -> {98}; 91 -> {92}; 92 -> {93}; 93 -> {94}; @@ -295,203 +303,217 @@ digraph returns_kt { 98 -> {99}; 99 -> {100}; 100 -> {101}; - - subgraph cluster_29 { - color=red - 102 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_30 { - color=blue - 103 [label="Enter block"]; - subgraph cluster_31 { - color=blue - 104 [label="Enter when"]; - subgraph cluster_32 { - color=blue - 105 [label="Enter when branch condition "]; - 106 [label="Access variable R|/x|"]; - 107 [label="Type operator: (R|/x| is R|B|)"]; - 108 [label="Exit when branch condition"]; - } - subgraph cluster_33 { - color=blue - 109 [label="Enter when branch condition "]; - 110 [label="Access variable R|/x|"]; - 111 [label="Type operator: (R|/x| is R|C|)"]; - 112 [label="Exit when branch condition"]; - } - 113 [label="Synthetic else branch"]; - 114 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 115 [label="Enter block"]; - 116 [label="Access variable R|/x|"]; - 117 [label="Function call: R|/x|.R|/C.baz|()"]; - 118 [label="Exit block"]; - } - 119 [label="Exit when branch result"]; - 120 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 121 [label="Enter block"]; - 122 [label="Access variable R|/x|"]; - 123 [label="Function call: R|/x|.R|/B.bar|()"]; - 124 [label="Exit block"]; - } - 125 [label="Exit when branch result"]; - 126 [label="Exit when"]; - } - 127 [label="Access variable R|/x|"]; - 128 [label="Function call: R|/x|.#()"]; - 129 [label="Access variable R|/x|"]; - 130 [label="Function call: R|/x|.#()"]; - 131 [label="Access variable R|/x|"]; - 132 [label="Function call: R|/x|.#()"]; - 133 [label="Exit block"]; - } - 134 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 101 -> {102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {120 109}; - 109 -> {110}; + 108 -> {109}; + + subgraph cluster_29 { + color=red + 110 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_30 { + color=blue + 111 [label="Enter block"]; + subgraph cluster_31 { + color=blue + 112 [label="Enter when"]; + subgraph cluster_32 { + color=blue + 113 [label="Enter when branch condition "]; + 114 [label="Access variable R|/x|"]; + 115 [label="Type operator: (R|/x| is R|B|)"]; + 116 [label="Exit when branch condition"]; + } + subgraph cluster_33 { + color=blue + 117 [label="Enter when branch condition "]; + 118 [label="Access variable R|/x|"]; + 119 [label="Type operator: (R|/x| is R|C|)"]; + 120 [label="Exit when branch condition"]; + } + 121 [label="Synthetic else branch"]; + 122 [label="Enter when branch result"]; + subgraph cluster_34 { + color=blue + 123 [label="Enter block"]; + 124 [label="Access variable R|/x|"]; + 125 [label="Smart cast: R|/x|"]; + 126 [label="Function call: R|/x|.R|/C.baz|()"]; + 127 [label="Exit block"]; + } + 128 [label="Exit when branch result"]; + 129 [label="Enter when branch result"]; + subgraph cluster_35 { + color=blue + 130 [label="Enter block"]; + 131 [label="Access variable R|/x|"]; + 132 [label="Smart cast: R|/x|"]; + 133 [label="Function call: R|/x|.R|/B.bar|()"]; + 134 [label="Exit block"]; + } + 135 [label="Exit when branch result"]; + 136 [label="Exit when"]; + } + 137 [label="Access variable R|/x|"]; + 138 [label="Function call: R|/x|.#()"]; + 139 [label="Access variable R|/x|"]; + 140 [label="Function call: R|/x|.#()"]; + 141 [label="Access variable R|/x|"]; + 142 [label="Function call: R|/x|.#()"]; + 143 [label="Exit block"]; + } + 144 [label="Exit function test_3" style="filled" fillcolor=red]; + } 110 -> {111}; 111 -> {112}; - 112 -> {114 113}; - 113 -> {126}; + 112 -> {113}; + 113 -> {114}; 114 -> {115}; 115 -> {116}; - 116 -> {117}; + 116 -> {129 117}; 117 -> {118}; 118 -> {119}; - 119 -> {126}; - 120 -> {121}; - 121 -> {122}; + 119 -> {120}; + 120 -> {122 121}; + 121 -> {136}; 122 -> {123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; 126 -> {127}; 127 -> {128}; - 128 -> {129}; + 128 -> {136}; 129 -> {130}; 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; - - subgraph cluster_36 { - color=red - 135 [label="Enter function runHigherOrder" style="filled" fillcolor=red]; - subgraph cluster_37 { - color=blue - 136 [label="Enter block"]; - 137 [label="Function call: R|/f|.R|SubstitutionOverride|()"]; - 138 [label="Jump: ^runHigherOrder R|/f|.R|SubstitutionOverride|()"]; - 139 [label="Stub" style="filled" fillcolor=gray]; - 140 [label="Exit block" style="filled" fillcolor=gray]; - } - 141 [label="Exit function runHigherOrder" style="filled" fillcolor=red]; - } + 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; - 138 -> {141}; - 138 -> {139} [style=dotted]; - 139 -> {140} [style=dotted]; - 140 -> {141} [style=dotted]; + 138 -> {139}; + 139 -> {140}; + 140 -> {141}; + 141 -> {142}; + 142 -> {143}; + 143 -> {144}; + + subgraph cluster_36 { + color=red + 145 [label="Enter function runHigherOrder" style="filled" fillcolor=red]; + subgraph cluster_37 { + color=blue + 146 [label="Enter block"]; + 147 [label="Function call: R|/f|.R|SubstitutionOverride|()"]; + 148 [label="Jump: ^runHigherOrder R|/f|.R|SubstitutionOverride|()"]; + 149 [label="Stub" style="filled" fillcolor=gray]; + 150 [label="Exit block" style="filled" fillcolor=gray]; + } + 151 [label="Exit function runHigherOrder" style="filled" fillcolor=red]; + } + 145 -> {146}; + 146 -> {147}; + 147 -> {148}; + 148 -> {151}; + 148 -> {149} [style=dotted]; + 149 -> {150} [style=dotted]; + 150 -> {151} [style=dotted]; subgraph cluster_38 { color=red - 142 [label="Enter function getter" style="filled" fillcolor=red]; + 152 [label="Enter function getter" style="filled" fillcolor=red]; subgraph cluster_39 { color=blue - 143 [label="Enter block"]; - 144 [label="Access variable R|kotlin/String.length|"]; - 145 [label="Jump: ^ this@R|/ext|.R|kotlin/String.length|"]; - 146 [label="Stub" style="filled" fillcolor=gray]; - 147 [label="Exit block" style="filled" fillcolor=gray]; + 153 [label="Enter block"]; + 154 [label="Access variable R|kotlin/String.length|"]; + 155 [label="Jump: ^ this@R|/ext|.R|kotlin/String.length|"]; + 156 [label="Stub" style="filled" fillcolor=gray]; + 157 [label="Exit block" style="filled" fillcolor=gray]; } - 148 [label="Exit function getter" style="filled" fillcolor=red]; + 158 [label="Exit function getter" style="filled" fillcolor=red]; } - 142 -> {143}; - 143 -> {144}; - 144 -> {145}; - 145 -> {148}; - 145 -> {146} [style=dotted]; - 146 -> {147} [style=dotted]; - 147 -> {148} [style=dotted]; - - subgraph cluster_40 { - color=red - 149 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_41 { - color=blue - 150 [label="Enter block"]; - 151 [label="Access variable R|/a|"]; - 152 [label="Type operator: (R|/a| as? R|kotlin/String|)"]; - 153 [label="Variable declaration: lval s: R|kotlin/String?|"]; - 154 [label="Access variable R|/s|"]; - 155 [label="Enter safe call"]; - 156 [label="Access variable R|/ext|"]; - 157 [label="Exit safe call"]; - 158 [label="Exit lhs of ?:"]; - 159 [label="Enter rhs of ?:"]; - 160 [label="Jump: ^test_4 Unit"]; - 161 [label="Stub" style="filled" fillcolor=gray]; - 162 [label="Lhs of ?: is not null"]; - 163 [label="Exit ?:"]; - 164 [label="Variable declaration: lval length: R|kotlin/Int|"]; - 165 [label="Postponed enter to lambda"]; - subgraph cluster_42 { - color=blue - 170 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - subgraph cluster_43 { - color=blue - 171 [label="Enter block"]; - 172 [label="Access variable R|/s|"]; - 173 [label="Access variable R|kotlin/String.length|"]; - 174 [label="Exit block"]; - } - 175 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; - } - 166 [label="Postponed exit from lambda"]; - 167 [label="Function call: R|/runHigherOrder|(...)"]; - 168 [label="Exit block"]; - } - 169 [label="Exit function test_4" style="filled" fillcolor=red]; - } - 149 -> {150}; - 150 -> {151}; - 151 -> {152}; 152 -> {153}; 153 -> {154}; 154 -> {155}; - 154 -> {157} [color=red]; - 154 -> {159} [color=green]; - 155 -> {156}; - 156 -> {157}; - 157 -> {158}; - 158 -> {162 159}; + 155 -> {158}; + 155 -> {156} [style=dotted]; + 156 -> {157} [style=dotted]; + 157 -> {158} [style=dotted]; + + subgraph cluster_40 { + color=red + 159 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_41 { + color=blue + 160 [label="Enter block"]; + 161 [label="Access variable R|/a|"]; + 162 [label="Type operator: (R|/a| as? R|kotlin/String|)"]; + 163 [label="Variable declaration: lval s: R|kotlin/String?|"]; + 164 [label="Access variable R|/s|"]; + 165 [label="Enter safe call"]; + 166 [label="Access variable R|/ext|"]; + 167 [label="Exit safe call"]; + 168 [label="Exit lhs of ?:"]; + 169 [label="Enter rhs of ?:"]; + 170 [label="Jump: ^test_4 Unit"]; + 171 [label="Stub" style="filled" fillcolor=gray]; + 172 [label="Lhs of ?: is not null"]; + 173 [label="Exit ?:"]; + 174 [label="Variable declaration: lval length: R|kotlin/Int|"]; + 175 [label="Postponed enter to lambda"]; + subgraph cluster_42 { + color=blue + 180 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_43 { + color=blue + 181 [label="Enter block"]; + 182 [label="Access variable R|/s|"]; + 183 [label="Smart cast: R|/s|"]; + 184 [label="Access variable R|kotlin/String.length|"]; + 185 [label="Exit block"]; + } + 186 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 176 [label="Postponed exit from lambda"]; + 177 [label="Function call: R|/runHigherOrder|(...)"]; + 178 [label="Exit block"]; + } + 179 [label="Exit function test_4" style="filled" fillcolor=red]; + } 159 -> {160}; - 160 -> {169}; - 160 -> {161} [style=dotted]; - 161 -> {163} [style=dotted]; + 160 -> {161}; + 161 -> {162}; 162 -> {163}; 163 -> {164}; 164 -> {165}; - 165 -> {166 170}; - 165 -> {170} [style=dashed]; + 164 -> {167} [color=red]; + 164 -> {169} [color=green]; + 165 -> {166}; 166 -> {167}; 167 -> {168}; - 168 -> {169}; - 170 -> {171}; - 171 -> {172}; + 168 -> {172 169}; + 169 -> {170}; + 170 -> {179}; + 170 -> {171} [style=dotted]; + 171 -> {173} [style=dotted]; 172 -> {173}; 173 -> {174}; 174 -> {175}; + 175 -> {176 180}; + 175 -> {180} [style=dashed]; + 176 -> {177}; + 177 -> {178}; + 178 -> {179}; + 180 -> {181}; + 181 -> {182}; + 182 -> {183}; + 183 -> {184}; + 184 -> {185}; + 185 -> {186}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/simpleIf.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/simpleIf.dot index d8b0cdd4a13..c6ae77b4b56 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/simpleIf.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/simpleIf.dot @@ -25,17 +25,18 @@ digraph simpleIf_kt { color=blue 9 [label="Enter block"]; 10 [label="Access variable R|/x|"]; - 11 [label="Access variable R|kotlin/String.length|"]; - 12 [label="Exit block"]; + 11 [label="Smart cast: R|/x|"]; + 12 [label="Access variable R|kotlin/String.length|"]; + 13 [label="Exit block"]; } - 13 [label="Exit when branch result"]; - 14 [label="Exit when"]; + 14 [label="Exit when branch result"]; + 15 [label="Exit when"]; } - 15 [label="Access variable R|/x|"]; - 16 [label="Access variable #"]; - 17 [label="Exit block"]; + 16 [label="Access variable R|/x|"]; + 17 [label="Access variable #"]; + 18 [label="Exit block"]; } - 18 [label="Exit function test_1" style="filled" fillcolor=red]; + 19 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -44,7 +45,7 @@ digraph simpleIf_kt { 4 -> {5}; 5 -> {6}; 6 -> {8 7}; - 7 -> {14}; + 7 -> {15}; 8 -> {9}; 9 -> {10}; 10 -> {11}; @@ -55,44 +56,45 @@ digraph simpleIf_kt { 15 -> {16}; 16 -> {17}; 17 -> {18}; + 18 -> {19}; subgraph cluster_5 { color=red - 19 [label="Enter function test_2" style="filled" fillcolor=red]; + 20 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_6 { color=blue - 20 [label="Enter block"]; - 21 [label="Access variable R|/x|"]; - 22 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 23 [label="Variable declaration: lval b: R|kotlin/Boolean|"]; + 21 [label="Enter block"]; + 22 [label="Access variable R|/x|"]; + 23 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 24 [label="Variable declaration: lval b: R|kotlin/Boolean|"]; subgraph cluster_7 { color=blue - 24 [label="Enter when"]; + 25 [label="Enter when"]; subgraph cluster_8 { color=blue - 25 [label="Enter when branch condition "]; - 26 [label="Access variable R|/b|"]; - 27 [label="Exit when branch condition"]; + 26 [label="Enter when branch condition "]; + 27 [label="Access variable R|/b|"]; + 28 [label="Exit when branch condition"]; } - 28 [label="Synthetic else branch"]; - 29 [label="Enter when branch result"]; + 29 [label="Synthetic else branch"]; + 30 [label="Enter when branch result"]; subgraph cluster_9 { color=blue - 30 [label="Enter block"]; - 31 [label="Access variable R|/x|"]; - 32 [label="Access variable R|kotlin/String.length|"]; - 33 [label="Exit block"]; + 31 [label="Enter block"]; + 32 [label="Access variable R|/x|"]; + 33 [label="Smart cast: R|/x|"]; + 34 [label="Access variable R|kotlin/String.length|"]; + 35 [label="Exit block"]; } - 34 [label="Exit when branch result"]; - 35 [label="Exit when"]; + 36 [label="Exit when branch result"]; + 37 [label="Exit when"]; } - 36 [label="Access variable R|/x|"]; - 37 [label="Access variable #"]; - 38 [label="Exit block"]; + 38 [label="Access variable R|/x|"]; + 39 [label="Access variable #"]; + 40 [label="Exit block"]; } - 39 [label="Exit function test_2" style="filled" fillcolor=red]; + 41 [label="Exit function test_2" style="filled" fillcolor=red]; } - 19 -> {20}; 20 -> {21}; 21 -> {22}; 22 -> {23}; @@ -100,9 +102,9 @@ digraph simpleIf_kt { 24 -> {25}; 25 -> {26}; 26 -> {27}; - 27 -> {29 28}; - 28 -> {35}; - 29 -> {30}; + 27 -> {28}; + 28 -> {30 29}; + 29 -> {37}; 30 -> {31}; 31 -> {32}; 32 -> {33}; @@ -112,96 +114,104 @@ digraph simpleIf_kt { 36 -> {37}; 37 -> {38}; 38 -> {39}; + 39 -> {40}; + 40 -> {41}; subgraph cluster_10 { color=red - 40 [label="Enter function test_3" style="filled" fillcolor=red]; + 42 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 41 [label="Enter block"]; + 43 [label="Enter block"]; subgraph cluster_12 { color=blue - 42 [label="Enter when"]; + 44 [label="Enter when"]; subgraph cluster_13 { color=blue - 43 [label="Enter when branch condition "]; - 44 [label="Access variable R|/x|"]; - 45 [label="Type operator: (R|/x| !is R|kotlin/String|)"]; - 46 [label="Exit when branch condition"]; + 45 [label="Enter when branch condition "]; + 46 [label="Access variable R|/x|"]; + 47 [label="Type operator: (R|/x| !is R|kotlin/String|)"]; + 48 [label="Exit when branch condition"]; } subgraph cluster_14 { color=blue - 47 [label="Enter when branch condition "]; - 48 [label="Access variable R|/x|"]; - 49 [label="Type operator: (R|/x| !is R|kotlin/Int|)"]; - 50 [label="Exit when branch condition"]; + 49 [label="Enter when branch condition "]; + 50 [label="Access variable R|/x|"]; + 51 [label="Smart cast: R|/x|"]; + 52 [label="Type operator: (R|/x| !is R|kotlin/Int|)"]; + 53 [label="Exit when branch condition"]; } subgraph cluster_15 { color=blue - 51 [label="Enter when branch condition else"]; - 52 [label="Exit when branch condition"]; + 54 [label="Enter when branch condition else"]; + 55 [label="Exit when branch condition"]; } - 53 [label="Enter when branch result"]; + 56 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 54 [label="Enter block"]; - 55 [label="Access variable R|/x|"]; - 56 [label="Access variable R|kotlin/String.length|"]; - 57 [label="Access variable R|/x|"]; - 58 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 59 [label="Exit block"]; + 57 [label="Enter block"]; + 58 [label="Access variable R|/x|"]; + 59 [label="Smart cast: R|/x|"]; + 60 [label="Access variable R|kotlin/String.length|"]; + 61 [label="Access variable R|/x|"]; + 62 [label="Smart cast: R|/x|"]; + 63 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 64 [label="Exit block"]; } - 60 [label="Exit when branch result"]; - 61 [label="Enter when branch result"]; + 65 [label="Exit when branch result"]; + 66 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 62 [label="Enter block"]; - 63 [label="Exit block"]; + 67 [label="Enter block"]; + 68 [label="Exit block"]; } - 64 [label="Exit when branch result"]; - 65 [label="Enter when branch result"]; + 69 [label="Exit when branch result"]; + 70 [label="Enter when branch result"]; subgraph cluster_18 { color=blue - 66 [label="Enter block"]; - 67 [label="Exit block"]; + 71 [label="Enter block"]; + 72 [label="Exit block"]; } - 68 [label="Exit when branch result"]; - 69 [label="Exit when"]; + 73 [label="Exit when branch result"]; + 74 [label="Exit when"]; } - 70 [label="Exit block"]; + 75 [label="Exit block"]; } - 71 [label="Exit function test_3" style="filled" fillcolor=red]; + 76 [label="Exit function test_3" style="filled" fillcolor=red]; } - 40 -> {41}; - 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; - 46 -> {65 47}; + 46 -> {47}; 47 -> {48}; - 48 -> {49}; + 48 -> {70 49}; 49 -> {50}; - 50 -> {61 51}; + 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {54}; + 53 -> {66 54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; - 60 -> {69}; + 60 -> {61}; 61 -> {62}; 62 -> {63}; 63 -> {64}; - 64 -> {69}; - 65 -> {66}; + 64 -> {65}; + 65 -> {74}; 66 -> {67}; 67 -> {68}; 68 -> {69}; - 69 -> {70}; + 69 -> {74}; 70 -> {71}; + 71 -> {72}; + 72 -> {73}; + 73 -> {74}; + 74 -> {75}; + 75 -> {76}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot index fdd4aa077e9..9f10ef0f3a3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot @@ -67,15 +67,16 @@ digraph smartcastFromArgument_kt { color=blue 27 [label="Enter block"]; 28 [label="Access variable R|/a|"]; - 29 [label="Function call: R|/a|.R|/A.foo|()"]; - 30 [label="Exit block"]; + 29 [label="Smart cast: R|/a|"]; + 30 [label="Function call: R|/a|.R|/A.foo|()"]; + 31 [label="Exit block"]; } - 31 [label="Exit when branch result"]; - 32 [label="Exit when"]; + 32 [label="Exit when branch result"]; + 33 [label="Exit when"]; } - 33 [label="Exit block"]; + 34 [label="Exit block"]; } - 34 [label="Exit function test" style="filled" fillcolor=red]; + 35 [label="Exit function test" style="filled" fillcolor=red]; } 11 -> {12}; 12 -> {13}; @@ -85,14 +86,14 @@ digraph smartcastFromArgument_kt { 16 -> {17}; 17 -> {21 18}; 18 -> {19}; - 19 -> {34}; + 19 -> {35}; 19 -> {20} [style=dotted]; 20 -> {22} [style=dotted]; 21 -> {22}; 22 -> {23}; 23 -> {24}; 24 -> {26 25}; - 25 -> {32}; + 25 -> {33}; 26 -> {27}; 27 -> {28}; 28 -> {29}; @@ -101,5 +102,6 @@ digraph smartcastFromArgument_kt { 31 -> {32}; 32 -> {33}; 33 -> {34}; + 34 -> {35}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.dot index 62db6ca5fe4..de82071e2ad 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.dot @@ -60,95 +60,105 @@ digraph when_kt { color=blue 21 [label="Enter block"]; 22 [label="Access variable R|/x|"]; - 23 [label="Function call: R|/x|.R|/B.bar|()"]; - 24 [label="Exit block"]; + 23 [label="Smart cast: R|/x|"]; + 24 [label="Function call: R|/x|.R|/B.bar|()"]; + 25 [label="Exit block"]; } - 25 [label="Exit when branch result"]; - 26 [label="Enter when branch result"]; + 26 [label="Exit when branch result"]; + 27 [label="Enter when branch result"]; subgraph cluster_10 { color=blue - 27 [label="Enter block"]; - 28 [label="Access variable R|/x|"]; - 29 [label="Function call: R|/x|.R|/A.foo|()"]; - 30 [label="Exit block"]; + 28 [label="Enter block"]; + 29 [label="Access variable R|/x|"]; + 30 [label="Smart cast: R|/x|"]; + 31 [label="Function call: R|/x|.R|/A.foo|()"]; + 32 [label="Exit block"]; } - 31 [label="Exit when branch result"]; - 32 [label="Exit when"]; + 33 [label="Exit when branch result"]; + 34 [label="Exit when"]; } subgraph cluster_11 { color=blue - 33 [label="Enter when"]; + 35 [label="Enter when"]; subgraph cluster_12 { color=blue - 34 [label="Enter when branch condition "]; - 35 [label="Access variable R|/x|"]; - 36 [label="Type operator: (R|/x| !is R|A|)"]; - 37 [label="Exit when branch condition"]; + 36 [label="Enter when branch condition "]; + 37 [label="Access variable R|/x|"]; + 38 [label="Type operator: (R|/x| !is R|A|)"]; + 39 [label="Exit when branch condition"]; } subgraph cluster_13 { color=blue - 38 [label="Enter when branch condition "]; - 39 [label="Access variable R|/x|"]; - 40 [label="Type operator: (R|/x| !is R|B|)"]; - 41 [label="Exit when branch condition"]; + 40 [label="Enter when branch condition "]; + 41 [label="Access variable R|/x|"]; + 42 [label="Smart cast: R|/x|"]; + 43 [label="Type operator: (R|/x| !is R|B|)"]; + 44 [label="Exit when branch condition"]; } subgraph cluster_14 { color=blue - 42 [label="Enter when branch condition "]; - 43 [label="Access variable R|/x|"]; - 44 [label="Type operator: (R|/x| is R|kotlin/Int|)"]; - 45 [label="Exit when branch condition"]; + 45 [label="Enter when branch condition "]; + 46 [label="Access variable R|/x|"]; + 47 [label="Smart cast: R|/x|"]; + 48 [label="Type operator: (R|/x| is R|kotlin/Int|)"]; + 49 [label="Exit when branch condition"]; } subgraph cluster_15 { color=blue - 46 [label="Enter when branch condition else"]; - 47 [label="Exit when branch condition"]; + 50 [label="Enter when branch condition else"]; + 51 [label="Exit when branch condition"]; } - 48 [label="Enter when branch result"]; + 52 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 49 [label="Enter block"]; - 50 [label="Access variable R|/x|"]; - 51 [label="Function call: R|/x|.R|/A.foo|()"]; - 52 [label="Access variable R|/x|"]; - 53 [label="Function call: R|/x|.R|/B.bar|()"]; - 54 [label="Exit block"]; + 53 [label="Enter block"]; + 54 [label="Access variable R|/x|"]; + 55 [label="Smart cast: R|/x|"]; + 56 [label="Function call: R|/x|.R|/A.foo|()"]; + 57 [label="Access variable R|/x|"]; + 58 [label="Smart cast: R|/x|"]; + 59 [label="Function call: R|/x|.R|/B.bar|()"]; + 60 [label="Exit block"]; } - 55 [label="Exit when branch result"]; - 56 [label="Enter when branch result"]; + 61 [label="Exit when branch result"]; + 62 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 57 [label="Enter block"]; - 58 [label="Access variable R|/x|"]; - 59 [label="Function call: R|/x|.R|/A.foo|()"]; - 60 [label="Access variable R|/x|"]; - 61 [label="Function call: R|/x|.R|/B.bar|()"]; - 62 [label="Access variable R|/x|"]; - 63 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 64 [label="Exit block"]; + 63 [label="Enter block"]; + 64 [label="Access variable R|/x|"]; + 65 [label="Smart cast: R|/x|"]; + 66 [label="Function call: R|/x|.R|/A.foo|()"]; + 67 [label="Access variable R|/x|"]; + 68 [label="Smart cast: R|/x|"]; + 69 [label="Function call: R|/x|.R|/B.bar|()"]; + 70 [label="Access variable R|/x|"]; + 71 [label="Smart cast: R|/x|"]; + 72 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 73 [label="Exit block"]; } - 65 [label="Exit when branch result"]; - 66 [label="Enter when branch result"]; + 74 [label="Exit when branch result"]; + 75 [label="Enter when branch result"]; subgraph cluster_18 { color=blue - 67 [label="Enter block"]; - 68 [label="Access variable R|/x|"]; - 69 [label="Function call: R|/x|.R|/A.foo|()"]; - 70 [label="Exit block"]; + 76 [label="Enter block"]; + 77 [label="Access variable R|/x|"]; + 78 [label="Smart cast: R|/x|"]; + 79 [label="Function call: R|/x|.R|/A.foo|()"]; + 80 [label="Exit block"]; } - 71 [label="Exit when branch result"]; - 72 [label="Enter when branch result"]; + 81 [label="Exit when branch result"]; + 82 [label="Enter when branch result"]; subgraph cluster_19 { color=blue - 73 [label="Enter block"]; - 74 [label="Exit block"]; + 83 [label="Enter block"]; + 84 [label="Exit block"]; } - 75 [label="Exit when branch result"]; - 76 [label="Exit when"]; + 85 [label="Exit when branch result"]; + 86 [label="Exit when"]; } - 77 [label="Exit block"]; + 87 [label="Exit block"]; } - 78 [label="Exit function test_1" style="filled" fillcolor=red]; + 88 [label="Exit function test_1" style="filled" fillcolor=red]; } 8 -> {9}; 9 -> {10}; @@ -156,19 +166,19 @@ digraph when_kt { 11 -> {12}; 12 -> {13}; 13 -> {14}; - 14 -> {26 15}; + 14 -> {27 15}; 15 -> {16}; 16 -> {17}; 17 -> {18}; 18 -> {20 19}; - 19 -> {32}; + 19 -> {34}; 20 -> {21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; - 25 -> {32}; - 26 -> {27}; + 25 -> {26}; + 26 -> {34}; 27 -> {28}; 28 -> {29}; 29 -> {30}; @@ -179,221 +189,229 @@ digraph when_kt { 34 -> {35}; 35 -> {36}; 36 -> {37}; - 37 -> {72 38}; + 37 -> {38}; 38 -> {39}; - 39 -> {40}; + 39 -> {82 40}; 40 -> {41}; - 41 -> {66 42}; + 41 -> {42}; 42 -> {43}; 43 -> {44}; - 44 -> {45}; - 45 -> {56 46}; + 44 -> {75 45}; + 45 -> {46}; 46 -> {47}; 47 -> {48}; 48 -> {49}; - 49 -> {50}; + 49 -> {62 50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {76}; + 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {62}; + 61 -> {86}; 62 -> {63}; 63 -> {64}; 64 -> {65}; - 65 -> {76}; + 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; 69 -> {70}; 70 -> {71}; - 71 -> {76}; + 71 -> {72}; 72 -> {73}; 73 -> {74}; - 74 -> {75}; + 74 -> {86}; 75 -> {76}; 76 -> {77}; 77 -> {78}; - - subgraph cluster_20 { - color=red - 79 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_21 { - color=blue - 80 [label="Enter block"]; - subgraph cluster_22 { - color=blue - 81 [label="Enter when"]; - 82 [label="Access variable R|/x|"]; - subgraph cluster_23 { - color=blue - 83 [label="Enter when branch condition "]; - 84 [label="Exit $subj"]; - 85 [label="Type operator: ($subj$ is R|A|)"]; - 86 [label="Exit when branch condition"]; - } - subgraph cluster_24 { - color=blue - 87 [label="Enter when branch condition "]; - 88 [label="Exit $subj"]; - 89 [label="Type operator: ($subj$ is R|B|)"]; - 90 [label="Exit when branch condition"]; - } - 91 [label="Synthetic else branch"]; - 92 [label="Enter when branch result"]; - subgraph cluster_25 { - color=blue - 93 [label="Enter block"]; - 94 [label="Access variable R|/x|"]; - 95 [label="Function call: R|/x|.R|/B.bar|()"]; - 96 [label="Exit block"]; - } - 97 [label="Exit when branch result"]; - 98 [label="Enter when branch result"]; - subgraph cluster_26 { - color=blue - 99 [label="Enter block"]; - 100 [label="Access variable R|/x|"]; - 101 [label="Function call: R|/x|.R|/A.foo|()"]; - 102 [label="Exit block"]; - } - 103 [label="Exit when branch result"]; - 104 [label="Exit when"]; - } - subgraph cluster_27 { - color=blue - 105 [label="Enter when"]; - 106 [label="Access variable R|/x|"]; - subgraph cluster_28 { - color=blue - 107 [label="Enter when branch condition "]; - 108 [label="Exit $subj"]; - 109 [label="Type operator: ($subj$ !is R|A|)"]; - 110 [label="Exit when branch condition"]; - } - subgraph cluster_29 { - color=blue - 111 [label="Enter when branch condition "]; - 112 [label="Exit $subj"]; - 113 [label="Type operator: ($subj$ !is R|B|)"]; - 114 [label="Exit when branch condition"]; - } - subgraph cluster_30 { - color=blue - 115 [label="Enter when branch condition "]; - 116 [label="Exit $subj"]; - 117 [label="Type operator: ($subj$ is R|kotlin/Int|)"]; - 118 [label="Exit when branch condition"]; - } - subgraph cluster_31 { - color=blue - 119 [label="Enter when branch condition else"]; - 120 [label="Exit when branch condition"]; - } - 121 [label="Enter when branch result"]; - subgraph cluster_32 { - color=blue - 122 [label="Enter block"]; - 123 [label="Access variable R|/x|"]; - 124 [label="Function call: R|/x|.R|/A.foo|()"]; - 125 [label="Access variable R|/x|"]; - 126 [label="Function call: R|/x|.R|/B.bar|()"]; - 127 [label="Exit block"]; - } - 128 [label="Exit when branch result"]; - 129 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 130 [label="Enter block"]; - 131 [label="Access variable R|/x|"]; - 132 [label="Function call: R|/x|.R|/A.foo|()"]; - 133 [label="Access variable R|/x|"]; - 134 [label="Function call: R|/x|.R|/B.bar|()"]; - 135 [label="Access variable R|/x|"]; - 136 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 137 [label="Exit block"]; - } - 138 [label="Exit when branch result"]; - 139 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 140 [label="Enter block"]; - 141 [label="Access variable R|/x|"]; - 142 [label="Function call: R|/x|.R|/A.foo|()"]; - 143 [label="Exit block"]; - } - 144 [label="Exit when branch result"]; - 145 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 146 [label="Enter block"]; - 147 [label="Exit block"]; - } - 148 [label="Exit when branch result"]; - 149 [label="Exit when"]; - } - 150 [label="Exit block"]; - } - 151 [label="Exit function test_2" style="filled" fillcolor=red]; - } + 78 -> {79}; 79 -> {80}; 80 -> {81}; - 81 -> {82}; + 81 -> {86}; 82 -> {83}; 83 -> {84}; 84 -> {85}; 85 -> {86}; - 86 -> {98 87}; + 86 -> {87}; 87 -> {88}; - 88 -> {89}; + + subgraph cluster_20 { + color=red + 89 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_21 { + color=blue + 90 [label="Enter block"]; + subgraph cluster_22 { + color=blue + 91 [label="Enter when"]; + 92 [label="Access variable R|/x|"]; + subgraph cluster_23 { + color=blue + 93 [label="Enter when branch condition "]; + 94 [label="Exit $subj"]; + 95 [label="Type operator: ($subj$ is R|A|)"]; + 96 [label="Exit when branch condition"]; + } + subgraph cluster_24 { + color=blue + 97 [label="Enter when branch condition "]; + 98 [label="Exit $subj"]; + 99 [label="Type operator: ($subj$ is R|B|)"]; + 100 [label="Exit when branch condition"]; + } + 101 [label="Synthetic else branch"]; + 102 [label="Enter when branch result"]; + subgraph cluster_25 { + color=blue + 103 [label="Enter block"]; + 104 [label="Access variable R|/x|"]; + 105 [label="Smart cast: R|/x|"]; + 106 [label="Function call: R|/x|.R|/B.bar|()"]; + 107 [label="Exit block"]; + } + 108 [label="Exit when branch result"]; + 109 [label="Enter when branch result"]; + subgraph cluster_26 { + color=blue + 110 [label="Enter block"]; + 111 [label="Access variable R|/x|"]; + 112 [label="Smart cast: R|/x|"]; + 113 [label="Function call: R|/x|.R|/A.foo|()"]; + 114 [label="Exit block"]; + } + 115 [label="Exit when branch result"]; + 116 [label="Exit when"]; + } + subgraph cluster_27 { + color=blue + 117 [label="Enter when"]; + 118 [label="Access variable R|/x|"]; + subgraph cluster_28 { + color=blue + 119 [label="Enter when branch condition "]; + 120 [label="Exit $subj"]; + 121 [label="Type operator: ($subj$ !is R|A|)"]; + 122 [label="Exit when branch condition"]; + } + subgraph cluster_29 { + color=blue + 123 [label="Enter when branch condition "]; + 124 [label="Exit $subj"]; + 125 [label="Type operator: ($subj$ !is R|B|)"]; + 126 [label="Exit when branch condition"]; + } + subgraph cluster_30 { + color=blue + 127 [label="Enter when branch condition "]; + 128 [label="Exit $subj"]; + 129 [label="Type operator: ($subj$ is R|kotlin/Int|)"]; + 130 [label="Exit when branch condition"]; + } + subgraph cluster_31 { + color=blue + 131 [label="Enter when branch condition else"]; + 132 [label="Exit when branch condition"]; + } + 133 [label="Enter when branch result"]; + subgraph cluster_32 { + color=blue + 134 [label="Enter block"]; + 135 [label="Access variable R|/x|"]; + 136 [label="Smart cast: R|/x|"]; + 137 [label="Function call: R|/x|.R|/A.foo|()"]; + 138 [label="Access variable R|/x|"]; + 139 [label="Smart cast: R|/x|"]; + 140 [label="Function call: R|/x|.R|/B.bar|()"]; + 141 [label="Exit block"]; + } + 142 [label="Exit when branch result"]; + 143 [label="Enter when branch result"]; + subgraph cluster_33 { + color=blue + 144 [label="Enter block"]; + 145 [label="Access variable R|/x|"]; + 146 [label="Smart cast: R|/x|"]; + 147 [label="Function call: R|/x|.R|/A.foo|()"]; + 148 [label="Access variable R|/x|"]; + 149 [label="Smart cast: R|/x|"]; + 150 [label="Function call: R|/x|.R|/B.bar|()"]; + 151 [label="Access variable R|/x|"]; + 152 [label="Smart cast: R|/x|"]; + 153 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 154 [label="Exit block"]; + } + 155 [label="Exit when branch result"]; + 156 [label="Enter when branch result"]; + subgraph cluster_34 { + color=blue + 157 [label="Enter block"]; + 158 [label="Access variable R|/x|"]; + 159 [label="Smart cast: R|/x|"]; + 160 [label="Function call: R|/x|.R|/A.foo|()"]; + 161 [label="Exit block"]; + } + 162 [label="Exit when branch result"]; + 163 [label="Enter when branch result"]; + subgraph cluster_35 { + color=blue + 164 [label="Enter block"]; + 165 [label="Exit block"]; + } + 166 [label="Exit when branch result"]; + 167 [label="Exit when"]; + } + 168 [label="Exit block"]; + } + 169 [label="Exit function test_2" style="filled" fillcolor=red]; + } 89 -> {90}; - 90 -> {92 91}; - 91 -> {104}; + 90 -> {91}; + 91 -> {92}; 92 -> {93}; 93 -> {94}; 94 -> {95}; 95 -> {96}; - 96 -> {97}; - 97 -> {104}; + 96 -> {109 97}; + 97 -> {98}; 98 -> {99}; 99 -> {100}; - 100 -> {101}; - 101 -> {102}; + 100 -> {102 101}; + 101 -> {116}; 102 -> {103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {109}; + 108 -> {116}; 109 -> {110}; - 110 -> {145 111}; + 110 -> {111}; 111 -> {112}; 112 -> {113}; 113 -> {114}; - 114 -> {139 115}; + 114 -> {115}; 115 -> {116}; 116 -> {117}; 117 -> {118}; - 118 -> {129 119}; + 118 -> {119}; 119 -> {120}; 120 -> {121}; 121 -> {122}; - 122 -> {123}; + 122 -> {163 123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; - 126 -> {127}; + 126 -> {156 127}; 127 -> {128}; - 128 -> {149}; + 128 -> {129}; 129 -> {130}; - 130 -> {131}; + 130 -> {143 131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; @@ -401,205 +419,221 @@ digraph when_kt { 135 -> {136}; 136 -> {137}; 137 -> {138}; - 138 -> {149}; + 138 -> {139}; 139 -> {140}; 140 -> {141}; 141 -> {142}; - 142 -> {143}; + 142 -> {167}; 143 -> {144}; - 144 -> {149}; + 144 -> {145}; 145 -> {146}; 146 -> {147}; 147 -> {148}; 148 -> {149}; 149 -> {150}; 150 -> {151}; - - subgraph cluster_36 { - color=red - 152 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_37 { - color=blue - 153 [label="Enter block"]; - subgraph cluster_38 { - color=blue - 154 [label="Enter when"]; - 155 [label="Access variable R|/x|"]; - 156 [label="Variable declaration: lval y: R|kotlin/Any?|"]; - subgraph cluster_39 { - color=blue - 157 [label="Enter when branch condition "]; - 158 [label="Exit $subj"]; - 159 [label="Type operator: ($subj$ is R|A|)"]; - 160 [label="Exit when branch condition"]; - } - subgraph cluster_40 { - color=blue - 161 [label="Enter when branch condition "]; - 162 [label="Exit $subj"]; - 163 [label="Type operator: ($subj$ is R|B|)"]; - 164 [label="Exit when branch condition"]; - } - 165 [label="Synthetic else branch"]; - 166 [label="Enter when branch result"]; - subgraph cluster_41 { - color=blue - 167 [label="Enter block"]; - 168 [label="Access variable R|/x|"]; - 169 [label="Function call: R|/x|.R|/B.bar|()"]; - 170 [label="Access variable R|/y|"]; - 171 [label="Function call: R|/y|.R|/B.bar|()"]; - 172 [label="Exit block"]; - } - 173 [label="Exit when branch result"]; - 174 [label="Enter when branch result"]; - subgraph cluster_42 { - color=blue - 175 [label="Enter block"]; - 176 [label="Access variable R|/x|"]; - 177 [label="Function call: R|/x|.R|/A.foo|()"]; - 178 [label="Access variable R|/y|"]; - 179 [label="Function call: R|/y|.R|/A.foo|()"]; - 180 [label="Exit block"]; - } - 181 [label="Exit when branch result"]; - 182 [label="Exit when"]; - } - subgraph cluster_43 { - color=blue - 183 [label="Enter when"]; - 184 [label="Access variable R|/x|"]; - 185 [label="Variable declaration: lval y: R|kotlin/Any?|"]; - subgraph cluster_44 { - color=blue - 186 [label="Enter when branch condition "]; - 187 [label="Exit $subj"]; - 188 [label="Type operator: ($subj$ !is R|A|)"]; - 189 [label="Exit when branch condition"]; - } - subgraph cluster_45 { - color=blue - 190 [label="Enter when branch condition "]; - 191 [label="Exit $subj"]; - 192 [label="Type operator: ($subj$ !is R|B|)"]; - 193 [label="Exit when branch condition"]; - } - subgraph cluster_46 { - color=blue - 194 [label="Enter when branch condition "]; - 195 [label="Exit $subj"]; - 196 [label="Type operator: ($subj$ is R|kotlin/Int|)"]; - 197 [label="Exit when branch condition"]; - } - subgraph cluster_47 { - color=blue - 198 [label="Enter when branch condition else"]; - 199 [label="Exit when branch condition"]; - } - 200 [label="Enter when branch result"]; - subgraph cluster_48 { - color=blue - 201 [label="Enter block"]; - 202 [label="Access variable R|/x|"]; - 203 [label="Function call: R|/x|.R|/A.foo|()"]; - 204 [label="Access variable R|/x|"]; - 205 [label="Function call: R|/x|.R|/B.bar|()"]; - 206 [label="Access variable R|/y|"]; - 207 [label="Function call: R|/y|.R|/A.foo|()"]; - 208 [label="Access variable R|/y|"]; - 209 [label="Function call: R|/y|.R|/B.bar|()"]; - 210 [label="Exit block"]; - } - 211 [label="Exit when branch result"]; - 212 [label="Enter when branch result"]; - subgraph cluster_49 { - color=blue - 213 [label="Enter block"]; - 214 [label="Access variable R|/x|"]; - 215 [label="Function call: R|/x|.R|/A.foo|()"]; - 216 [label="Access variable R|/x|"]; - 217 [label="Function call: R|/x|.R|/B.bar|()"]; - 218 [label="Access variable R|/x|"]; - 219 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 220 [label="Access variable R|/y|"]; - 221 [label="Function call: R|/y|.R|/A.foo|()"]; - 222 [label="Access variable R|/y|"]; - 223 [label="Function call: R|/y|.R|/B.bar|()"]; - 224 [label="Access variable R|/y|"]; - 225 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 226 [label="Exit block"]; - } - 227 [label="Exit when branch result"]; - 228 [label="Enter when branch result"]; - subgraph cluster_50 { - color=blue - 229 [label="Enter block"]; - 230 [label="Access variable R|/x|"]; - 231 [label="Function call: R|/x|.R|/A.foo|()"]; - 232 [label="Access variable R|/y|"]; - 233 [label="Function call: R|/y|.R|/A.foo|()"]; - 234 [label="Exit block"]; - } - 235 [label="Exit when branch result"]; - 236 [label="Enter when branch result"]; - subgraph cluster_51 { - color=blue - 237 [label="Enter block"]; - 238 [label="Exit block"]; - } - 239 [label="Exit when branch result"]; - 240 [label="Exit when"]; - } - 241 [label="Exit block"]; - } - 242 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 151 -> {152}; 152 -> {153}; 153 -> {154}; 154 -> {155}; - 155 -> {156}; + 155 -> {167}; 156 -> {157}; 157 -> {158}; 158 -> {159}; 159 -> {160}; - 160 -> {174 161}; + 160 -> {161}; 161 -> {162}; - 162 -> {163}; + 162 -> {167}; 163 -> {164}; - 164 -> {166 165}; - 165 -> {182}; + 164 -> {165}; + 165 -> {166}; 166 -> {167}; 167 -> {168}; 168 -> {169}; - 169 -> {170}; + + subgraph cluster_36 { + color=red + 170 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_37 { + color=blue + 171 [label="Enter block"]; + subgraph cluster_38 { + color=blue + 172 [label="Enter when"]; + 173 [label="Access variable R|/x|"]; + 174 [label="Variable declaration: lval y: R|kotlin/Any?|"]; + subgraph cluster_39 { + color=blue + 175 [label="Enter when branch condition "]; + 176 [label="Exit $subj"]; + 177 [label="Type operator: ($subj$ is R|A|)"]; + 178 [label="Exit when branch condition"]; + } + subgraph cluster_40 { + color=blue + 179 [label="Enter when branch condition "]; + 180 [label="Exit $subj"]; + 181 [label="Type operator: ($subj$ is R|B|)"]; + 182 [label="Exit when branch condition"]; + } + 183 [label="Synthetic else branch"]; + 184 [label="Enter when branch result"]; + subgraph cluster_41 { + color=blue + 185 [label="Enter block"]; + 186 [label="Access variable R|/x|"]; + 187 [label="Smart cast: R|/x|"]; + 188 [label="Function call: R|/x|.R|/B.bar|()"]; + 189 [label="Access variable R|/y|"]; + 190 [label="Smart cast: R|/y|"]; + 191 [label="Function call: R|/y|.R|/B.bar|()"]; + 192 [label="Exit block"]; + } + 193 [label="Exit when branch result"]; + 194 [label="Enter when branch result"]; + subgraph cluster_42 { + color=blue + 195 [label="Enter block"]; + 196 [label="Access variable R|/x|"]; + 197 [label="Smart cast: R|/x|"]; + 198 [label="Function call: R|/x|.R|/A.foo|()"]; + 199 [label="Access variable R|/y|"]; + 200 [label="Smart cast: R|/y|"]; + 201 [label="Function call: R|/y|.R|/A.foo|()"]; + 202 [label="Exit block"]; + } + 203 [label="Exit when branch result"]; + 204 [label="Exit when"]; + } + subgraph cluster_43 { + color=blue + 205 [label="Enter when"]; + 206 [label="Access variable R|/x|"]; + 207 [label="Variable declaration: lval y: R|kotlin/Any?|"]; + subgraph cluster_44 { + color=blue + 208 [label="Enter when branch condition "]; + 209 [label="Exit $subj"]; + 210 [label="Type operator: ($subj$ !is R|A|)"]; + 211 [label="Exit when branch condition"]; + } + subgraph cluster_45 { + color=blue + 212 [label="Enter when branch condition "]; + 213 [label="Exit $subj"]; + 214 [label="Type operator: ($subj$ !is R|B|)"]; + 215 [label="Exit when branch condition"]; + } + subgraph cluster_46 { + color=blue + 216 [label="Enter when branch condition "]; + 217 [label="Exit $subj"]; + 218 [label="Type operator: ($subj$ is R|kotlin/Int|)"]; + 219 [label="Exit when branch condition"]; + } + subgraph cluster_47 { + color=blue + 220 [label="Enter when branch condition else"]; + 221 [label="Exit when branch condition"]; + } + 222 [label="Enter when branch result"]; + subgraph cluster_48 { + color=blue + 223 [label="Enter block"]; + 224 [label="Access variable R|/x|"]; + 225 [label="Smart cast: R|/x|"]; + 226 [label="Function call: R|/x|.R|/A.foo|()"]; + 227 [label="Access variable R|/x|"]; + 228 [label="Smart cast: R|/x|"]; + 229 [label="Function call: R|/x|.R|/B.bar|()"]; + 230 [label="Access variable R|/y|"]; + 231 [label="Smart cast: R|/y|"]; + 232 [label="Function call: R|/y|.R|/A.foo|()"]; + 233 [label="Access variable R|/y|"]; + 234 [label="Smart cast: R|/y|"]; + 235 [label="Function call: R|/y|.R|/B.bar|()"]; + 236 [label="Exit block"]; + } + 237 [label="Exit when branch result"]; + 238 [label="Enter when branch result"]; + subgraph cluster_49 { + color=blue + 239 [label="Enter block"]; + 240 [label="Access variable R|/x|"]; + 241 [label="Smart cast: R|/x|"]; + 242 [label="Function call: R|/x|.R|/A.foo|()"]; + 243 [label="Access variable R|/x|"]; + 244 [label="Smart cast: R|/x|"]; + 245 [label="Function call: R|/x|.R|/B.bar|()"]; + 246 [label="Access variable R|/x|"]; + 247 [label="Smart cast: R|/x|"]; + 248 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 249 [label="Access variable R|/y|"]; + 250 [label="Smart cast: R|/y|"]; + 251 [label="Function call: R|/y|.R|/A.foo|()"]; + 252 [label="Access variable R|/y|"]; + 253 [label="Smart cast: R|/y|"]; + 254 [label="Function call: R|/y|.R|/B.bar|()"]; + 255 [label="Access variable R|/y|"]; + 256 [label="Smart cast: R|/y|"]; + 257 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 258 [label="Exit block"]; + } + 259 [label="Exit when branch result"]; + 260 [label="Enter when branch result"]; + subgraph cluster_50 { + color=blue + 261 [label="Enter block"]; + 262 [label="Access variable R|/x|"]; + 263 [label="Smart cast: R|/x|"]; + 264 [label="Function call: R|/x|.R|/A.foo|()"]; + 265 [label="Access variable R|/y|"]; + 266 [label="Smart cast: R|/y|"]; + 267 [label="Function call: R|/y|.R|/A.foo|()"]; + 268 [label="Exit block"]; + } + 269 [label="Exit when branch result"]; + 270 [label="Enter when branch result"]; + subgraph cluster_51 { + color=blue + 271 [label="Enter block"]; + 272 [label="Exit block"]; + } + 273 [label="Exit when branch result"]; + 274 [label="Exit when"]; + } + 275 [label="Exit block"]; + } + 276 [label="Exit function test_3" style="filled" fillcolor=red]; + } 170 -> {171}; 171 -> {172}; 172 -> {173}; - 173 -> {182}; + 173 -> {174}; 174 -> {175}; 175 -> {176}; 176 -> {177}; 177 -> {178}; - 178 -> {179}; + 178 -> {194 179}; 179 -> {180}; 180 -> {181}; 181 -> {182}; - 182 -> {183}; - 183 -> {184}; + 182 -> {184 183}; + 183 -> {204}; 184 -> {185}; 185 -> {186}; 186 -> {187}; 187 -> {188}; 188 -> {189}; - 189 -> {236 190}; + 189 -> {190}; 190 -> {191}; 191 -> {192}; 192 -> {193}; - 193 -> {228 194}; + 193 -> {204}; 194 -> {195}; 195 -> {196}; 196 -> {197}; - 197 -> {212 198}; + 197 -> {198}; 198 -> {199}; 199 -> {200}; 200 -> {201}; @@ -613,15 +647,15 @@ digraph when_kt { 208 -> {209}; 209 -> {210}; 210 -> {211}; - 211 -> {240}; + 211 -> {270 212}; 212 -> {213}; 213 -> {214}; 214 -> {215}; - 215 -> {216}; + 215 -> {260 216}; 216 -> {217}; 217 -> {218}; 218 -> {219}; - 219 -> {220}; + 219 -> {238 220}; 220 -> {221}; 221 -> {222}; 222 -> {223}; @@ -629,7 +663,7 @@ digraph when_kt { 224 -> {225}; 225 -> {226}; 226 -> {227}; - 227 -> {240}; + 227 -> {228}; 228 -> {229}; 229 -> {230}; 230 -> {231}; @@ -637,51 +671,14 @@ digraph when_kt { 232 -> {233}; 233 -> {234}; 234 -> {235}; - 235 -> {240}; + 235 -> {236}; 236 -> {237}; - 237 -> {238}; + 237 -> {274}; 238 -> {239}; 239 -> {240}; 240 -> {241}; 241 -> {242}; - - subgraph cluster_52 { - color=red - 243 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_53 { - color=blue - 244 [label="Enter block"]; - subgraph cluster_54 { - color=blue - 245 [label="Enter when"]; - 246 [label="Access variable R|/x|"]; - 247 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; - subgraph cluster_55 { - color=blue - 248 [label="Enter when branch condition "]; - 249 [label="Exit $subj"]; - 250 [label="Const: Int(1)"]; - 251 [label="Equality operator =="]; - 252 [label="Exit when branch condition"]; - } - 253 [label="Synthetic else branch"]; - 254 [label="Enter when branch result"]; - subgraph cluster_56 { - color=blue - 255 [label="Enter block"]; - 256 [label="Access variable R|/x|"]; - 257 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 258 [label="Exit block"]; - } - 259 [label="Exit when branch result"]; - 260 [label="Exit when"]; - } - 261 [label="Access variable R|/x|"]; - 262 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 263 [label="Exit block"]; - } - 264 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 242 -> {243}; 243 -> {244}; 244 -> {245}; 245 -> {246}; @@ -691,17 +688,92 @@ digraph when_kt { 249 -> {250}; 250 -> {251}; 251 -> {252}; - 252 -> {254 253}; - 253 -> {260}; + 252 -> {253}; + 253 -> {254}; 254 -> {255}; 255 -> {256}; 256 -> {257}; 257 -> {258}; 258 -> {259}; - 259 -> {260}; + 259 -> {274}; 260 -> {261}; 261 -> {262}; 262 -> {263}; 263 -> {264}; + 264 -> {265}; + 265 -> {266}; + 266 -> {267}; + 267 -> {268}; + 268 -> {269}; + 269 -> {274}; + 270 -> {271}; + 271 -> {272}; + 272 -> {273}; + 273 -> {274}; + 274 -> {275}; + 275 -> {276}; + + subgraph cluster_52 { + color=red + 277 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_53 { + color=blue + 278 [label="Enter block"]; + subgraph cluster_54 { + color=blue + 279 [label="Enter when"]; + 280 [label="Access variable R|/x|"]; + 281 [label="Type operator: (R|/x| as R|kotlin/Int|)"]; + subgraph cluster_55 { + color=blue + 282 [label="Enter when branch condition "]; + 283 [label="Exit $subj"]; + 284 [label="Const: Int(1)"]; + 285 [label="Equality operator =="]; + 286 [label="Exit when branch condition"]; + } + 287 [label="Synthetic else branch"]; + 288 [label="Enter when branch result"]; + subgraph cluster_56 { + color=blue + 289 [label="Enter block"]; + 290 [label="Access variable R|/x|"]; + 291 [label="Smart cast: R|/x|"]; + 292 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 293 [label="Exit block"]; + } + 294 [label="Exit when branch result"]; + 295 [label="Exit when"]; + } + 296 [label="Access variable R|/x|"]; + 297 [label="Smart cast: R|/x|"]; + 298 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 299 [label="Exit block"]; + } + 300 [label="Exit function test_4" style="filled" fillcolor=red]; + } + 277 -> {278}; + 278 -> {279}; + 279 -> {280}; + 280 -> {281}; + 281 -> {282}; + 282 -> {283}; + 283 -> {284}; + 284 -> {285}; + 285 -> {286}; + 286 -> {288 287}; + 287 -> {295}; + 288 -> {289}; + 289 -> {290}; + 290 -> {291}; + 291 -> {292}; + 292 -> {293}; + 293 -> {294}; + 294 -> {295}; + 295 -> {296}; + 296 -> {297}; + 297 -> {298}; + 298 -> {299}; + 299 -> {300}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/whenSubjectExpression.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/whenSubjectExpression.dot index cdbb7c68268..a6064ccd462 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/whenSubjectExpression.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/whenSubjectExpression.dot @@ -38,31 +38,32 @@ digraph whenSubjectExpression_kt { color=blue 16 [label="Enter block"]; 17 [label="Access variable R|/x|"]; - 18 [label="Function call: R|/x|.R|kotlin/Double.toInt|()"]; - 19 [label="Exit block"]; + 18 [label="Smart cast: R|/x|"]; + 19 [label="Function call: R|/x|.R|kotlin/Double.toInt|()"]; + 20 [label="Exit block"]; } - 20 [label="Exit when branch result"]; - 21 [label="Enter when branch result"]; + 21 [label="Exit when branch result"]; + 22 [label="Enter when branch result"]; subgraph cluster_7 { color=blue - 22 [label="Enter block"]; - 23 [label="Const: Int(0)"]; - 24 [label="Exit block"]; + 23 [label="Enter block"]; + 24 [label="Const: Int(0)"]; + 25 [label="Exit block"]; } - 25 [label="Exit when branch result"]; - 26 [label="Enter when branch result"]; + 26 [label="Exit when branch result"]; + 27 [label="Enter when branch result"]; subgraph cluster_8 { color=blue - 27 [label="Enter block"]; - 28 [label="Const: Int(-1)"]; - 29 [label="Exit block"]; + 28 [label="Enter block"]; + 29 [label="Const: Int(-1)"]; + 30 [label="Exit block"]; } - 30 [label="Exit when branch result"]; - 31 [label="Exit when"]; + 31 [label="Exit when branch result"]; + 32 [label="Exit when"]; } - 32 [label="Exit block"]; + 33 [label="Exit block"]; } - 33 [label="Exit function whenWithSubjectExpression" style="filled" fillcolor=red]; + 34 [label="Exit function whenWithSubjectExpression" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -71,12 +72,12 @@ digraph whenSubjectExpression_kt { 4 -> {5}; 5 -> {6}; 6 -> {7}; - 7 -> {26 8}; + 7 -> {27 8}; 8 -> {9}; 9 -> {10}; 10 -> {11}; 11 -> {12}; - 12 -> {21 13}; + 12 -> {22 13}; 13 -> {14}; 14 -> {15}; 15 -> {16}; @@ -84,83 +85,84 @@ digraph whenSubjectExpression_kt { 17 -> {18}; 18 -> {19}; 19 -> {20}; - 20 -> {31}; - 21 -> {22}; + 20 -> {21}; + 21 -> {32}; 22 -> {23}; 23 -> {24}; 24 -> {25}; - 25 -> {31}; - 26 -> {27}; + 25 -> {26}; + 26 -> {32}; 27 -> {28}; 28 -> {29}; 29 -> {30}; 30 -> {31}; 31 -> {32}; 32 -> {33}; + 33 -> {34}; subgraph cluster_9 { color=red - 34 [label="Enter function whenWithSubjectVariable" style="filled" fillcolor=red]; + 35 [label="Enter function whenWithSubjectVariable" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 35 [label="Enter block"]; + 36 [label="Enter block"]; subgraph cluster_11 { color=blue - 36 [label="Enter when"]; - 37 [label="Access variable R|/x|"]; - 38 [label="Variable declaration: lval y: R|kotlin/Any|"]; + 37 [label="Enter when"]; + 38 [label="Access variable R|/x|"]; + 39 [label="Variable declaration: lval y: R|kotlin/Any|"]; subgraph cluster_12 { color=blue - 39 [label="Enter when branch condition "]; - 40 [label="Exit $subj"]; - 41 [label="Type operator: ($subj$ !is R|kotlin/Double|)"]; - 42 [label="Exit when branch condition"]; + 40 [label="Enter when branch condition "]; + 41 [label="Exit $subj"]; + 42 [label="Type operator: ($subj$ !is R|kotlin/Double|)"]; + 43 [label="Exit when branch condition"]; } subgraph cluster_13 { color=blue - 43 [label="Enter when branch condition "]; - 44 [label="Exit $subj"]; - 45 [label="Const: Double(0.0)"]; - 46 [label="Equality operator =="]; - 47 [label="Exit when branch condition"]; + 44 [label="Enter when branch condition "]; + 45 [label="Exit $subj"]; + 46 [label="Const: Double(0.0)"]; + 47 [label="Equality operator =="]; + 48 [label="Exit when branch condition"]; } subgraph cluster_14 { color=blue - 48 [label="Enter when branch condition else"]; - 49 [label="Exit when branch condition"]; + 49 [label="Enter when branch condition else"]; + 50 [label="Exit when branch condition"]; } - 50 [label="Enter when branch result"]; + 51 [label="Enter when branch result"]; subgraph cluster_15 { color=blue - 51 [label="Enter block"]; - 52 [label="Access variable R|/y|"]; - 53 [label="Function call: R|/y|.R|kotlin/Double.toInt|()"]; - 54 [label="Exit block"]; + 52 [label="Enter block"]; + 53 [label="Access variable R|/y|"]; + 54 [label="Smart cast: R|/y|"]; + 55 [label="Function call: R|/y|.R|kotlin/Double.toInt|()"]; + 56 [label="Exit block"]; } - 55 [label="Exit when branch result"]; - 56 [label="Enter when branch result"]; + 57 [label="Exit when branch result"]; + 58 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 57 [label="Enter block"]; - 58 [label="Const: Int(0)"]; - 59 [label="Exit block"]; + 59 [label="Enter block"]; + 60 [label="Const: Int(0)"]; + 61 [label="Exit block"]; } - 60 [label="Exit when branch result"]; - 61 [label="Enter when branch result"]; + 62 [label="Exit when branch result"]; + 63 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 62 [label="Enter block"]; - 63 [label="Const: Int(-1)"]; - 64 [label="Exit block"]; + 64 [label="Enter block"]; + 65 [label="Const: Int(-1)"]; + 66 [label="Exit block"]; } - 65 [label="Exit when branch result"]; - 66 [label="Exit when"]; + 67 [label="Exit when branch result"]; + 68 [label="Exit when"]; } - 67 [label="Exit block"]; + 69 [label="Exit block"]; } - 68 [label="Exit function whenWithSubjectVariable" style="filled" fillcolor=red]; + 70 [label="Exit function whenWithSubjectVariable" style="filled" fillcolor=red]; } - 34 -> {35}; 35 -> {36}; 36 -> {37}; 37 -> {38}; @@ -168,31 +170,33 @@ digraph whenSubjectExpression_kt { 39 -> {40}; 40 -> {41}; 41 -> {42}; - 42 -> {61 43}; - 43 -> {44}; + 42 -> {43}; + 43 -> {63 44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {56 48}; - 48 -> {49}; + 47 -> {48}; + 48 -> {58 49}; 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {66}; + 55 -> {56}; 56 -> {57}; - 57 -> {58}; + 57 -> {68}; 58 -> {59}; 59 -> {60}; - 60 -> {66}; + 60 -> {61}; 61 -> {62}; - 62 -> {63}; + 62 -> {68}; 63 -> {64}; 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; + 68 -> {69}; + 69 -> {70}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot index 2b97c2a78aa..6da163d937f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot @@ -42,40 +42,42 @@ digraph equalsAndIdentity_kt { 15 [label="Access variable R|/x|"]; 16 [label="Function call: R|/x|.R|/A.foo|()"]; 17 [label="Access variable R|/y|"]; - 18 [label="Function call: R|/y|.R|/A.foo|()"]; - 19 [label="Exit block"]; + 18 [label="Smart cast: R|/y|"]; + 19 [label="Function call: R|/y|.R|/A.foo|()"]; + 20 [label="Exit block"]; } - 20 [label="Exit when branch result"]; - 21 [label="Exit when"]; + 21 [label="Exit when branch result"]; + 22 [label="Exit when"]; } subgraph cluster_7 { color=blue - 22 [label="Enter when"]; + 23 [label="Enter when"]; subgraph cluster_8 { color=blue - 23 [label="Enter when branch condition "]; - 24 [label="Access variable R|/x|"]; - 25 [label="Access variable R|/y|"]; - 26 [label="Equality operator ==="]; - 27 [label="Exit when branch condition"]; + 24 [label="Enter when branch condition "]; + 25 [label="Access variable R|/x|"]; + 26 [label="Access variable R|/y|"]; + 27 [label="Equality operator ==="]; + 28 [label="Exit when branch condition"]; } - 28 [label="Synthetic else branch"]; - 29 [label="Enter when branch result"]; + 29 [label="Synthetic else branch"]; + 30 [label="Enter when branch result"]; subgraph cluster_9 { color=blue - 30 [label="Enter block"]; - 31 [label="Access variable R|/x|"]; - 32 [label="Function call: R|/x|.R|/A.foo|()"]; - 33 [label="Access variable R|/y|"]; - 34 [label="Function call: R|/y|.R|/A.foo|()"]; - 35 [label="Exit block"]; + 31 [label="Enter block"]; + 32 [label="Access variable R|/x|"]; + 33 [label="Function call: R|/x|.R|/A.foo|()"]; + 34 [label="Access variable R|/y|"]; + 35 [label="Smart cast: R|/y|"]; + 36 [label="Function call: R|/y|.R|/A.foo|()"]; + 37 [label="Exit block"]; } - 36 [label="Exit when branch result"]; - 37 [label="Exit when"]; + 38 [label="Exit when branch result"]; + 39 [label="Exit when"]; } - 38 [label="Exit block"]; + 40 [label="Exit block"]; } - 39 [label="Exit function test_1" style="filled" fillcolor=red]; + 41 [label="Exit function test_1" style="filled" fillcolor=red]; } 4 -> {5}; 5 -> {6}; @@ -85,7 +87,7 @@ digraph equalsAndIdentity_kt { 9 -> {10}; 10 -> {11}; 11 -> {13 12}; - 12 -> {21}; + 12 -> {22}; 13 -> {14}; 14 -> {15}; 15 -> {16}; @@ -100,9 +102,9 @@ digraph equalsAndIdentity_kt { 24 -> {25}; 25 -> {26}; 26 -> {27}; - 27 -> {29 28}; - 28 -> {37}; - 29 -> {30}; + 27 -> {28}; + 28 -> {30 29}; + 29 -> {39}; 30 -> {31}; 31 -> {32}; 32 -> {33}; @@ -112,78 +114,78 @@ digraph equalsAndIdentity_kt { 36 -> {37}; 37 -> {38}; 38 -> {39}; + 39 -> {40}; + 40 -> {41}; subgraph cluster_10 { color=red - 40 [label="Enter function test_2" style="filled" fillcolor=red]; + 42 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 41 [label="Enter block"]; + 43 [label="Enter block"]; subgraph cluster_12 { color=blue - 42 [label="Enter when"]; + 44 [label="Enter when"]; subgraph cluster_13 { color=blue - 43 [label="Enter when branch condition "]; - 44 [label="Access variable R|/x|"]; - 45 [label="Access variable R|/y|"]; - 46 [label="Equality operator =="]; - 47 [label="Exit when branch condition"]; + 45 [label="Enter when branch condition "]; + 46 [label="Access variable R|/x|"]; + 47 [label="Access variable R|/y|"]; + 48 [label="Equality operator =="]; + 49 [label="Exit when branch condition"]; } - 48 [label="Synthetic else branch"]; - 49 [label="Enter when branch result"]; + 50 [label="Synthetic else branch"]; + 51 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 50 [label="Enter block"]; - 51 [label="Access variable R|/x|"]; - 52 [label="Function call: R|/x|.#()"]; - 53 [label="Access variable R|/y|"]; - 54 [label="Function call: R|/y|.#()"]; - 55 [label="Exit block"]; + 52 [label="Enter block"]; + 53 [label="Access variable R|/x|"]; + 54 [label="Function call: R|/x|.#()"]; + 55 [label="Access variable R|/y|"]; + 56 [label="Function call: R|/y|.#()"]; + 57 [label="Exit block"]; } - 56 [label="Exit when branch result"]; - 57 [label="Exit when"]; + 58 [label="Exit when branch result"]; + 59 [label="Exit when"]; } subgraph cluster_15 { color=blue - 58 [label="Enter when"]; + 60 [label="Enter when"]; subgraph cluster_16 { color=blue - 59 [label="Enter when branch condition "]; - 60 [label="Access variable R|/x|"]; - 61 [label="Access variable R|/y|"]; - 62 [label="Equality operator ==="]; - 63 [label="Exit when branch condition"]; + 61 [label="Enter when branch condition "]; + 62 [label="Access variable R|/x|"]; + 63 [label="Access variable R|/y|"]; + 64 [label="Equality operator ==="]; + 65 [label="Exit when branch condition"]; } - 64 [label="Synthetic else branch"]; - 65 [label="Enter when branch result"]; + 66 [label="Synthetic else branch"]; + 67 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 66 [label="Enter block"]; - 67 [label="Access variable R|/x|"]; - 68 [label="Function call: R|/x|.#()"]; - 69 [label="Access variable R|/y|"]; - 70 [label="Function call: R|/y|.#()"]; - 71 [label="Exit block"]; + 68 [label="Enter block"]; + 69 [label="Access variable R|/x|"]; + 70 [label="Function call: R|/x|.#()"]; + 71 [label="Access variable R|/y|"]; + 72 [label="Function call: R|/y|.#()"]; + 73 [label="Exit block"]; } - 72 [label="Exit when branch result"]; - 73 [label="Exit when"]; + 74 [label="Exit when branch result"]; + 75 [label="Exit when"]; } - 74 [label="Exit block"]; + 76 [label="Exit block"]; } - 75 [label="Exit function test_2" style="filled" fillcolor=red]; + 77 [label="Exit function test_2" style="filled" fillcolor=red]; } - 40 -> {41}; - 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {49 48}; - 48 -> {57}; - 49 -> {50}; - 50 -> {51}; + 47 -> {48}; + 48 -> {49}; + 49 -> {51 50}; + 50 -> {59}; 51 -> {52}; 52 -> {53}; 53 -> {54}; @@ -196,10 +198,10 @@ digraph equalsAndIdentity_kt { 60 -> {61}; 61 -> {62}; 62 -> {63}; - 63 -> {65 64}; - 64 -> {73}; - 65 -> {66}; - 66 -> {67}; + 63 -> {64}; + 64 -> {65}; + 65 -> {67 66}; + 66 -> {75}; 67 -> {68}; 68 -> {69}; 69 -> {70}; @@ -208,117 +210,123 @@ digraph equalsAndIdentity_kt { 72 -> {73}; 73 -> {74}; 74 -> {75}; + 75 -> {76}; + 76 -> {77}; subgraph cluster_18 { color=red - 76 [label="Enter function test_3" style="filled" fillcolor=red]; + 78 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_19 { color=blue - 77 [label="Enter block"]; + 79 [label="Enter block"]; subgraph cluster_20 { color=blue - 78 [label="Enter when"]; + 80 [label="Enter when"]; subgraph cluster_21 { color=blue - 79 [label="Enter when branch condition "]; - 80 [label="Access variable R|/y|"]; - 81 [label="Const: Null(null)"]; - 82 [label="Equality operator =="]; - 83 [label="Exit when branch condition"]; + 81 [label="Enter when branch condition "]; + 82 [label="Access variable R|/y|"]; + 83 [label="Const: Null(null)"]; + 84 [label="Equality operator =="]; + 85 [label="Exit when branch condition"]; } - 84 [label="Synthetic else branch"]; - 85 [label="Enter when branch result"]; + 86 [label="Synthetic else branch"]; + 87 [label="Enter when branch result"]; subgraph cluster_22 { color=blue - 86 [label="Enter block"]; - 87 [label="Jump: ^test_3 Unit"]; - 88 [label="Stub" style="filled" fillcolor=gray]; - 89 [label="Exit block" style="filled" fillcolor=gray]; + 88 [label="Enter block"]; + 89 [label="Jump: ^test_3 Unit"]; + 90 [label="Stub" style="filled" fillcolor=gray]; + 91 [label="Exit block" style="filled" fillcolor=gray]; } - 90 [label="Exit when branch result" style="filled" fillcolor=gray]; - 91 [label="Exit when"]; + 92 [label="Exit when branch result" style="filled" fillcolor=gray]; + 93 [label="Exit when"]; } subgraph cluster_23 { color=blue - 92 [label="Enter when"]; + 94 [label="Enter when"]; subgraph cluster_24 { color=blue - 93 [label="Enter when branch condition "]; - 94 [label="Access variable R|/x|"]; - 95 [label="Access variable R|/y|"]; - 96 [label="Equality operator =="]; - 97 [label="Exit when branch condition"]; + 95 [label="Enter when branch condition "]; + 96 [label="Access variable R|/x|"]; + 97 [label="Access variable R|/y|"]; + 98 [label="Smart cast: R|/y|"]; + 99 [label="Equality operator =="]; + 100 [label="Exit when branch condition"]; } - 98 [label="Synthetic else branch"]; - 99 [label="Enter when branch result"]; + 101 [label="Synthetic else branch"]; + 102 [label="Enter when branch result"]; subgraph cluster_25 { color=blue - 100 [label="Enter block"]; - 101 [label="Access variable R|/x|"]; - 102 [label="Function call: R|/x|.R|/A.foo|()"]; - 103 [label="Access variable R|/y|"]; - 104 [label="Function call: R|/y|.R|/A.foo|()"]; - 105 [label="Exit block"]; + 103 [label="Enter block"]; + 104 [label="Access variable R|/x|"]; + 105 [label="Smart cast: R|/x|"]; + 106 [label="Function call: R|/x|.R|/A.foo|()"]; + 107 [label="Access variable R|/y|"]; + 108 [label="Smart cast: R|/y|"]; + 109 [label="Function call: R|/y|.R|/A.foo|()"]; + 110 [label="Exit block"]; } - 106 [label="Exit when branch result"]; - 107 [label="Exit when"]; + 111 [label="Exit when branch result"]; + 112 [label="Exit when"]; } subgraph cluster_26 { color=blue - 108 [label="Enter when"]; + 113 [label="Enter when"]; subgraph cluster_27 { color=blue - 109 [label="Enter when branch condition "]; - 110 [label="Access variable R|/x|"]; - 111 [label="Access variable R|/y|"]; - 112 [label="Equality operator ==="]; - 113 [label="Exit when branch condition"]; + 114 [label="Enter when branch condition "]; + 115 [label="Access variable R|/x|"]; + 116 [label="Access variable R|/y|"]; + 117 [label="Smart cast: R|/y|"]; + 118 [label="Equality operator ==="]; + 119 [label="Exit when branch condition"]; } - 114 [label="Synthetic else branch"]; - 115 [label="Enter when branch result"]; + 120 [label="Synthetic else branch"]; + 121 [label="Enter when branch result"]; subgraph cluster_28 { color=blue - 116 [label="Enter block"]; - 117 [label="Access variable R|/x|"]; - 118 [label="Function call: R|/x|.R|/A.foo|()"]; - 119 [label="Access variable R|/y|"]; - 120 [label="Function call: R|/y|.R|/A.foo|()"]; - 121 [label="Exit block"]; + 122 [label="Enter block"]; + 123 [label="Access variable R|/x|"]; + 124 [label="Smart cast: R|/x|"]; + 125 [label="Function call: R|/x|.R|/A.foo|()"]; + 126 [label="Access variable R|/y|"]; + 127 [label="Smart cast: R|/y|"]; + 128 [label="Function call: R|/y|.R|/A.foo|()"]; + 129 [label="Exit block"]; } - 122 [label="Exit when branch result"]; - 123 [label="Exit when"]; + 130 [label="Exit when branch result"]; + 131 [label="Exit when"]; } - 124 [label="Exit block"]; + 132 [label="Exit block"]; } - 125 [label="Exit function test_3" style="filled" fillcolor=red]; + 133 [label="Exit function test_3" style="filled" fillcolor=red]; } - 76 -> {77}; - 77 -> {78}; 78 -> {79}; 79 -> {80}; 80 -> {81}; 81 -> {82}; 82 -> {83}; - 83 -> {85 84}; - 84 -> {91}; - 85 -> {86}; - 86 -> {87}; - 87 -> {125}; - 87 -> {88} [style=dotted]; - 88 -> {89} [style=dotted]; + 83 -> {84}; + 84 -> {85}; + 85 -> {87 86}; + 86 -> {93}; + 87 -> {88}; + 88 -> {89}; + 89 -> {133}; 89 -> {90} [style=dotted]; 90 -> {91} [style=dotted]; - 91 -> {92}; - 92 -> {93}; + 91 -> {92} [style=dotted]; + 92 -> {93} [style=dotted]; 93 -> {94}; 94 -> {95}; 95 -> {96}; 96 -> {97}; - 97 -> {99 98}; - 98 -> {107}; + 97 -> {98}; + 98 -> {99}; 99 -> {100}; - 100 -> {101}; - 101 -> {102}; + 100 -> {102 101}; + 101 -> {112}; 102 -> {103}; 103 -> {104}; 104 -> {105}; @@ -330,17 +338,25 @@ digraph equalsAndIdentity_kt { 110 -> {111}; 111 -> {112}; 112 -> {113}; - 113 -> {115 114}; - 114 -> {123}; + 113 -> {114}; + 114 -> {115}; 115 -> {116}; 116 -> {117}; 117 -> {118}; 118 -> {119}; - 119 -> {120}; - 120 -> {121}; + 119 -> {121 120}; + 120 -> {131}; 121 -> {122}; 122 -> {123}; 123 -> {124}; 124 -> {125}; + 125 -> {126}; + 126 -> {127}; + 127 -> {128}; + 128 -> {129}; + 129 -> {130}; + 130 -> {131}; + 131 -> {132}; + 132 -> {133}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/incorrectSmartcastToNothing.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/incorrectSmartcastToNothing.dot index 6937870c277..834c68a5f34 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/incorrectSmartcastToNothing.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/incorrectSmartcastToNothing.dot @@ -35,66 +35,68 @@ digraph incorrectSmartcastToNothing_kt { color=blue 12 [label="Enter when branch condition "]; 13 [label="Access variable R|/cacheExtSetting|"]; - 14 [label="Function call: R|/cacheExtSetting|.R|kotlin/text/isBlank|()"]; - 15 [label="Exit when branch condition"]; + 14 [label="Smart cast: R|/cacheExtSetting|"]; + 15 [label="Function call: R|/cacheExtSetting|.R|kotlin/text/isBlank|()"]; + 16 [label="Exit when branch condition"]; } subgraph cluster_6 { color=blue - 16 [label="Enter when branch condition else"]; - 17 [label="Exit when branch condition"]; + 17 [label="Enter when branch condition else"]; + 18 [label="Exit when branch condition"]; } - 18 [label="Enter when branch result"]; + 19 [label="Enter when branch result"]; subgraph cluster_7 { color=blue - 19 [label="Enter block"]; - 20 [label="Access variable R|/cacheExtSetting|"]; - 21 [label="Function call: R|java/io/File.File|(...)"]; - 22 [label="Exit block"]; + 20 [label="Enter block"]; + 21 [label="Access variable R|/cacheExtSetting|"]; + 22 [label="Smart cast: R|/cacheExtSetting|"]; + 23 [label="Function call: R|java/io/File.File|(...)"]; + 24 [label="Exit block"]; } - 23 [label="Exit when branch result"]; - 24 [label="Enter when branch result"]; + 25 [label="Exit when branch result"]; + 26 [label="Enter when branch result"]; subgraph cluster_8 { color=blue - 25 [label="Enter block"]; - 26 [label="Const: Null(null)"]; - 27 [label="Exit block"]; + 27 [label="Enter block"]; + 28 [label="Const: Null(null)"]; + 29 [label="Exit block"]; } - 28 [label="Exit when branch result"]; - 29 [label="Enter when branch result"]; + 30 [label="Exit when branch result"]; + 31 [label="Enter when branch result"]; subgraph cluster_9 { color=blue - 30 [label="Enter block"]; - 31 [label="Access variable R|/cache|"]; - 32 [label="Enter safe call"]; - 33 [label="Postponed enter to lambda"]; + 32 [label="Enter block"]; + 33 [label="Access variable R|/cache|"]; + 34 [label="Enter safe call"]; + 35 [label="Postponed enter to lambda"]; subgraph cluster_10 { color=blue - 45 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 47 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 46 [label="Enter block"]; - 47 [label="Access variable R|/it|"]; - 48 [label="Const: String(main.kts.compiled.cache)"]; - 49 [label="Function call: R|java/io/File.File|(...)"]; - 50 [label="Exit block"]; + 48 [label="Enter block"]; + 49 [label="Access variable R|/it|"]; + 50 [label="Const: String(main.kts.compiled.cache)"]; + 51 [label="Function call: R|java/io/File.File|(...)"]; + 52 [label="Exit block"]; } - 51 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 53 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 34 [label="Postponed exit from lambda"]; - 35 [label="Function call: $subj$.R|kotlin/let|(...)"]; - 36 [label="Exit safe call"]; - 37 [label="Exit block"]; + 36 [label="Postponed exit from lambda"]; + 37 [label="Function call: $subj$.R|kotlin/let|(...)"]; + 38 [label="Exit safe call"]; + 39 [label="Exit block"]; } - 38 [label="Exit when branch result"]; - 39 [label="Exit when"]; + 40 [label="Exit when branch result"]; + 41 [label="Exit when"]; } - 40 [label="Variable declaration: lval cacheBaseDir: R|java/io/File?|"]; - 41 [label="Exit block"]; + 42 [label="Variable declaration: lval cacheBaseDir: R|java/io/File?|"]; + 43 [label="Exit block"]; } - 42 [label="Exit function test" style="filled" fillcolor=red]; + 44 [label="Exit function test" style="filled" fillcolor=red]; } - 43 [label="Merge postponed lambda exits"]; - 44 [label="Merge postponed lambda exits"]; + 45 [label="Merge postponed lambda exits"]; + 46 [label="Merge postponed lambda exits"]; 4 -> {5}; 5 -> {6}; 6 -> {7}; @@ -102,47 +104,49 @@ digraph incorrectSmartcastToNothing_kt { 8 -> {9}; 9 -> {10}; 10 -> {11}; - 11 -> {29 12}; + 11 -> {31 12}; 12 -> {13}; 13 -> {14}; 14 -> {15}; - 15 -> {24 16}; - 16 -> {17}; + 15 -> {16}; + 16 -> {26 17}; 17 -> {18}; 18 -> {19}; 19 -> {20}; 20 -> {21}; 21 -> {22}; 22 -> {23}; - 23 -> {39}; + 23 -> {24}; 24 -> {25}; - 25 -> {26}; + 25 -> {41}; 26 -> {27}; 27 -> {28}; - 28 -> {39}; + 28 -> {29}; 29 -> {30}; - 30 -> {31}; - 31 -> {32 36}; + 30 -> {41}; + 31 -> {32}; 32 -> {33}; - 33 -> {45}; - 33 -> {34} [color=red]; - 33 -> {45} [style=dashed]; + 33 -> {34 38}; 34 -> {35}; - 35 -> {36}; - 36 -> {43 37}; + 35 -> {47}; + 35 -> {36} [color=red]; + 35 -> {47} [style=dashed]; + 36 -> {37}; 37 -> {38}; - 38 -> {39}; - 39 -> {44 40}; + 38 -> {45 39}; + 39 -> {40}; 40 -> {41}; - 41 -> {42}; - 43 -> {44} [color=red]; - 45 -> {46}; - 46 -> {47}; + 41 -> {46 42}; + 42 -> {43}; + 43 -> {44}; + 45 -> {46} [color=red]; 47 -> {48}; 48 -> {49}; 49 -> {50}; 50 -> {51}; - 51 -> {43} [color=red]; - 51 -> {34} [color=green]; + 51 -> {52}; + 52 -> {53}; + 53 -> {45} [color=red]; + 53 -> {36} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot index befe1f62b8d..b03d03a44f2 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot @@ -60,10 +60,11 @@ digraph inPlaceLambdas_kt { color=blue 28 [label="Enter block"]; 29 [label="Access variable R|/x|"]; - 30 [label="Function call: R|/x|.R|/A.foo|()"]; - 31 [label="Exit block"]; + 30 [label="Smart cast: R|/x|"]; + 31 [label="Function call: R|/x|.R|/A.foo|()"]; + 32 [label="Exit block"]; } - 32 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 33 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 19 [label="Call arguments union" style="filled" fillcolor=yellow]; 20 [label="Postponed exit from lambda"]; @@ -102,136 +103,145 @@ digraph inPlaceLambdas_kt { 29 -> {30}; 30 -> {31}; 31 -> {32}; - 32 -> {19} [color=red]; - 32 -> {20} [color=green]; + 32 -> {33}; + 33 -> {19} [color=red]; + 33 -> {20} [color=green]; subgraph cluster_11 { color=red - 33 [label="Enter function test_2" style="filled" fillcolor=red]; + 34 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_12 { color=blue - 34 [label="Enter block"]; - 35 [label="Postponed enter to lambda"]; + 35 [label="Enter block"]; + 36 [label="Postponed enter to lambda"]; subgraph cluster_13 { color=blue - 43 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 45 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_14 { color=blue - 44 [label="Enter block"]; - 45 [label="Access variable R|/x|"]; - 46 [label="Type operator: (R|/x| as R|B|)"]; - 47 [label="Exit block"]; + 46 [label="Enter block"]; + 47 [label="Access variable R|/x|"]; + 48 [label="Type operator: (R|/x| as R|B|)"]; + 49 [label="Exit block"]; } - 48 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 50 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 36 [label="Call arguments union" style="filled" fillcolor=yellow]; - 37 [label="Postponed exit from lambda"]; - 38 [label="Function call: R|kotlin/run|(...)"]; - 39 [label="Access variable R|/x|"]; - 40 [label="Function call: R|/x|.R|/B.bar|()"]; - 41 [label="Exit block"]; + 37 [label="Call arguments union" style="filled" fillcolor=yellow]; + 38 [label="Postponed exit from lambda"]; + 39 [label="Function call: R|kotlin/run|(...)"]; + 40 [label="Access variable R|/x|"]; + 41 [label="Smart cast: R|/x|"]; + 42 [label="Function call: R|/x|.R|/B.bar|()"]; + 43 [label="Exit block"]; } - 42 [label="Exit function test_2" style="filled" fillcolor=red]; + 44 [label="Exit function test_2" style="filled" fillcolor=red]; } - 33 -> {34}; 34 -> {35}; - 35 -> {43}; - 35 -> {37} [color=red]; - 35 -> {43} [style=dashed]; + 35 -> {36}; + 36 -> {45}; 36 -> {38} [color=red]; - 37 -> {38} [color=green]; - 38 -> {39}; + 36 -> {45} [style=dashed]; + 37 -> {39} [color=red]; + 38 -> {39} [color=green]; 39 -> {40}; 40 -> {41}; 41 -> {42}; + 42 -> {43}; 43 -> {44}; - 44 -> {45}; 45 -> {46}; 46 -> {47}; 47 -> {48}; - 48 -> {36} [color=red]; - 48 -> {37} [color=green]; + 48 -> {49}; + 49 -> {50}; + 50 -> {37} [color=red]; + 50 -> {38} [color=green]; subgraph cluster_15 { color=red - 49 [label="Enter function test_3" style="filled" fillcolor=red]; + 51 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_16 { color=blue - 50 [label="Enter block"]; + 52 [label="Enter block"]; subgraph cluster_17 { color=blue - 51 [label="Enter when"]; + 53 [label="Enter when"]; subgraph cluster_18 { color=blue - 52 [label="Enter when branch condition "]; - 53 [label="Access variable R|/x|"]; - 54 [label="Type operator: (R|/x| is R|A|)"]; - 55 [label="Exit when branch condition"]; + 54 [label="Enter when branch condition "]; + 55 [label="Access variable R|/x|"]; + 56 [label="Type operator: (R|/x| is R|A|)"]; + 57 [label="Exit when branch condition"]; } - 56 [label="Synthetic else branch"]; - 57 [label="Enter when branch result"]; + 58 [label="Synthetic else branch"]; + 59 [label="Enter when branch result"]; subgraph cluster_19 { color=blue - 58 [label="Enter block"]; - 59 [label="Postponed enter to lambda"]; + 60 [label="Enter block"]; + 61 [label="Postponed enter to lambda"]; subgraph cluster_20 { color=blue - 70 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 73 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 71 [label="Enter block"]; - 72 [label="Access variable R|/x|"]; - 73 [label="Function call: R|/x|.R|/A.foo|()"]; - 74 [label="Access variable R|/x|"]; - 75 [label="Type operator: (R|/x| as R|B|)"]; - 76 [label="Exit block"]; + 74 [label="Enter block"]; + 75 [label="Access variable R|/x|"]; + 76 [label="Smart cast: R|/x|"]; + 77 [label="Function call: R|/x|.R|/A.foo|()"]; + 78 [label="Access variable R|/x|"]; + 79 [label="Smart cast: R|/x|"]; + 80 [label="Type operator: (R|/x| as R|B|)"]; + 81 [label="Exit block"]; } - 77 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 82 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 60 [label="Call arguments union" style="filled" fillcolor=yellow]; - 61 [label="Postponed exit from lambda"]; - 62 [label="Function call: R|kotlin/run|(...)"]; - 63 [label="Access variable R|/x|"]; - 64 [label="Function call: R|/x|.R|/B.bar|()"]; - 65 [label="Exit block"]; + 62 [label="Call arguments union" style="filled" fillcolor=yellow]; + 63 [label="Postponed exit from lambda"]; + 64 [label="Function call: R|kotlin/run|(...)"]; + 65 [label="Access variable R|/x|"]; + 66 [label="Smart cast: R|/x|"]; + 67 [label="Function call: R|/x|.R|/B.bar|()"]; + 68 [label="Exit block"]; } - 66 [label="Exit when branch result"]; - 67 [label="Exit when"]; + 69 [label="Exit when branch result"]; + 70 [label="Exit when"]; } - 68 [label="Exit block"]; + 71 [label="Exit block"]; } - 69 [label="Exit function test_3" style="filled" fillcolor=red]; + 72 [label="Exit function test_3" style="filled" fillcolor=red]; } - 49 -> {50}; - 50 -> {51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {57 56}; - 56 -> {67}; - 57 -> {58}; - 58 -> {59}; - 59 -> {70}; - 59 -> {61} [color=red]; - 59 -> {70} [style=dashed]; - 60 -> {62} [color=red]; - 61 -> {62} [color=green]; - 62 -> {63}; - 63 -> {64}; + 55 -> {56}; + 56 -> {57}; + 57 -> {59 58}; + 58 -> {70}; + 59 -> {60}; + 60 -> {61}; + 61 -> {73}; + 61 -> {63} [color=red]; + 61 -> {73} [style=dashed]; + 62 -> {64} [color=red]; + 63 -> {64} [color=green]; 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; + 69 -> {70}; 70 -> {71}; 71 -> {72}; - 72 -> {73}; 73 -> {74}; 74 -> {75}; 75 -> {76}; 76 -> {77}; - 77 -> {60} [color=red]; - 77 -> {61} [color=green]; + 77 -> {78}; + 78 -> {79}; + 79 -> {80}; + 80 -> {81}; + 81 -> {82}; + 82 -> {62} [color=red]; + 82 -> {63} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot index 7f24a13d4b5..529d6ad8760 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.dot @@ -135,14 +135,14 @@ digraph lambdaInWhenBranch_kt { 48 [label="Postponed enter to lambda"]; subgraph cluster_18 { color=blue - 82 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 83 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_19 { color=blue - 83 [label="Enter block"]; - 84 [label="Access variable R|/it|"]; - 85 [label="Exit block"]; + 84 [label="Enter block"]; + 85 [label="Access variable R|/it|"]; + 86 [label="Exit block"]; } - 86 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 87 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } 49 [label="Postponed exit from lambda"]; 50 [label="Function call: String().R|kotlin/let|(...)"]; @@ -184,18 +184,19 @@ digraph lambdaInWhenBranch_kt { color=blue 72 [label="Enter block"]; 73 [label="Access variable R|/p|"]; - 74 [label="Access variable R|/SubClass1.t|"]; - 75 [label="Exit block"]; + 74 [label="Smart cast: R|/p|"]; + 75 [label="Access variable R|/SubClass1.t|"]; + 76 [label="Exit block"]; } - 76 [label="Exit when branch result"]; - 77 [label="Exit when"]; + 77 [label="Exit when branch result"]; + 78 [label="Exit when"]; } - 78 [label="Access variable R|kotlin/String.length|"]; - 79 [label="Exit block"]; + 79 [label="Access variable R|kotlin/String.length|"]; + 80 [label="Exit block"]; } - 80 [label="Exit function foo" style="filled" fillcolor=red]; + 81 [label="Exit function foo" style="filled" fillcolor=red]; } - 81 [label="Merge postponed lambda exits"]; + 82 [label="Merge postponed lambda exits"]; 28 -> {29}; 29 -> {30}; 30 -> {31}; @@ -216,14 +217,14 @@ digraph lambdaInWhenBranch_kt { 45 -> {46}; 46 -> {47}; 47 -> {48}; - 48 -> {82}; + 48 -> {83}; 48 -> {49} [color=red]; - 48 -> {82} [style=dashed]; + 48 -> {83} [style=dashed]; 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {81 54}; + 53 -> {82 54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; @@ -240,7 +241,7 @@ digraph lambdaInWhenBranch_kt { 67 -> {68}; 68 -> {69}; 69 -> {70}; - 70 -> {77}; + 70 -> {78}; 71 -> {72}; 72 -> {73}; 73 -> {74}; @@ -250,11 +251,12 @@ digraph lambdaInWhenBranch_kt { 77 -> {78}; 78 -> {79}; 79 -> {80}; - 82 -> {83}; + 80 -> {81}; 83 -> {84}; 84 -> {85}; 85 -> {86}; - 86 -> {81} [color=red]; - 86 -> {49} [color=green]; + 86 -> {87}; + 87 -> {82} [color=red]; + 87 -> {49} [color=green]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.dot index 4074a02264f..fa565e91c4b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.dot @@ -65,16 +65,17 @@ digraph dataFlowInfoFromWhileCondition_kt { color=blue 24 [label="Enter block"]; 25 [label="Access variable R|/a|"]; - 26 [label="Function call: R|/a|.R|/A.foo|()"]; - 27 [label="Exit block"]; + 26 [label="Smart cast: R|/a|"]; + 27 [label="Function call: R|/a|.R|/A.foo|()"]; + 28 [label="Exit block"]; } - 28 [label="Exit loop block"]; + 29 [label="Exit loop block"]; } - 29 [label="Exit whileloop"]; + 30 [label="Exit whileloop"]; } - 30 [label="Exit block"]; + 31 [label="Exit block"]; } - 31 [label="Exit function test" style="filled" fillcolor=red]; + 32 [label="Exit function test" style="filled" fillcolor=red]; } 8 -> {9}; 9 -> {10}; @@ -90,14 +91,15 @@ digraph dataFlowInfoFromWhileCondition_kt { 19 -> {20}; 20 -> {21}; 21 -> {22}; - 22 -> {29 23}; + 22 -> {30 23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; 26 -> {27}; 27 -> {28}; - 28 -> {13} [color=green style=dashed]; - 29 -> {30}; + 28 -> {29}; + 29 -> {13} [color=green style=dashed]; 30 -> {31}; + 31 -> {32}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.dot index 822e9ea2cdf..80f872bb7d6 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.dot @@ -68,10 +68,11 @@ digraph endlessLoops_kt { 28 [label="Exit whileloop"]; } 29 [label="Access variable R|/x|"]; - 30 [label="Function call: R|/x|.R|/A.foo|()"]; - 31 [label="Exit block"]; + 30 [label="Smart cast: R|/x|"]; + 31 [label="Function call: R|/x|.R|/A.foo|()"]; + 32 [label="Exit block"]; } - 32 [label="Exit function test_1" style="filled" fillcolor=red]; + 33 [label="Exit function test_1" style="filled" fillcolor=red]; } 4 -> {5}; 5 -> {6}; @@ -103,532 +104,543 @@ digraph endlessLoops_kt { 29 -> {30}; 30 -> {31}; 31 -> {32}; + 32 -> {33}; subgraph cluster_11 { color=red - 33 [label="Enter function test_2" style="filled" fillcolor=red]; + 34 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_12 { color=blue - 34 [label="Enter block"]; + 35 [label="Enter block"]; subgraph cluster_13 { color=blue - 35 [label="Enter while loop"]; + 36 [label="Enter while loop"]; subgraph cluster_14 { color=blue - 36 [label="Enter loop condition"]; - 37 [label="Const: Boolean(true)"]; - 38 [label="Exit loop condition"]; + 37 [label="Enter loop condition"]; + 38 [label="Const: Boolean(true)"]; + 39 [label="Exit loop condition"]; } subgraph cluster_15 { color=blue - 39 [label="Enter loop block"]; + 40 [label="Enter loop block"]; subgraph cluster_16 { color=blue - 40 [label="Enter block"]; + 41 [label="Enter block"]; subgraph cluster_17 { color=blue - 41 [label="Enter when"]; + 42 [label="Enter when"]; subgraph cluster_18 { color=blue - 42 [label="Enter when branch condition "]; - 43 [label="Access variable R|/b|"]; - 44 [label="Exit when branch condition"]; + 43 [label="Enter when branch condition "]; + 44 [label="Access variable R|/b|"]; + 45 [label="Exit when branch condition"]; } - 45 [label="Synthetic else branch"]; - 46 [label="Enter when branch result"]; + 46 [label="Synthetic else branch"]; + 47 [label="Enter when branch result"]; subgraph cluster_19 { color=blue - 47 [label="Enter block"]; - 48 [label="Access variable R|/x|"]; - 49 [label="Type operator: (R|/x| as R|A|)"]; - 50 [label="Jump: break@@@[Boolean(true)] "]; - 51 [label="Stub" style="filled" fillcolor=gray]; - 52 [label="Exit block" style="filled" fillcolor=gray]; + 48 [label="Enter block"]; + 49 [label="Access variable R|/x|"]; + 50 [label="Type operator: (R|/x| as R|A|)"]; + 51 [label="Jump: break@@@[Boolean(true)] "]; + 52 [label="Stub" style="filled" fillcolor=gray]; + 53 [label="Exit block" style="filled" fillcolor=gray]; } - 53 [label="Exit when branch result" style="filled" fillcolor=gray]; - 54 [label="Exit when"]; + 54 [label="Exit when branch result" style="filled" fillcolor=gray]; + 55 [label="Exit when"]; } - 55 [label="Exit block"]; + 56 [label="Exit block"]; } - 56 [label="Exit loop block"]; + 57 [label="Exit loop block"]; } - 57 [label="Exit whileloop"]; + 58 [label="Exit whileloop"]; } - 58 [label="Access variable R|/x|"]; - 59 [label="Function call: R|/x|.R|/A.foo|()"]; - 60 [label="Exit block"]; + 59 [label="Access variable R|/x|"]; + 60 [label="Smart cast: R|/x|"]; + 61 [label="Function call: R|/x|.R|/A.foo|()"]; + 62 [label="Exit block"]; } - 61 [label="Exit function test_2" style="filled" fillcolor=red]; + 63 [label="Exit function test_2" style="filled" fillcolor=red]; } - 33 -> {34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; - 38 -> {57} [style=dotted]; 39 -> {40}; + 39 -> {58} [style=dotted]; 40 -> {41}; 41 -> {42}; 42 -> {43}; 43 -> {44}; - 44 -> {46 45}; - 45 -> {54}; - 46 -> {47}; + 44 -> {45}; + 45 -> {47 46}; + 46 -> {55}; 47 -> {48}; 48 -> {49}; 49 -> {50}; - 50 -> {57}; - 50 -> {51} [style=dotted]; + 50 -> {51}; + 51 -> {58}; 51 -> {52} [style=dotted]; 52 -> {53} [style=dotted]; 53 -> {54} [style=dotted]; - 54 -> {55}; + 54 -> {55} [style=dotted]; 55 -> {56}; - 56 -> {36} [color=green style=dashed]; - 57 -> {58}; + 56 -> {57}; + 57 -> {37} [color=green style=dashed]; 58 -> {59}; 59 -> {60}; 60 -> {61}; + 61 -> {62}; + 62 -> {63}; subgraph cluster_20 { color=red - 62 [label="Enter function test_3" style="filled" fillcolor=red]; + 64 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 63 [label="Enter block"]; + 65 [label="Enter block"]; subgraph cluster_22 { color=blue - 64 [label="Enter while loop"]; + 66 [label="Enter while loop"]; subgraph cluster_23 { color=blue - 65 [label="Enter loop condition"]; - 66 [label="Const: Boolean(true)"]; - 67 [label="Exit loop condition"]; + 67 [label="Enter loop condition"]; + 68 [label="Const: Boolean(true)"]; + 69 [label="Exit loop condition"]; } subgraph cluster_24 { color=blue - 68 [label="Enter loop block"]; + 70 [label="Enter loop block"]; subgraph cluster_25 { color=blue - 69 [label="Enter block"]; - 70 [label="Access variable R|/x|"]; - 71 [label="Type operator: (R|/x| as R|A|)"]; + 71 [label="Enter block"]; + 72 [label="Access variable R|/x|"]; + 73 [label="Type operator: (R|/x| as R|A|)"]; subgraph cluster_26 { color=blue - 72 [label="Enter when"]; + 74 [label="Enter when"]; subgraph cluster_27 { color=blue - 73 [label="Enter when branch condition "]; - 74 [label="Access variable R|/b|"]; - 75 [label="Exit when branch condition"]; + 75 [label="Enter when branch condition "]; + 76 [label="Access variable R|/b|"]; + 77 [label="Exit when branch condition"]; } - 76 [label="Synthetic else branch"]; - 77 [label="Enter when branch result"]; + 78 [label="Synthetic else branch"]; + 79 [label="Enter when branch result"]; subgraph cluster_28 { color=blue - 78 [label="Enter block"]; - 79 [label="Jump: break@@@[Boolean(true)] "]; - 80 [label="Stub" style="filled" fillcolor=gray]; - 81 [label="Exit block" style="filled" fillcolor=gray]; + 80 [label="Enter block"]; + 81 [label="Jump: break@@@[Boolean(true)] "]; + 82 [label="Stub" style="filled" fillcolor=gray]; + 83 [label="Exit block" style="filled" fillcolor=gray]; } - 82 [label="Exit when branch result" style="filled" fillcolor=gray]; - 83 [label="Exit when"]; + 84 [label="Exit when branch result" style="filled" fillcolor=gray]; + 85 [label="Exit when"]; } subgraph cluster_29 { color=blue - 84 [label="Enter when"]; + 86 [label="Enter when"]; subgraph cluster_30 { color=blue - 85 [label="Enter when branch condition "]; - 86 [label="Access variable R|/b|"]; - 87 [label="Exit when branch condition"]; + 87 [label="Enter when branch condition "]; + 88 [label="Access variable R|/b|"]; + 89 [label="Exit when branch condition"]; } - 88 [label="Synthetic else branch"]; - 89 [label="Enter when branch result"]; + 90 [label="Synthetic else branch"]; + 91 [label="Enter when branch result"]; subgraph cluster_31 { color=blue - 90 [label="Enter block"]; - 91 [label="Jump: break@@@[Boolean(true)] "]; - 92 [label="Stub" style="filled" fillcolor=gray]; - 93 [label="Exit block" style="filled" fillcolor=gray]; + 92 [label="Enter block"]; + 93 [label="Jump: break@@@[Boolean(true)] "]; + 94 [label="Stub" style="filled" fillcolor=gray]; + 95 [label="Exit block" style="filled" fillcolor=gray]; } - 94 [label="Exit when branch result" style="filled" fillcolor=gray]; - 95 [label="Exit when"]; + 96 [label="Exit when branch result" style="filled" fillcolor=gray]; + 97 [label="Exit when"]; } - 96 [label="Exit block"]; + 98 [label="Exit block"]; } - 97 [label="Exit loop block"]; + 99 [label="Exit loop block"]; } - 98 [label="Exit whileloop"]; + 100 [label="Exit whileloop"]; } - 99 [label="Access variable R|/x|"]; - 100 [label="Function call: R|/x|.R|/A.foo|()"]; - 101 [label="Exit block"]; + 101 [label="Access variable R|/x|"]; + 102 [label="Smart cast: R|/x|"]; + 103 [label="Function call: R|/x|.R|/A.foo|()"]; + 104 [label="Exit block"]; } - 102 [label="Exit function test_3" style="filled" fillcolor=red]; + 105 [label="Exit function test_3" style="filled" fillcolor=red]; } - 62 -> {63}; - 63 -> {64}; 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; - 67 -> {98} [style=dotted]; 68 -> {69}; 69 -> {70}; + 69 -> {100} [style=dotted]; 70 -> {71}; 71 -> {72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {77 76}; - 76 -> {83}; - 77 -> {78}; - 78 -> {79}; - 79 -> {98}; - 79 -> {80} [style=dotted]; - 80 -> {81} [style=dotted]; + 75 -> {76}; + 76 -> {77}; + 77 -> {79 78}; + 78 -> {85}; + 79 -> {80}; + 80 -> {81}; + 81 -> {100}; 81 -> {82} [style=dotted]; 82 -> {83} [style=dotted]; - 83 -> {84}; - 84 -> {85}; + 83 -> {84} [style=dotted]; + 84 -> {85} [style=dotted]; 85 -> {86}; 86 -> {87}; - 87 -> {89 88}; - 88 -> {95}; - 89 -> {90}; - 90 -> {91}; - 91 -> {98}; - 91 -> {92} [style=dotted]; - 92 -> {93} [style=dotted]; + 87 -> {88}; + 88 -> {89}; + 89 -> {91 90}; + 90 -> {97}; + 91 -> {92}; + 92 -> {93}; + 93 -> {100}; 93 -> {94} [style=dotted]; 94 -> {95} [style=dotted]; - 95 -> {96}; - 96 -> {97}; - 97 -> {65} [color=green style=dashed]; + 95 -> {96} [style=dotted]; + 96 -> {97} [style=dotted]; + 97 -> {98}; 98 -> {99}; - 99 -> {100}; + 99 -> {67} [color=green style=dashed]; 100 -> {101}; 101 -> {102}; + 102 -> {103}; + 103 -> {104}; + 104 -> {105}; subgraph cluster_32 { color=red - 103 [label="Enter function test_4" style="filled" fillcolor=red]; + 106 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_33 { color=blue - 104 [label="Enter block"]; + 107 [label="Enter block"]; subgraph cluster_34 { color=blue - 105 [label="Enter while loop"]; + 108 [label="Enter while loop"]; subgraph cluster_35 { color=blue - 106 [label="Enter loop condition"]; - 107 [label="Const: Boolean(true)"]; - 108 [label="Exit loop condition"]; + 109 [label="Enter loop condition"]; + 110 [label="Const: Boolean(true)"]; + 111 [label="Exit loop condition"]; } subgraph cluster_36 { color=blue - 109 [label="Enter loop block"]; + 112 [label="Enter loop block"]; subgraph cluster_37 { color=blue - 110 [label="Enter block"]; + 113 [label="Enter block"]; subgraph cluster_38 { color=blue - 111 [label="Enter when"]; + 114 [label="Enter when"]; subgraph cluster_39 { color=blue - 112 [label="Enter when branch condition "]; - 113 [label="Access variable R|/b|"]; - 114 [label="Exit when branch condition"]; + 115 [label="Enter when branch condition "]; + 116 [label="Access variable R|/b|"]; + 117 [label="Exit when branch condition"]; } - 115 [label="Synthetic else branch"]; - 116 [label="Enter when branch result"]; + 118 [label="Synthetic else branch"]; + 119 [label="Enter when branch result"]; subgraph cluster_40 { color=blue - 117 [label="Enter block"]; - 118 [label="Access variable R|/x|"]; - 119 [label="Type operator: (R|/x| as R|A|)"]; - 120 [label="Jump: break@@@[Boolean(true)] "]; - 121 [label="Stub" style="filled" fillcolor=gray]; - 122 [label="Exit block" style="filled" fillcolor=gray]; + 120 [label="Enter block"]; + 121 [label="Access variable R|/x|"]; + 122 [label="Type operator: (R|/x| as R|A|)"]; + 123 [label="Jump: break@@@[Boolean(true)] "]; + 124 [label="Stub" style="filled" fillcolor=gray]; + 125 [label="Exit block" style="filled" fillcolor=gray]; } - 123 [label="Exit when branch result" style="filled" fillcolor=gray]; - 124 [label="Exit when"]; + 126 [label="Exit when branch result" style="filled" fillcolor=gray]; + 127 [label="Exit when"]; } - 125 [label="Jump: break@@@[Boolean(true)] "]; - 126 [label="Stub" style="filled" fillcolor=gray]; - 127 [label="Exit block" style="filled" fillcolor=gray]; + 128 [label="Jump: break@@@[Boolean(true)] "]; + 129 [label="Stub" style="filled" fillcolor=gray]; + 130 [label="Exit block" style="filled" fillcolor=gray]; } - 128 [label="Exit loop block" style="filled" fillcolor=gray]; + 131 [label="Exit loop block" style="filled" fillcolor=gray]; } - 129 [label="Exit whileloop"]; + 132 [label="Exit whileloop"]; } - 130 [label="Access variable R|/x|"]; - 131 [label="Function call: R|/x|.#()"]; - 132 [label="Exit block"]; + 133 [label="Access variable R|/x|"]; + 134 [label="Function call: R|/x|.#()"]; + 135 [label="Exit block"]; } - 133 [label="Exit function test_4" style="filled" fillcolor=red]; + 136 [label="Exit function test_4" style="filled" fillcolor=red]; } - 103 -> {104}; - 104 -> {105}; - 105 -> {106}; 106 -> {107}; 107 -> {108}; 108 -> {109}; - 108 -> {129} [style=dotted]; 109 -> {110}; 110 -> {111}; 111 -> {112}; + 111 -> {132} [style=dotted]; 112 -> {113}; 113 -> {114}; - 114 -> {116 115}; - 115 -> {124}; + 114 -> {115}; + 115 -> {116}; 116 -> {117}; - 117 -> {118}; - 118 -> {119}; + 117 -> {119 118}; + 118 -> {127}; 119 -> {120}; - 120 -> {129}; - 120 -> {121} [style=dotted]; - 121 -> {122} [style=dotted]; - 122 -> {123} [style=dotted]; + 120 -> {121}; + 121 -> {122}; + 122 -> {123}; + 123 -> {132}; 123 -> {124} [style=dotted]; - 124 -> {125}; - 125 -> {129}; + 124 -> {125} [style=dotted]; 125 -> {126} [style=dotted]; 126 -> {127} [style=dotted]; - 127 -> {128} [style=dotted]; - 128 -> {106} [color=green style=dotted]; - 129 -> {130}; - 130 -> {131}; - 131 -> {132}; + 127 -> {128}; + 128 -> {132}; + 128 -> {129} [style=dotted]; + 129 -> {130} [style=dotted]; + 130 -> {131} [style=dotted]; + 131 -> {109} [color=green style=dotted]; 132 -> {133}; + 133 -> {134}; + 134 -> {135}; + 135 -> {136}; subgraph cluster_41 { color=red - 134 [label="Enter function test_5" style="filled" fillcolor=red]; + 137 [label="Enter function test_5" style="filled" fillcolor=red]; subgraph cluster_42 { color=blue - 135 [label="Enter block"]; + 138 [label="Enter block"]; subgraph cluster_43 { color=blue - 136 [label="Enter do-while loop"]; + 139 [label="Enter do-while loop"]; subgraph cluster_44 { color=blue - 137 [label="Enter loop block"]; + 140 [label="Enter loop block"]; subgraph cluster_45 { color=blue - 138 [label="Enter block"]; + 141 [label="Enter block"]; subgraph cluster_46 { color=blue - 139 [label="Enter when"]; + 142 [label="Enter when"]; subgraph cluster_47 { color=blue - 140 [label="Enter when branch condition "]; - 141 [label="Access variable R|/b|"]; - 142 [label="Exit when branch condition"]; + 143 [label="Enter when branch condition "]; + 144 [label="Access variable R|/b|"]; + 145 [label="Exit when branch condition"]; } - 143 [label="Synthetic else branch"]; - 144 [label="Enter when branch result"]; + 146 [label="Synthetic else branch"]; + 147 [label="Enter when branch result"]; subgraph cluster_48 { color=blue - 145 [label="Enter block"]; - 146 [label="Access variable R|/x|"]; - 147 [label="Type operator: (R|/x| as R|A|)"]; - 148 [label="Jump: break@@@[Boolean(true)] "]; - 149 [label="Stub" style="filled" fillcolor=gray]; - 150 [label="Exit block" style="filled" fillcolor=gray]; + 148 [label="Enter block"]; + 149 [label="Access variable R|/x|"]; + 150 [label="Type operator: (R|/x| as R|A|)"]; + 151 [label="Jump: break@@@[Boolean(true)] "]; + 152 [label="Stub" style="filled" fillcolor=gray]; + 153 [label="Exit block" style="filled" fillcolor=gray]; } - 151 [label="Exit when branch result" style="filled" fillcolor=gray]; - 152 [label="Exit when"]; + 154 [label="Exit when branch result" style="filled" fillcolor=gray]; + 155 [label="Exit when"]; } - 153 [label="Exit block"]; + 156 [label="Exit block"]; } - 154 [label="Exit loop block"]; + 157 [label="Exit loop block"]; } subgraph cluster_49 { color=blue - 155 [label="Enter loop condition"]; - 156 [label="Const: Boolean(true)"]; - 157 [label="Exit loop condition"]; + 158 [label="Enter loop condition"]; + 159 [label="Const: Boolean(true)"]; + 160 [label="Exit loop condition"]; } - 158 [label="Exit do-whileloop"]; + 161 [label="Exit do-whileloop"]; } - 159 [label="Access variable R|/x|"]; - 160 [label="Function call: R|/x|.R|/A.foo|()"]; - 161 [label="Exit block"]; + 162 [label="Access variable R|/x|"]; + 163 [label="Smart cast: R|/x|"]; + 164 [label="Function call: R|/x|.R|/A.foo|()"]; + 165 [label="Exit block"]; } - 162 [label="Exit function test_5" style="filled" fillcolor=red]; + 166 [label="Exit function test_5" style="filled" fillcolor=red]; } - 134 -> {135}; - 135 -> {136}; - 136 -> {137}; 137 -> {138}; 138 -> {139}; 139 -> {140}; 140 -> {141}; 141 -> {142}; - 142 -> {144 143}; - 143 -> {152}; + 142 -> {143}; + 143 -> {144}; 144 -> {145}; - 145 -> {146}; - 146 -> {147}; + 145 -> {147 146}; + 146 -> {155}; 147 -> {148}; - 148 -> {158}; - 148 -> {149} [style=dotted]; - 149 -> {150} [style=dotted]; - 150 -> {151} [style=dotted]; + 148 -> {149}; + 149 -> {150}; + 150 -> {151}; + 151 -> {161}; 151 -> {152} [style=dotted]; - 152 -> {153}; - 153 -> {154}; - 154 -> {155}; + 152 -> {153} [style=dotted]; + 153 -> {154} [style=dotted]; + 154 -> {155} [style=dotted]; 155 -> {156}; 156 -> {157}; - 157 -> {158} [style=dotted]; - 157 -> {137} [color=green style=dashed]; + 157 -> {158}; 158 -> {159}; 159 -> {160}; - 160 -> {161}; + 160 -> {161} [style=dotted]; + 160 -> {140} [color=green style=dashed]; 161 -> {162}; - - subgraph cluster_50 { - color=red - 163 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_51 { - color=blue - 164 [label="Enter block"]; - subgraph cluster_52 { - color=blue - 165 [label="Enter do-while loop"]; - subgraph cluster_53 { - color=blue - 166 [label="Enter loop block"]; - subgraph cluster_54 { - color=blue - 167 [label="Enter block"]; - 168 [label="Access variable R|/x|"]; - 169 [label="Type operator: (R|/x| as R|A|)"]; - subgraph cluster_55 { - color=blue - 170 [label="Enter when"]; - subgraph cluster_56 { - color=blue - 171 [label="Enter when branch condition "]; - 172 [label="Access variable R|/b|"]; - 173 [label="Exit when branch condition"]; - } - 174 [label="Synthetic else branch"]; - 175 [label="Enter when branch result"]; - subgraph cluster_57 { - color=blue - 176 [label="Enter block"]; - 177 [label="Jump: break@@@[Boolean(true)] "]; - 178 [label="Stub" style="filled" fillcolor=gray]; - 179 [label="Exit block" style="filled" fillcolor=gray]; - } - 180 [label="Exit when branch result" style="filled" fillcolor=gray]; - 181 [label="Exit when"]; - } - 182 [label="Exit block"]; - } - 183 [label="Exit loop block"]; - } - subgraph cluster_58 { - color=blue - 184 [label="Enter loop condition"]; - 185 [label="Const: Boolean(true)"]; - 186 [label="Exit loop condition"]; - } - 187 [label="Exit do-whileloop"]; - } - 188 [label="Access variable R|/x|"]; - 189 [label="Function call: R|/x|.R|/A.foo|()"]; - 190 [label="Exit block"]; - } - 191 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 162 -> {163}; 163 -> {164}; 164 -> {165}; 165 -> {166}; - 166 -> {167}; + + subgraph cluster_50 { + color=red + 167 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_51 { + color=blue + 168 [label="Enter block"]; + subgraph cluster_52 { + color=blue + 169 [label="Enter do-while loop"]; + subgraph cluster_53 { + color=blue + 170 [label="Enter loop block"]; + subgraph cluster_54 { + color=blue + 171 [label="Enter block"]; + 172 [label="Access variable R|/x|"]; + 173 [label="Type operator: (R|/x| as R|A|)"]; + subgraph cluster_55 { + color=blue + 174 [label="Enter when"]; + subgraph cluster_56 { + color=blue + 175 [label="Enter when branch condition "]; + 176 [label="Access variable R|/b|"]; + 177 [label="Exit when branch condition"]; + } + 178 [label="Synthetic else branch"]; + 179 [label="Enter when branch result"]; + subgraph cluster_57 { + color=blue + 180 [label="Enter block"]; + 181 [label="Jump: break@@@[Boolean(true)] "]; + 182 [label="Stub" style="filled" fillcolor=gray]; + 183 [label="Exit block" style="filled" fillcolor=gray]; + } + 184 [label="Exit when branch result" style="filled" fillcolor=gray]; + 185 [label="Exit when"]; + } + 186 [label="Exit block"]; + } + 187 [label="Exit loop block"]; + } + subgraph cluster_58 { + color=blue + 188 [label="Enter loop condition"]; + 189 [label="Const: Boolean(true)"]; + 190 [label="Exit loop condition"]; + } + 191 [label="Exit do-whileloop"]; + } + 192 [label="Access variable R|/x|"]; + 193 [label="Smart cast: R|/x|"]; + 194 [label="Function call: R|/x|.R|/A.foo|()"]; + 195 [label="Exit block"]; + } + 196 [label="Exit function test_6" style="filled" fillcolor=red]; + } 167 -> {168}; 168 -> {169}; 169 -> {170}; 170 -> {171}; 171 -> {172}; 172 -> {173}; - 173 -> {175 174}; - 174 -> {181}; + 173 -> {174}; + 174 -> {175}; 175 -> {176}; 176 -> {177}; - 177 -> {187}; - 177 -> {178} [style=dotted]; - 178 -> {179} [style=dotted]; - 179 -> {180} [style=dotted]; - 180 -> {181} [style=dotted]; - 181 -> {182}; - 182 -> {183}; - 183 -> {184}; - 184 -> {185}; + 177 -> {179 178}; + 178 -> {185}; + 179 -> {180}; + 180 -> {181}; + 181 -> {191}; + 181 -> {182} [style=dotted]; + 182 -> {183} [style=dotted]; + 183 -> {184} [style=dotted]; + 184 -> {185} [style=dotted]; 185 -> {186}; - 186 -> {187} [style=dotted]; - 186 -> {166} [color=green style=dashed]; + 186 -> {187}; 187 -> {188}; 188 -> {189}; 189 -> {190}; - 190 -> {191}; - - subgraph cluster_59 { - color=red - 192 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_60 { - color=blue - 193 [label="Enter block"]; - subgraph cluster_61 { - color=blue - 194 [label="Enter do-while loop"]; - subgraph cluster_62 { - color=blue - 195 [label="Enter loop block"]; - subgraph cluster_63 { - color=blue - 196 [label="Enter block"]; - 197 [label="Access variable R|/x|"]; - 198 [label="Type operator: (R|/x| as R|A|)"]; - 199 [label="Exit block"]; - } - 200 [label="Exit loop block"]; - } - subgraph cluster_64 { - color=blue - 201 [label="Enter loop condition"]; - 202 [label="Const: Boolean(true)"]; - 203 [label="Exit loop condition"]; - } - 204 [label="Exit do-whileloop" style="filled" fillcolor=gray]; - } - 205 [label="Access variable R|/x|" style="filled" fillcolor=gray]; - 206 [label="Function call: R|/x|.R|/A.foo|()" style="filled" fillcolor=gray]; - 207 [label="Exit block" style="filled" fillcolor=gray]; - } - 208 [label="Exit function test_7" style="filled" fillcolor=red style="filled" fillcolor=gray]; - } + 190 -> {191} [style=dotted]; + 190 -> {170} [color=green style=dashed]; + 191 -> {192}; 192 -> {193}; 193 -> {194}; 194 -> {195}; 195 -> {196}; - 196 -> {197}; + + subgraph cluster_59 { + color=red + 197 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_60 { + color=blue + 198 [label="Enter block"]; + subgraph cluster_61 { + color=blue + 199 [label="Enter do-while loop"]; + subgraph cluster_62 { + color=blue + 200 [label="Enter loop block"]; + subgraph cluster_63 { + color=blue + 201 [label="Enter block"]; + 202 [label="Access variable R|/x|"]; + 203 [label="Type operator: (R|/x| as R|A|)"]; + 204 [label="Exit block"]; + } + 205 [label="Exit loop block"]; + } + subgraph cluster_64 { + color=blue + 206 [label="Enter loop condition"]; + 207 [label="Const: Boolean(true)"]; + 208 [label="Exit loop condition"]; + } + 209 [label="Exit do-whileloop" style="filled" fillcolor=gray]; + } + 210 [label="Access variable R|/x|" style="filled" fillcolor=gray]; + 211 [label="Smart cast: R|/x|" style="filled" fillcolor=gray]; + 212 [label="Function call: R|/x|.R|/A.foo|()" style="filled" fillcolor=gray]; + 213 [label="Exit block" style="filled" fillcolor=gray]; + } + 214 [label="Exit function test_7" style="filled" fillcolor=red style="filled" fillcolor=gray]; + } 197 -> {198}; 198 -> {199}; 199 -> {200}; 200 -> {201}; 201 -> {202}; 202 -> {203}; - 203 -> {204} [style=dotted]; - 203 -> {195} [color=green style=dashed]; - 204 -> {205} [style=dotted]; - 205 -> {206} [style=dotted]; - 206 -> {207} [style=dotted]; - 207 -> {208} [style=dotted]; + 203 -> {204}; + 204 -> {205}; + 205 -> {206}; + 206 -> {207}; + 207 -> {208}; + 208 -> {209} [style=dotted]; + 208 -> {200} [color=green style=dashed]; + 209 -> {210} [style=dotted]; + 210 -> {211} [style=dotted]; + 211 -> {212} [style=dotted]; + 212 -> {213} [style=dotted]; + 213 -> {214} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.dot index 8e474e97a09..5566cfe3aa0 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.dot @@ -65,14 +65,16 @@ digraph multipleCasts_kt { 21 [label="Access variable R|/a|"]; 22 [label="Type operator: (R|/a| as R|A|)"]; 23 [label="Access variable R|/a|"]; - 24 [label="Function call: R|/a|.R|/A.foo|()"]; - 25 [label="Access variable R|/b|"]; - 26 [label="Type operator: (R|/b| as R|B|)"]; - 27 [label="Access variable R|/b|"]; - 28 [label="Function call: R|/b|.R|/B.foo|()"]; - 29 [label="Exit block"]; + 24 [label="Smart cast: R|/a|"]; + 25 [label="Function call: R|/a|.R|/A.foo|()"]; + 26 [label="Access variable R|/b|"]; + 27 [label="Type operator: (R|/b| as R|B|)"]; + 28 [label="Access variable R|/b|"]; + 29 [label="Smart cast: R|/b|"]; + 30 [label="Function call: R|/b|.R|/B.foo|()"]; + 31 [label="Exit block"]; } - 30 [label="Exit function test_0" style="filled" fillcolor=red]; + 32 [label="Exit function test_0" style="filled" fillcolor=red]; } 15 -> {16}; 16 -> {17}; @@ -89,56 +91,58 @@ digraph multipleCasts_kt { 27 -> {28}; 28 -> {29}; 29 -> {30}; + 30 -> {31}; + 31 -> {32}; subgraph cluster_8 { color=red - 31 [label="Enter function test_1" style="filled" fillcolor=red]; + 33 [label="Enter function test_1" style="filled" fillcolor=red]; subgraph cluster_9 { color=blue - 32 [label="Enter block"]; - 33 [label="Function call: R|/getAny|()"]; - 34 [label="Variable declaration: lval a: R|kotlin/Any?|"]; + 34 [label="Enter block"]; 35 [label="Function call: R|/getAny|()"]; - 36 [label="Variable declaration: lval b: R|kotlin/Any?|"]; + 36 [label="Variable declaration: lval a: R|kotlin/Any?|"]; + 37 [label="Function call: R|/getAny|()"]; + 38 [label="Variable declaration: lval b: R|kotlin/Any?|"]; subgraph cluster_10 { color=blue - 37 [label="Enter when"]; + 39 [label="Enter when"]; subgraph cluster_11 { color=blue - 38 [label="Enter when branch condition "]; + 40 [label="Enter when branch condition "]; subgraph cluster_12 { color=blue - 39 [label="Enter &&"]; - 40 [label="Access variable R|/a|"]; - 41 [label="Type operator: (R|/a| is R|A|)"]; - 42 [label="Exit left part of &&"]; - 43 [label="Enter right part of &&"]; - 44 [label="Access variable R|/b|"]; - 45 [label="Type operator: (R|/b| is R|B|)"]; - 46 [label="Exit &&"]; + 41 [label="Enter &&"]; + 42 [label="Access variable R|/a|"]; + 43 [label="Type operator: (R|/a| is R|A|)"]; + 44 [label="Exit left part of &&"]; + 45 [label="Enter right part of &&"]; + 46 [label="Access variable R|/b|"]; + 47 [label="Type operator: (R|/b| is R|B|)"]; + 48 [label="Exit &&"]; } - 47 [label="Exit when branch condition"]; + 49 [label="Exit when branch condition"]; } - 48 [label="Synthetic else branch"]; - 49 [label="Enter when branch result"]; + 50 [label="Synthetic else branch"]; + 51 [label="Enter when branch result"]; subgraph cluster_13 { color=blue - 50 [label="Enter block"]; - 51 [label="Access variable R|/a|"]; - 52 [label="Function call: R|/a|.R|/A.foo|()"]; - 53 [label="Access variable R|/b|"]; - 54 [label="Function call: R|/b|.R|/B.foo|()"]; - 55 [label="Exit block"]; + 52 [label="Enter block"]; + 53 [label="Access variable R|/a|"]; + 54 [label="Smart cast: R|/a|"]; + 55 [label="Function call: R|/a|.R|/A.foo|()"]; + 56 [label="Access variable R|/b|"]; + 57 [label="Smart cast: R|/b|"]; + 58 [label="Function call: R|/b|.R|/B.foo|()"]; + 59 [label="Exit block"]; } - 56 [label="Exit when branch result"]; - 57 [label="Exit when"]; + 60 [label="Exit when branch result"]; + 61 [label="Exit when"]; } - 58 [label="Exit block"]; + 62 [label="Exit block"]; } - 59 [label="Exit function test_1" style="filled" fillcolor=red]; + 63 [label="Exit function test_1" style="filled" fillcolor=red]; } - 31 -> {32}; - 32 -> {33}; 33 -> {34}; 34 -> {35}; 35 -> {36}; @@ -148,15 +152,15 @@ digraph multipleCasts_kt { 39 -> {40}; 40 -> {41}; 41 -> {42}; - 42 -> {46 43}; + 42 -> {43}; 43 -> {44}; - 44 -> {45}; + 44 -> {48 45}; 45 -> {46}; 46 -> {47}; - 47 -> {49 48}; - 48 -> {57}; - 49 -> {50}; - 50 -> {51}; + 47 -> {48}; + 48 -> {49}; + 49 -> {51 50}; + 50 -> {61}; 51 -> {52}; 52 -> {53}; 53 -> {54}; @@ -165,5 +169,9 @@ digraph multipleCasts_kt { 56 -> {57}; 57 -> {58}; 58 -> {59}; + 59 -> {60}; + 60 -> {61}; + 61 -> {62}; + 62 -> {63}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot index 85a4d35677c..120f811f84b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot @@ -239,26 +239,28 @@ digraph nullability_kt { color=blue 76 [label="Enter block"]; 77 [label="Access variable R|/x|"]; - 78 [label="Function call: R|/x|.#()"]; - 79 [label="Exit block"]; + 78 [label="Smart cast: R|/x|"]; + 79 [label="Function call: R|/x|.#()"]; + 80 [label="Exit block"]; } - 80 [label="Exit when branch result"]; - 81 [label="Enter when branch result"]; + 81 [label="Exit when branch result"]; + 82 [label="Enter when branch result"]; subgraph cluster_29 { color=blue - 82 [label="Enter block"]; - 83 [label="Access variable R|/x|"]; - 84 [label="Function call: R|/x|.R|/A.foo|()"]; - 85 [label="Exit block"]; + 83 [label="Enter block"]; + 84 [label="Access variable R|/x|"]; + 85 [label="Smart cast: R|/x|"]; + 86 [label="Function call: R|/x|.R|/A.foo|()"]; + 87 [label="Exit block"]; } - 86 [label="Exit when branch result"]; - 87 [label="Exit when"]; + 88 [label="Exit when branch result"]; + 89 [label="Exit when"]; } - 88 [label="Access variable R|/x|"]; - 89 [label="Function call: R|/x|.#()"]; - 90 [label="Exit block"]; + 90 [label="Access variable R|/x|"]; + 91 [label="Function call: R|/x|.#()"]; + 92 [label="Exit block"]; } - 91 [label="Exit function test_1" style="filled" fillcolor=red]; + 93 [label="Exit function test_1" style="filled" fillcolor=red]; } 65 -> {66}; 66 -> {67}; @@ -267,7 +269,7 @@ digraph nullability_kt { 69 -> {70}; 70 -> {71}; 71 -> {72}; - 72 -> {81 73}; + 72 -> {82 73}; 73 -> {74}; 74 -> {75}; 75 -> {76}; @@ -275,8 +277,8 @@ digraph nullability_kt { 77 -> {78}; 78 -> {79}; 79 -> {80}; - 80 -> {87}; - 81 -> {82}; + 80 -> {81}; + 81 -> {89}; 82 -> {83}; 83 -> {84}; 84 -> {85}; @@ -286,74 +288,76 @@ digraph nullability_kt { 88 -> {89}; 89 -> {90}; 90 -> {91}; + 91 -> {92}; + 92 -> {93}; subgraph cluster_30 { color=red - 92 [label="Enter function test_2" style="filled" fillcolor=red]; + 94 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_31 { color=blue - 93 [label="Enter block"]; + 95 [label="Enter block"]; subgraph cluster_32 { color=blue - 94 [label="Enter when"]; + 96 [label="Enter when"]; subgraph cluster_33 { color=blue - 95 [label="Enter when branch condition "]; - 96 [label="Access variable R|/x|"]; - 97 [label="Const: Null(null)"]; - 98 [label="Equality operator =="]; - 99 [label="Exit when branch condition"]; + 97 [label="Enter when branch condition "]; + 98 [label="Access variable R|/x|"]; + 99 [label="Const: Null(null)"]; + 100 [label="Equality operator =="]; + 101 [label="Exit when branch condition"]; } subgraph cluster_34 { color=blue - 100 [label="Enter when branch condition else"]; - 101 [label="Exit when branch condition"]; + 102 [label="Enter when branch condition else"]; + 103 [label="Exit when branch condition"]; } - 102 [label="Enter when branch result"]; + 104 [label="Enter when branch result"]; subgraph cluster_35 { color=blue - 103 [label="Enter block"]; - 104 [label="Access variable R|/x|"]; - 105 [label="Function call: R|/x|.R|/A.foo|()"]; - 106 [label="Exit block"]; + 105 [label="Enter block"]; + 106 [label="Access variable R|/x|"]; + 107 [label="Smart cast: R|/x|"]; + 108 [label="Function call: R|/x|.R|/A.foo|()"]; + 109 [label="Exit block"]; } - 107 [label="Exit when branch result"]; - 108 [label="Enter when branch result"]; + 110 [label="Exit when branch result"]; + 111 [label="Enter when branch result"]; subgraph cluster_36 { color=blue - 109 [label="Enter block"]; - 110 [label="Access variable R|/x|"]; - 111 [label="Function call: R|/x|.#()"]; - 112 [label="Exit block"]; + 112 [label="Enter block"]; + 113 [label="Access variable R|/x|"]; + 114 [label="Smart cast: R|/x|"]; + 115 [label="Function call: R|/x|.#()"]; + 116 [label="Exit block"]; } - 113 [label="Exit when branch result"]; - 114 [label="Exit when"]; + 117 [label="Exit when branch result"]; + 118 [label="Exit when"]; } - 115 [label="Access variable R|/x|"]; - 116 [label="Function call: R|/x|.#()"]; - 117 [label="Exit block"]; + 119 [label="Access variable R|/x|"]; + 120 [label="Function call: R|/x|.#()"]; + 121 [label="Exit block"]; } - 118 [label="Exit function test_2" style="filled" fillcolor=red]; + 122 [label="Exit function test_2" style="filled" fillcolor=red]; } - 92 -> {93}; - 93 -> {94}; 94 -> {95}; 95 -> {96}; 96 -> {97}; 97 -> {98}; 98 -> {99}; - 99 -> {108 100}; + 99 -> {100}; 100 -> {101}; - 101 -> {102}; + 101 -> {111 102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; 106 -> {107}; - 107 -> {114}; + 107 -> {108}; 108 -> {109}; 109 -> {110}; - 110 -> {111}; + 110 -> {118}; 111 -> {112}; 112 -> {113}; 113 -> {114}; @@ -361,175 +365,183 @@ digraph nullability_kt { 115 -> {116}; 116 -> {117}; 117 -> {118}; - - subgraph cluster_37 { - color=red - 119 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_38 { - color=blue - 120 [label="Enter block"]; - 121 [label="Access variable R|/x|"]; - 122 [label="Exit lhs of ?:"]; - 123 [label="Enter rhs of ?:"]; - 124 [label="Jump: ^test_3 Unit"]; - 125 [label="Stub" style="filled" fillcolor=gray]; - 126 [label="Lhs of ?: is not null"]; - 127 [label="Exit ?:"]; - 128 [label="Access variable R|/x|"]; - 129 [label="Function call: R|/x|.R|/A.foo|()"]; - 130 [label="Exit block"]; - } - 131 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 118 -> {119}; 119 -> {120}; 120 -> {121}; 121 -> {122}; - 122 -> {126 123}; - 123 -> {124}; - 124 -> {131}; - 124 -> {125} [style=dotted]; - 125 -> {127} [style=dotted]; - 126 -> {127}; - 127 -> {128}; - 128 -> {129}; - 129 -> {130}; - 130 -> {131}; - subgraph cluster_39 { + subgraph cluster_37 { color=red - 132 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_40 { + 123 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_38 { color=blue - 133 [label="Enter block"]; - subgraph cluster_41 { - color=blue - 134 [label="Enter when"]; - subgraph cluster_42 { - color=blue - 135 [label="Enter when branch condition "]; - 136 [label="Access variable R|/x|"]; - 137 [label="Enter safe call"]; - 138 [label="Function call: $subj$.R|/A.getA|()"]; - 139 [label="Exit safe call"]; - 140 [label="Const: Null(null)"]; - 141 [label="Equality operator =="]; - 142 [label="Exit when branch condition"]; - } - 143 [label="Synthetic else branch"]; - 144 [label="Enter when branch result"]; - subgraph cluster_43 { - color=blue - 145 [label="Enter block"]; - 146 [label="Jump: ^test_4 Unit"]; - 147 [label="Stub" style="filled" fillcolor=gray]; - 148 [label="Exit block" style="filled" fillcolor=gray]; - } - 149 [label="Exit when branch result" style="filled" fillcolor=gray]; - 150 [label="Exit when"]; - } - 151 [label="Access variable R|/x|"]; - 152 [label="Function call: R|/x|.R|/A.foo|()"]; - 153 [label="Exit block"]; + 124 [label="Enter block"]; + 125 [label="Access variable R|/x|"]; + 126 [label="Exit lhs of ?:"]; + 127 [label="Enter rhs of ?:"]; + 128 [label="Jump: ^test_3 Unit"]; + 129 [label="Stub" style="filled" fillcolor=gray]; + 130 [label="Lhs of ?: is not null"]; + 131 [label="Exit ?:"]; + 132 [label="Access variable R|/x|"]; + 133 [label="Smart cast: R|/x|"]; + 134 [label="Function call: R|/x|.R|/A.foo|()"]; + 135 [label="Exit block"]; } - 154 [label="Exit function test_4" style="filled" fillcolor=red]; + 136 [label="Exit function test_3" style="filled" fillcolor=red]; } + 123 -> {124}; + 124 -> {125}; + 125 -> {126}; + 126 -> {130 127}; + 127 -> {128}; + 128 -> {136}; + 128 -> {129} [style=dotted]; + 129 -> {131} [style=dotted]; + 130 -> {131}; + 131 -> {132}; 132 -> {133}; 133 -> {134}; 134 -> {135}; 135 -> {136}; - 136 -> {137 139}; + + subgraph cluster_39 { + color=red + 137 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_40 { + color=blue + 138 [label="Enter block"]; + subgraph cluster_41 { + color=blue + 139 [label="Enter when"]; + subgraph cluster_42 { + color=blue + 140 [label="Enter when branch condition "]; + 141 [label="Access variable R|/x|"]; + 142 [label="Enter safe call"]; + 143 [label="Function call: $subj$.R|/A.getA|()"]; + 144 [label="Exit safe call"]; + 145 [label="Const: Null(null)"]; + 146 [label="Equality operator =="]; + 147 [label="Exit when branch condition"]; + } + 148 [label="Synthetic else branch"]; + 149 [label="Enter when branch result"]; + subgraph cluster_43 { + color=blue + 150 [label="Enter block"]; + 151 [label="Jump: ^test_4 Unit"]; + 152 [label="Stub" style="filled" fillcolor=gray]; + 153 [label="Exit block" style="filled" fillcolor=gray]; + } + 154 [label="Exit when branch result" style="filled" fillcolor=gray]; + 155 [label="Exit when"]; + } + 156 [label="Access variable R|/x|"]; + 157 [label="Smart cast: R|/x|"]; + 158 [label="Function call: R|/x|.R|/A.foo|()"]; + 159 [label="Exit block"]; + } + 160 [label="Exit function test_4" style="filled" fillcolor=red]; + } 137 -> {138}; 138 -> {139}; 139 -> {140}; 140 -> {141}; - 141 -> {142}; - 142 -> {144 143}; - 143 -> {150}; + 141 -> {142 144}; + 142 -> {143}; + 143 -> {144}; 144 -> {145}; 145 -> {146}; - 146 -> {154}; - 146 -> {147} [style=dotted]; - 147 -> {148} [style=dotted]; - 148 -> {149} [style=dotted]; - 149 -> {150} [style=dotted]; + 146 -> {147}; + 147 -> {149 148}; + 148 -> {155}; + 149 -> {150}; 150 -> {151}; - 151 -> {152}; - 152 -> {153}; - 153 -> {154}; - - subgraph cluster_44 { - color=red - 155 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_45 { - color=blue - 156 [label="Enter block"]; - subgraph cluster_46 { - color=blue - 157 [label="Enter when"]; - subgraph cluster_47 { - color=blue - 158 [label="Enter when branch condition "]; - 159 [label="Access variable R|/q|"]; - 160 [label="Enter safe call"]; - 161 [label="Access variable R|/Q.data|"]; - 162 [label="Exit safe call"]; - 163 [label="Enter safe call"]; - 164 [label="Access variable R|/MyData.s|"]; - 165 [label="Exit safe call"]; - 166 [label="Enter safe call"]; - 167 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; - 168 [label="Exit safe call"]; - 169 [label="Const: Null(null)"]; - 170 [label="Equality operator !="]; - 171 [label="Exit when branch condition"]; - } - 172 [label="Synthetic else branch"]; - 173 [label="Enter when branch result"]; - subgraph cluster_48 { - color=blue - 174 [label="Enter block"]; - 175 [label="Access variable R|/q|"]; - 176 [label="Access variable R|/Q.data|"]; - 177 [label="Access variable R|/q|"]; - 178 [label="Access variable R|/Q.data|"]; - 179 [label="Access variable #"]; - 180 [label="Access variable R|/q|"]; - 181 [label="Access variable R|/Q.data|"]; - 182 [label="Access variable #"]; - 183 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; - 184 [label="Exit block"]; - } - 185 [label="Exit when branch result"]; - 186 [label="Exit when"]; - } - 187 [label="Exit block"]; - } - 188 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 151 -> {160}; + 151 -> {152} [style=dotted]; + 152 -> {153} [style=dotted]; + 153 -> {154} [style=dotted]; + 154 -> {155} [style=dotted]; 155 -> {156}; 156 -> {157}; 157 -> {158}; 158 -> {159}; - 159 -> {160 162}; - 160 -> {161}; + 159 -> {160}; + + subgraph cluster_44 { + color=red + 161 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_45 { + color=blue + 162 [label="Enter block"]; + subgraph cluster_46 { + color=blue + 163 [label="Enter when"]; + subgraph cluster_47 { + color=blue + 164 [label="Enter when branch condition "]; + 165 [label="Access variable R|/q|"]; + 166 [label="Enter safe call"]; + 167 [label="Access variable R|/Q.data|"]; + 168 [label="Exit safe call"]; + 169 [label="Enter safe call"]; + 170 [label="Access variable R|/MyData.s|"]; + 171 [label="Exit safe call"]; + 172 [label="Enter safe call"]; + 173 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; + 174 [label="Exit safe call"]; + 175 [label="Const: Null(null)"]; + 176 [label="Equality operator !="]; + 177 [label="Exit when branch condition"]; + } + 178 [label="Synthetic else branch"]; + 179 [label="Enter when branch result"]; + subgraph cluster_48 { + color=blue + 180 [label="Enter block"]; + 181 [label="Access variable R|/q|"]; + 182 [label="Smart cast: R|/q|"]; + 183 [label="Access variable R|/Q.data|"]; + 184 [label="Smart cast: R|/q|.R|/Q.data|"]; + 185 [label="Access variable R|/q|"]; + 186 [label="Smart cast: R|/q|"]; + 187 [label="Access variable R|/Q.data|"]; + 188 [label="Smart cast: R|/q|.R|/Q.data|"]; + 189 [label="Access variable #"]; + 190 [label="Access variable R|/q|"]; + 191 [label="Smart cast: R|/q|"]; + 192 [label="Access variable R|/Q.data|"]; + 193 [label="Smart cast: R|/q|.R|/Q.data|"]; + 194 [label="Access variable #"]; + 195 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; + 196 [label="Exit block"]; + } + 197 [label="Exit when branch result"]; + 198 [label="Exit when"]; + } + 199 [label="Exit block"]; + } + 200 [label="Exit function test_5" style="filled" fillcolor=red]; + } 161 -> {162}; - 162 -> {163 165}; + 162 -> {163}; 163 -> {164}; 164 -> {165}; 165 -> {166 168}; 166 -> {167}; 167 -> {168}; - 168 -> {169}; + 168 -> {169 171}; 169 -> {170}; 170 -> {171}; - 171 -> {173 172}; - 172 -> {186}; + 171 -> {172 174}; + 172 -> {173}; 173 -> {174}; 174 -> {175}; 175 -> {176}; 176 -> {177}; - 177 -> {178}; - 178 -> {179}; + 177 -> {179 178}; + 178 -> {198}; 179 -> {180}; 180 -> {181}; 181 -> {182}; @@ -539,199 +551,175 @@ digraph nullability_kt { 185 -> {186}; 186 -> {187}; 187 -> {188}; - - subgraph cluster_49 { - color=red - 189 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_50 { - color=blue - 190 [label="Enter block"]; - 191 [label="Access variable R|/q|"]; - 192 [label="Enter safe call"]; - 193 [label="Access variable R|/Q.data|"]; - 194 [label="Exit safe call"]; - 195 [label="Enter safe call"]; - 196 [label="Access variable R|/MyData.s|"]; - 197 [label="Exit safe call"]; - 198 [label="Enter safe call"]; - 199 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; - 200 [label="Exit safe call"]; - 201 [label="Exit lhs of ?:"]; - 202 [label="Enter rhs of ?:"]; - 203 [label="Jump: ^test_6 Unit"]; - 204 [label="Stub" style="filled" fillcolor=gray]; - 205 [label="Lhs of ?: is not null"]; - 206 [label="Exit ?:"]; - 207 [label="Access variable R|/q|"]; - 208 [label="Access variable R|/Q.data|"]; - 209 [label="Access variable R|/q|"]; - 210 [label="Access variable R|/Q.data|"]; - 211 [label="Access variable #"]; - 212 [label="Access variable R|/q|"]; - 213 [label="Access variable R|/Q.data|"]; - 214 [label="Access variable #"]; - 215 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; - 216 [label="Exit block"]; - } - 217 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 188 -> {189}; 189 -> {190}; 190 -> {191}; - 191 -> {192 194}; + 191 -> {192}; 192 -> {193}; 193 -> {194}; - 194 -> {195 197}; + 194 -> {195}; 195 -> {196}; 196 -> {197}; 197 -> {198}; - 197 -> {200} [color=red]; - 197 -> {202} [color=green]; 198 -> {199}; 199 -> {200}; - 200 -> {201}; - 201 -> {205 202}; + + subgraph cluster_49 { + color=red + 201 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_50 { + color=blue + 202 [label="Enter block"]; + 203 [label="Access variable R|/q|"]; + 204 [label="Enter safe call"]; + 205 [label="Access variable R|/Q.data|"]; + 206 [label="Exit safe call"]; + 207 [label="Enter safe call"]; + 208 [label="Access variable R|/MyData.s|"]; + 209 [label="Exit safe call"]; + 210 [label="Enter safe call"]; + 211 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; + 212 [label="Exit safe call"]; + 213 [label="Exit lhs of ?:"]; + 214 [label="Enter rhs of ?:"]; + 215 [label="Jump: ^test_6 Unit"]; + 216 [label="Stub" style="filled" fillcolor=gray]; + 217 [label="Lhs of ?: is not null"]; + 218 [label="Exit ?:"]; + 219 [label="Access variable R|/q|"]; + 220 [label="Smart cast: R|/q|"]; + 221 [label="Access variable R|/Q.data|"]; + 222 [label="Smart cast: R|/q|.R|/Q.data|"]; + 223 [label="Access variable R|/q|"]; + 224 [label="Smart cast: R|/q|"]; + 225 [label="Access variable R|/Q.data|"]; + 226 [label="Smart cast: R|/q|.R|/Q.data|"]; + 227 [label="Access variable #"]; + 228 [label="Access variable R|/q|"]; + 229 [label="Smart cast: R|/q|"]; + 230 [label="Access variable R|/Q.data|"]; + 231 [label="Smart cast: R|/q|.R|/Q.data|"]; + 232 [label="Access variable #"]; + 233 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; + 234 [label="Exit block"]; + } + 235 [label="Exit function test_6" style="filled" fillcolor=red]; + } + 201 -> {202}; 202 -> {203}; - 203 -> {217}; - 203 -> {204} [style=dotted]; - 204 -> {206} [style=dotted]; + 203 -> {204 206}; + 204 -> {205}; 205 -> {206}; - 206 -> {207}; + 206 -> {207 209}; 207 -> {208}; 208 -> {209}; 209 -> {210}; + 209 -> {212} [color=red]; + 209 -> {214} [color=green]; 210 -> {211}; 211 -> {212}; 212 -> {213}; - 213 -> {214}; + 213 -> {217 214}; 214 -> {215}; - 215 -> {216}; - 216 -> {217}; - - subgraph cluster_51 { - color=red - 218 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_52 { - color=blue - 219 [label="Enter block"]; - subgraph cluster_53 { - color=blue - 220 [label="Enter when"]; - subgraph cluster_54 { - color=blue - 221 [label="Enter when branch condition "]; - 222 [label="Access variable R|/q|"]; - 223 [label="Enter safe call"]; - 224 [label="Function call: $subj$.R|/Q.fdata|()"]; - 225 [label="Exit safe call"]; - 226 [label="Enter safe call"]; - 227 [label="Function call: $subj$.R|/MyData.fs|()"]; - 228 [label="Exit safe call"]; - 229 [label="Enter safe call"]; - 230 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; - 231 [label="Exit safe call"]; - 232 [label="Const: Null(null)"]; - 233 [label="Equality operator !="]; - 234 [label="Exit when branch condition"]; - } - 235 [label="Synthetic else branch"]; - 236 [label="Enter when branch result"]; - subgraph cluster_55 { - color=blue - 237 [label="Enter block"]; - 238 [label="Access variable R|/q|"]; - 239 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 240 [label="Access variable R|/q|"]; - 241 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 242 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; - 243 [label="Access variable R|/q|"]; - 244 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 245 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; - 246 [label="Function call: R|/q|.R|/Q.fdata|().#().R|kotlin/Int.inc|()"]; - 247 [label="Exit block"]; - } - 248 [label="Exit when branch result"]; - 249 [label="Exit when"]; - } - 250 [label="Exit block"]; - } - 251 [label="Exit function test_7" style="filled" fillcolor=red]; - } + 215 -> {235}; + 215 -> {216} [style=dotted]; + 216 -> {218} [style=dotted]; + 217 -> {218}; 218 -> {219}; 219 -> {220}; 220 -> {221}; 221 -> {222}; - 222 -> {223 225}; + 222 -> {223}; 223 -> {224}; 224 -> {225}; - 225 -> {226 228}; + 225 -> {226}; 226 -> {227}; 227 -> {228}; - 228 -> {229 231}; + 228 -> {229}; 229 -> {230}; 230 -> {231}; 231 -> {232}; 232 -> {233}; 233 -> {234}; - 234 -> {236 235}; - 235 -> {249}; + 234 -> {235}; + + subgraph cluster_51 { + color=red + 236 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_52 { + color=blue + 237 [label="Enter block"]; + subgraph cluster_53 { + color=blue + 238 [label="Enter when"]; + subgraph cluster_54 { + color=blue + 239 [label="Enter when branch condition "]; + 240 [label="Access variable R|/q|"]; + 241 [label="Enter safe call"]; + 242 [label="Function call: $subj$.R|/Q.fdata|()"]; + 243 [label="Exit safe call"]; + 244 [label="Enter safe call"]; + 245 [label="Function call: $subj$.R|/MyData.fs|()"]; + 246 [label="Exit safe call"]; + 247 [label="Enter safe call"]; + 248 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; + 249 [label="Exit safe call"]; + 250 [label="Const: Null(null)"]; + 251 [label="Equality operator !="]; + 252 [label="Exit when branch condition"]; + } + 253 [label="Synthetic else branch"]; + 254 [label="Enter when branch result"]; + subgraph cluster_55 { + color=blue + 255 [label="Enter block"]; + 256 [label="Access variable R|/q|"]; + 257 [label="Smart cast: R|/q|"]; + 258 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 259 [label="Access variable R|/q|"]; + 260 [label="Smart cast: R|/q|"]; + 261 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 262 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 263 [label="Access variable R|/q|"]; + 264 [label="Smart cast: R|/q|"]; + 265 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 266 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 267 [label="Function call: R|/q|.R|/Q.fdata|().#().R|kotlin/Int.inc|()"]; + 268 [label="Exit block"]; + } + 269 [label="Exit when branch result"]; + 270 [label="Exit when"]; + } + 271 [label="Exit block"]; + } + 272 [label="Exit function test_7" style="filled" fillcolor=red]; + } 236 -> {237}; 237 -> {238}; 238 -> {239}; 239 -> {240}; - 240 -> {241}; + 240 -> {241 243}; 241 -> {242}; 242 -> {243}; - 243 -> {244}; + 243 -> {244 246}; 244 -> {245}; 245 -> {246}; - 246 -> {247}; + 246 -> {247 249}; 247 -> {248}; 248 -> {249}; 249 -> {250}; 250 -> {251}; - - subgraph cluster_56 { - color=red - 252 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_57 { - color=blue - 253 [label="Enter block"]; - subgraph cluster_58 { - color=blue - 254 [label="Enter when"]; - subgraph cluster_59 { - color=blue - 255 [label="Enter when branch condition "]; - 256 [label="Access variable R|/b|"]; - 257 [label="Const: Boolean(true)"]; - 258 [label="Equality operator =="]; - 259 [label="Exit when branch condition"]; - } - 260 [label="Synthetic else branch"]; - 261 [label="Enter when branch result"]; - subgraph cluster_60 { - color=blue - 262 [label="Enter block"]; - 263 [label="Access variable R|/b|"]; - 264 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 265 [label="Exit block"]; - } - 266 [label="Exit when branch result"]; - 267 [label="Exit when"]; - } - 268 [label="Exit block"]; - } - 269 [label="Exit function test_8" style="filled" fillcolor=red]; - } - 252 -> {253}; - 253 -> {254}; + 251 -> {252}; + 252 -> {254 253}; + 253 -> {270}; 254 -> {255}; 255 -> {256}; 256 -> {257}; 257 -> {258}; 258 -> {259}; - 259 -> {261 260}; - 260 -> {267}; + 259 -> {260}; + 260 -> {261}; 261 -> {262}; 262 -> {263}; 263 -> {264}; @@ -740,129 +728,53 @@ digraph nullability_kt { 266 -> {267}; 267 -> {268}; 268 -> {269}; - - subgraph cluster_61 { - color=red - 270 [label="Enter function test_9" style="filled" fillcolor=red]; - subgraph cluster_62 { - color=blue - 271 [label="Enter block"]; - subgraph cluster_63 { - color=blue - 272 [label="Enter when"]; - subgraph cluster_64 { - color=blue - 273 [label="Enter when branch condition "]; - 274 [label="Access variable R|/a|"]; - 275 [label="Access variable R|/b|"]; - 276 [label="Equality operator =="]; - 277 [label="Exit when branch condition"]; - } - 278 [label="Synthetic else branch"]; - 279 [label="Enter when branch result"]; - subgraph cluster_65 { - color=blue - 280 [label="Enter block"]; - 281 [label="Access variable R|/b|"]; - 282 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 283 [label="Exit block"]; - } - 284 [label="Exit when branch result"]; - 285 [label="Exit when"]; - } - 286 [label="Access variable R|/b|"]; - 287 [label="Function call: R|/b|.#()"]; - subgraph cluster_66 { - color=blue - 288 [label="Enter when"]; - subgraph cluster_67 { - color=blue - 289 [label="Enter when branch condition "]; - 290 [label="Access variable R|/a|"]; - 291 [label="Access variable R|/b|"]; - 292 [label="Equality operator ==="]; - 293 [label="Exit when branch condition"]; - } - 294 [label="Synthetic else branch"]; - 295 [label="Enter when branch result"]; - subgraph cluster_68 { - color=blue - 296 [label="Enter block"]; - 297 [label="Access variable R|/b|"]; - 298 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 299 [label="Exit block"]; - } - 300 [label="Exit when branch result"]; - 301 [label="Exit when"]; - } - 302 [label="Access variable R|/b|"]; - 303 [label="Function call: R|/b|.#()"]; - subgraph cluster_69 { - color=blue - 304 [label="Enter when"]; - subgraph cluster_70 { - color=blue - 305 [label="Enter when branch condition "]; - 306 [label="Access variable R|/b|"]; - 307 [label="Access variable R|/a|"]; - 308 [label="Equality operator =="]; - 309 [label="Exit when branch condition"]; - } - 310 [label="Synthetic else branch"]; - 311 [label="Enter when branch result"]; - subgraph cluster_71 { - color=blue - 312 [label="Enter block"]; - 313 [label="Access variable R|/b|"]; - 314 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 315 [label="Exit block"]; - } - 316 [label="Exit when branch result"]; - 317 [label="Exit when"]; - } - 318 [label="Access variable R|/b|"]; - 319 [label="Function call: R|/b|.#()"]; - subgraph cluster_72 { - color=blue - 320 [label="Enter when"]; - subgraph cluster_73 { - color=blue - 321 [label="Enter when branch condition "]; - 322 [label="Access variable R|/b|"]; - 323 [label="Access variable R|/a|"]; - 324 [label="Equality operator ==="]; - 325 [label="Exit when branch condition"]; - } - 326 [label="Synthetic else branch"]; - 327 [label="Enter when branch result"]; - subgraph cluster_74 { - color=blue - 328 [label="Enter block"]; - 329 [label="Access variable R|/b|"]; - 330 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 331 [label="Exit block"]; - } - 332 [label="Exit when branch result"]; - 333 [label="Exit when"]; - } - 334 [label="Access variable R|/b|"]; - 335 [label="Function call: R|/b|.#()"]; - 336 [label="Exit block"]; - } - 337 [label="Exit function test_9" style="filled" fillcolor=red]; - } + 269 -> {270}; 270 -> {271}; 271 -> {272}; - 272 -> {273}; + + subgraph cluster_56 { + color=red + 273 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_57 { + color=blue + 274 [label="Enter block"]; + subgraph cluster_58 { + color=blue + 275 [label="Enter when"]; + subgraph cluster_59 { + color=blue + 276 [label="Enter when branch condition "]; + 277 [label="Access variable R|/b|"]; + 278 [label="Const: Boolean(true)"]; + 279 [label="Equality operator =="]; + 280 [label="Exit when branch condition"]; + } + 281 [label="Synthetic else branch"]; + 282 [label="Enter when branch result"]; + subgraph cluster_60 { + color=blue + 283 [label="Enter block"]; + 284 [label="Access variable R|/b|"]; + 285 [label="Smart cast: R|/b|"]; + 286 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 287 [label="Exit block"]; + } + 288 [label="Exit when branch result"]; + 289 [label="Exit when"]; + } + 290 [label="Exit block"]; + } + 291 [label="Exit function test_8" style="filled" fillcolor=red]; + } 273 -> {274}; 274 -> {275}; 275 -> {276}; 276 -> {277}; - 277 -> {279 278}; - 278 -> {285}; + 277 -> {278}; + 278 -> {279}; 279 -> {280}; - 280 -> {281}; - 281 -> {282}; + 280 -> {282 281}; + 281 -> {289}; 282 -> {283}; 283 -> {284}; 284 -> {285}; @@ -872,16 +784,130 @@ digraph nullability_kt { 288 -> {289}; 289 -> {290}; 290 -> {291}; - 291 -> {292}; + + subgraph cluster_61 { + color=red + 292 [label="Enter function test_9" style="filled" fillcolor=red]; + subgraph cluster_62 { + color=blue + 293 [label="Enter block"]; + subgraph cluster_63 { + color=blue + 294 [label="Enter when"]; + subgraph cluster_64 { + color=blue + 295 [label="Enter when branch condition "]; + 296 [label="Access variable R|/a|"]; + 297 [label="Access variable R|/b|"]; + 298 [label="Equality operator =="]; + 299 [label="Exit when branch condition"]; + } + 300 [label="Synthetic else branch"]; + 301 [label="Enter when branch result"]; + subgraph cluster_65 { + color=blue + 302 [label="Enter block"]; + 303 [label="Access variable R|/b|"]; + 304 [label="Smart cast: R|/b|"]; + 305 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 306 [label="Exit block"]; + } + 307 [label="Exit when branch result"]; + 308 [label="Exit when"]; + } + 309 [label="Access variable R|/b|"]; + 310 [label="Function call: R|/b|.#()"]; + subgraph cluster_66 { + color=blue + 311 [label="Enter when"]; + subgraph cluster_67 { + color=blue + 312 [label="Enter when branch condition "]; + 313 [label="Access variable R|/a|"]; + 314 [label="Access variable R|/b|"]; + 315 [label="Equality operator ==="]; + 316 [label="Exit when branch condition"]; + } + 317 [label="Synthetic else branch"]; + 318 [label="Enter when branch result"]; + subgraph cluster_68 { + color=blue + 319 [label="Enter block"]; + 320 [label="Access variable R|/b|"]; + 321 [label="Smart cast: R|/b|"]; + 322 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 323 [label="Exit block"]; + } + 324 [label="Exit when branch result"]; + 325 [label="Exit when"]; + } + 326 [label="Access variable R|/b|"]; + 327 [label="Function call: R|/b|.#()"]; + subgraph cluster_69 { + color=blue + 328 [label="Enter when"]; + subgraph cluster_70 { + color=blue + 329 [label="Enter when branch condition "]; + 330 [label="Access variable R|/b|"]; + 331 [label="Access variable R|/a|"]; + 332 [label="Equality operator =="]; + 333 [label="Exit when branch condition"]; + } + 334 [label="Synthetic else branch"]; + 335 [label="Enter when branch result"]; + subgraph cluster_71 { + color=blue + 336 [label="Enter block"]; + 337 [label="Access variable R|/b|"]; + 338 [label="Smart cast: R|/b|"]; + 339 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 340 [label="Exit block"]; + } + 341 [label="Exit when branch result"]; + 342 [label="Exit when"]; + } + 343 [label="Access variable R|/b|"]; + 344 [label="Function call: R|/b|.#()"]; + subgraph cluster_72 { + color=blue + 345 [label="Enter when"]; + subgraph cluster_73 { + color=blue + 346 [label="Enter when branch condition "]; + 347 [label="Access variable R|/b|"]; + 348 [label="Access variable R|/a|"]; + 349 [label="Equality operator ==="]; + 350 [label="Exit when branch condition"]; + } + 351 [label="Synthetic else branch"]; + 352 [label="Enter when branch result"]; + subgraph cluster_74 { + color=blue + 353 [label="Enter block"]; + 354 [label="Access variable R|/b|"]; + 355 [label="Smart cast: R|/b|"]; + 356 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 357 [label="Exit block"]; + } + 358 [label="Exit when branch result"]; + 359 [label="Exit when"]; + } + 360 [label="Access variable R|/b|"]; + 361 [label="Function call: R|/b|.#()"]; + 362 [label="Exit block"]; + } + 363 [label="Exit function test_9" style="filled" fillcolor=red]; + } 292 -> {293}; - 293 -> {295 294}; - 294 -> {301}; + 293 -> {294}; + 294 -> {295}; 295 -> {296}; 296 -> {297}; 297 -> {298}; 298 -> {299}; - 299 -> {300}; - 300 -> {301}; + 299 -> {301 300}; + 300 -> {308}; 301 -> {302}; 302 -> {303}; 303 -> {304}; @@ -890,15 +916,15 @@ digraph nullability_kt { 306 -> {307}; 307 -> {308}; 308 -> {309}; - 309 -> {311 310}; - 310 -> {317}; + 309 -> {310}; + 310 -> {311}; 311 -> {312}; 312 -> {313}; 313 -> {314}; 314 -> {315}; 315 -> {316}; - 316 -> {317}; - 317 -> {318}; + 316 -> {318 317}; + 317 -> {325}; 318 -> {319}; 319 -> {320}; 320 -> {321}; @@ -906,129 +932,19 @@ digraph nullability_kt { 322 -> {323}; 323 -> {324}; 324 -> {325}; - 325 -> {327 326}; - 326 -> {333}; + 325 -> {326}; + 326 -> {327}; 327 -> {328}; 328 -> {329}; 329 -> {330}; 330 -> {331}; 331 -> {332}; 332 -> {333}; - 333 -> {334}; - 334 -> {335}; + 333 -> {335 334}; + 334 -> {342}; 335 -> {336}; 336 -> {337}; - - subgraph cluster_75 { - color=red - 338 [label="Enter function test_10" style="filled" fillcolor=red]; - subgraph cluster_76 { - color=blue - 339 [label="Enter block"]; - subgraph cluster_77 { - color=blue - 340 [label="Enter when"]; - subgraph cluster_78 { - color=blue - 341 [label="Enter when branch condition "]; - 342 [label="Access variable R|/a|"]; - 343 [label="Access variable R|/b|"]; - 344 [label="Equality operator =="]; - 345 [label="Exit when branch condition"]; - } - 346 [label="Synthetic else branch"]; - 347 [label="Enter when branch result"]; - subgraph cluster_79 { - color=blue - 348 [label="Enter block"]; - 349 [label="Access variable R|/b|"]; - 350 [label="Function call: R|/b|.#()"]; - 351 [label="Exit block"]; - } - 352 [label="Exit when branch result"]; - 353 [label="Exit when"]; - } - 354 [label="Access variable R|/b|"]; - 355 [label="Function call: R|/b|.#()"]; - subgraph cluster_80 { - color=blue - 356 [label="Enter when"]; - subgraph cluster_81 { - color=blue - 357 [label="Enter when branch condition "]; - 358 [label="Access variable R|/a|"]; - 359 [label="Access variable R|/b|"]; - 360 [label="Equality operator ==="]; - 361 [label="Exit when branch condition"]; - } - 362 [label="Synthetic else branch"]; - 363 [label="Enter when branch result"]; - subgraph cluster_82 { - color=blue - 364 [label="Enter block"]; - 365 [label="Access variable R|/b|"]; - 366 [label="Function call: R|/b|.#()"]; - 367 [label="Exit block"]; - } - 368 [label="Exit when branch result"]; - 369 [label="Exit when"]; - } - 370 [label="Access variable R|/b|"]; - 371 [label="Function call: R|/b|.#()"]; - subgraph cluster_83 { - color=blue - 372 [label="Enter when"]; - subgraph cluster_84 { - color=blue - 373 [label="Enter when branch condition "]; - 374 [label="Access variable R|/b|"]; - 375 [label="Access variable R|/a|"]; - 376 [label="Equality operator =="]; - 377 [label="Exit when branch condition"]; - } - 378 [label="Synthetic else branch"]; - 379 [label="Enter when branch result"]; - subgraph cluster_85 { - color=blue - 380 [label="Enter block"]; - 381 [label="Access variable R|/b|"]; - 382 [label="Function call: R|/b|.#()"]; - 383 [label="Exit block"]; - } - 384 [label="Exit when branch result"]; - 385 [label="Exit when"]; - } - 386 [label="Access variable R|/b|"]; - 387 [label="Function call: R|/b|.#()"]; - subgraph cluster_86 { - color=blue - 388 [label="Enter when"]; - subgraph cluster_87 { - color=blue - 389 [label="Enter when branch condition "]; - 390 [label="Access variable R|/b|"]; - 391 [label="Access variable R|/a|"]; - 392 [label="Equality operator ==="]; - 393 [label="Exit when branch condition"]; - } - 394 [label="Synthetic else branch"]; - 395 [label="Enter when branch result"]; - subgraph cluster_88 { - color=blue - 396 [label="Enter block"]; - 397 [label="Access variable R|/b|"]; - 398 [label="Function call: R|/b|.#()"]; - 399 [label="Exit block"]; - } - 400 [label="Exit when branch result"]; - 401 [label="Exit when"]; - } - 402 [label="Access variable R|/b|"]; - 403 [label="Function call: R|/b|.#()"]; - 404 [label="Exit block"]; - } - 405 [label="Exit function test_10" style="filled" fillcolor=red]; - } + 337 -> {338}; 338 -> {339}; 339 -> {340}; 340 -> {341}; @@ -1036,13 +952,13 @@ digraph nullability_kt { 342 -> {343}; 343 -> {344}; 344 -> {345}; - 345 -> {347 346}; - 346 -> {353}; + 345 -> {346}; + 346 -> {347}; 347 -> {348}; 348 -> {349}; 349 -> {350}; - 350 -> {351}; - 351 -> {352}; + 350 -> {352 351}; + 351 -> {359}; 352 -> {353}; 353 -> {354}; 354 -> {355}; @@ -1052,9 +968,119 @@ digraph nullability_kt { 358 -> {359}; 359 -> {360}; 360 -> {361}; - 361 -> {363 362}; - 362 -> {369}; - 363 -> {364}; + 361 -> {362}; + 362 -> {363}; + + subgraph cluster_75 { + color=red + 364 [label="Enter function test_10" style="filled" fillcolor=red]; + subgraph cluster_76 { + color=blue + 365 [label="Enter block"]; + subgraph cluster_77 { + color=blue + 366 [label="Enter when"]; + subgraph cluster_78 { + color=blue + 367 [label="Enter when branch condition "]; + 368 [label="Access variable R|/a|"]; + 369 [label="Access variable R|/b|"]; + 370 [label="Equality operator =="]; + 371 [label="Exit when branch condition"]; + } + 372 [label="Synthetic else branch"]; + 373 [label="Enter when branch result"]; + subgraph cluster_79 { + color=blue + 374 [label="Enter block"]; + 375 [label="Access variable R|/b|"]; + 376 [label="Function call: R|/b|.#()"]; + 377 [label="Exit block"]; + } + 378 [label="Exit when branch result"]; + 379 [label="Exit when"]; + } + 380 [label="Access variable R|/b|"]; + 381 [label="Function call: R|/b|.#()"]; + subgraph cluster_80 { + color=blue + 382 [label="Enter when"]; + subgraph cluster_81 { + color=blue + 383 [label="Enter when branch condition "]; + 384 [label="Access variable R|/a|"]; + 385 [label="Access variable R|/b|"]; + 386 [label="Equality operator ==="]; + 387 [label="Exit when branch condition"]; + } + 388 [label="Synthetic else branch"]; + 389 [label="Enter when branch result"]; + subgraph cluster_82 { + color=blue + 390 [label="Enter block"]; + 391 [label="Access variable R|/b|"]; + 392 [label="Function call: R|/b|.#()"]; + 393 [label="Exit block"]; + } + 394 [label="Exit when branch result"]; + 395 [label="Exit when"]; + } + 396 [label="Access variable R|/b|"]; + 397 [label="Function call: R|/b|.#()"]; + subgraph cluster_83 { + color=blue + 398 [label="Enter when"]; + subgraph cluster_84 { + color=blue + 399 [label="Enter when branch condition "]; + 400 [label="Access variable R|/b|"]; + 401 [label="Access variable R|/a|"]; + 402 [label="Equality operator =="]; + 403 [label="Exit when branch condition"]; + } + 404 [label="Synthetic else branch"]; + 405 [label="Enter when branch result"]; + subgraph cluster_85 { + color=blue + 406 [label="Enter block"]; + 407 [label="Access variable R|/b|"]; + 408 [label="Function call: R|/b|.#()"]; + 409 [label="Exit block"]; + } + 410 [label="Exit when branch result"]; + 411 [label="Exit when"]; + } + 412 [label="Access variable R|/b|"]; + 413 [label="Function call: R|/b|.#()"]; + subgraph cluster_86 { + color=blue + 414 [label="Enter when"]; + subgraph cluster_87 { + color=blue + 415 [label="Enter when branch condition "]; + 416 [label="Access variable R|/b|"]; + 417 [label="Access variable R|/a|"]; + 418 [label="Equality operator ==="]; + 419 [label="Exit when branch condition"]; + } + 420 [label="Synthetic else branch"]; + 421 [label="Enter when branch result"]; + subgraph cluster_88 { + color=blue + 422 [label="Enter block"]; + 423 [label="Access variable R|/b|"]; + 424 [label="Function call: R|/b|.#()"]; + 425 [label="Exit block"]; + } + 426 [label="Exit when branch result"]; + 427 [label="Exit when"]; + } + 428 [label="Access variable R|/b|"]; + 429 [label="Function call: R|/b|.#()"]; + 430 [label="Exit block"]; + } + 431 [label="Exit function test_10" style="filled" fillcolor=red]; + } 364 -> {365}; 365 -> {366}; 366 -> {367}; @@ -1062,14 +1088,14 @@ digraph nullability_kt { 368 -> {369}; 369 -> {370}; 370 -> {371}; - 371 -> {372}; - 372 -> {373}; + 371 -> {373 372}; + 372 -> {379}; 373 -> {374}; 374 -> {375}; 375 -> {376}; 376 -> {377}; - 377 -> {379 378}; - 378 -> {385}; + 377 -> {378}; + 378 -> {379}; 379 -> {380}; 380 -> {381}; 381 -> {382}; @@ -1078,14 +1104,14 @@ digraph nullability_kt { 384 -> {385}; 385 -> {386}; 386 -> {387}; - 387 -> {388}; - 388 -> {389}; + 387 -> {389 388}; + 388 -> {395}; 389 -> {390}; 390 -> {391}; 391 -> {392}; 392 -> {393}; - 393 -> {395 394}; - 394 -> {401}; + 393 -> {394}; + 394 -> {395}; 395 -> {396}; 396 -> {397}; 397 -> {398}; @@ -1094,114 +1120,27 @@ digraph nullability_kt { 400 -> {401}; 401 -> {402}; 402 -> {403}; - 403 -> {404}; - 404 -> {405}; - - subgraph cluster_89 { - color=red - 406 [label="Enter function test_11" style="filled" fillcolor=red]; - subgraph cluster_90 { - color=blue - 407 [label="Enter block"]; - subgraph cluster_91 { - color=blue - 408 [label="Enter when"]; - subgraph cluster_92 { - color=blue - 409 [label="Enter when branch condition "]; - 410 [label="Access variable R|/q|"]; - 411 [label="Enter safe call"]; - 412 [label="Access variable R|/QImpl.data|"]; - 413 [label="Exit safe call"]; - 414 [label="Enter safe call"]; - 415 [label="Access variable R|/MyData.s|"]; - 416 [label="Exit safe call"]; - 417 [label="Enter safe call"]; - 418 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; - 419 [label="Exit safe call"]; - 420 [label="Const: Null(null)"]; - 421 [label="Equality operator !="]; - 422 [label="Exit when branch condition"]; - } - 423 [label="Synthetic else branch"]; - 424 [label="Enter when branch result"]; - subgraph cluster_93 { - color=blue - 425 [label="Enter block"]; - 426 [label="Access variable R|/q|"]; - 427 [label="Access variable R|/QImpl.data|"]; - 428 [label="Access variable R|/q|"]; - 429 [label="Access variable R|/QImpl.data|"]; - 430 [label="Access variable R|/MyData.s|"]; - 431 [label="Access variable R|/q|"]; - 432 [label="Access variable R|/QImpl.data|"]; - 433 [label="Access variable R|/MyData.s|"]; - 434 [label="Function call: R|/q|.R|/QImpl.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; - 435 [label="Access variable R|/q2|"]; - 436 [label="Access variable R|/QImpl.data|"]; - 437 [label="Access variable R|/q2|"]; - 438 [label="Access variable R|/QImpl.data|"]; - 439 [label="Access variable #"]; - 440 [label="Access variable R|/q2|"]; - 441 [label="Access variable R|/QImpl.data|"]; - 442 [label="Access variable #"]; - 443 [label="Function call: R|/q2|.R|/QImpl.data|.#.R|kotlin/Int.inc|()"]; - subgraph cluster_94 { - color=blue - 444 [label="Enter when"]; - subgraph cluster_95 { - color=blue - 445 [label="Enter when branch condition "]; - 446 [label="Access variable R|/q2|"]; - 447 [label="Access variable R|/QImpl.data|"]; - 448 [label="Const: Null(null)"]; - 449 [label="Equality operator !="]; - 450 [label="Exit when branch condition"]; - } - 451 [label="Synthetic else branch"]; - 452 [label="Enter when branch result"]; - subgraph cluster_96 { - color=blue - 453 [label="Enter block"]; - 454 [label="Access variable R|/q2|"]; - 455 [label="Access variable R|/QImpl.data|"]; - 456 [label="Access variable R|/MyData.s|"]; - 457 [label="Access variable R|/q2|"]; - 458 [label="Access variable R|/QImpl.data|"]; - 459 [label="Access variable R|/MyData.s|"]; - 460 [label="Function call: R|/q2|.R|/QImpl.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; - 461 [label="Exit block"]; - } - 462 [label="Exit when branch result"]; - 463 [label="Exit when"]; - } - 464 [label="Exit block"]; - } - 465 [label="Exit when branch result"]; - 466 [label="Exit when"]; - } - 467 [label="Exit block"]; - } - 468 [label="Exit function test_11" style="filled" fillcolor=red]; - } + 403 -> {405 404}; + 404 -> {411}; + 405 -> {406}; 406 -> {407}; 407 -> {408}; 408 -> {409}; 409 -> {410}; - 410 -> {411 413}; + 410 -> {411}; 411 -> {412}; 412 -> {413}; - 413 -> {414 416}; + 413 -> {414}; 414 -> {415}; 415 -> {416}; - 416 -> {417 419}; + 416 -> {417}; 417 -> {418}; 418 -> {419}; - 419 -> {420}; - 420 -> {421}; + 419 -> {421 420}; + 420 -> {427}; 421 -> {422}; - 422 -> {424 423}; - 423 -> {466}; + 422 -> {423}; + 423 -> {424}; 424 -> {425}; 425 -> {426}; 426 -> {427}; @@ -1209,27 +1148,122 @@ digraph nullability_kt { 428 -> {429}; 429 -> {430}; 430 -> {431}; - 431 -> {432}; + + subgraph cluster_89 { + color=red + 432 [label="Enter function test_11" style="filled" fillcolor=red]; + subgraph cluster_90 { + color=blue + 433 [label="Enter block"]; + subgraph cluster_91 { + color=blue + 434 [label="Enter when"]; + subgraph cluster_92 { + color=blue + 435 [label="Enter when branch condition "]; + 436 [label="Access variable R|/q|"]; + 437 [label="Enter safe call"]; + 438 [label="Access variable R|/QImpl.data|"]; + 439 [label="Exit safe call"]; + 440 [label="Enter safe call"]; + 441 [label="Access variable R|/MyData.s|"]; + 442 [label="Exit safe call"]; + 443 [label="Enter safe call"]; + 444 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; + 445 [label="Exit safe call"]; + 446 [label="Const: Null(null)"]; + 447 [label="Equality operator !="]; + 448 [label="Exit when branch condition"]; + } + 449 [label="Synthetic else branch"]; + 450 [label="Enter when branch result"]; + subgraph cluster_93 { + color=blue + 451 [label="Enter block"]; + 452 [label="Access variable R|/q|"]; + 453 [label="Smart cast: R|/q|"]; + 454 [label="Access variable R|/QImpl.data|"]; + 455 [label="Smart cast: R|/q|.R|/QImpl.data|"]; + 456 [label="Access variable R|/q|"]; + 457 [label="Smart cast: R|/q|"]; + 458 [label="Access variable R|/QImpl.data|"]; + 459 [label="Smart cast: R|/q|.R|/QImpl.data|"]; + 460 [label="Access variable R|/MyData.s|"]; + 461 [label="Access variable R|/q|"]; + 462 [label="Smart cast: R|/q|"]; + 463 [label="Access variable R|/QImpl.data|"]; + 464 [label="Smart cast: R|/q|.R|/QImpl.data|"]; + 465 [label="Access variable R|/MyData.s|"]; + 466 [label="Function call: R|/q|.R|/QImpl.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; + 467 [label="Access variable R|/q2|"]; + 468 [label="Access variable R|/QImpl.data|"]; + 469 [label="Access variable R|/q2|"]; + 470 [label="Access variable R|/QImpl.data|"]; + 471 [label="Access variable #"]; + 472 [label="Access variable R|/q2|"]; + 473 [label="Access variable R|/QImpl.data|"]; + 474 [label="Access variable #"]; + 475 [label="Function call: R|/q2|.R|/QImpl.data|.#.R|kotlin/Int.inc|()"]; + subgraph cluster_94 { + color=blue + 476 [label="Enter when"]; + subgraph cluster_95 { + color=blue + 477 [label="Enter when branch condition "]; + 478 [label="Access variable R|/q2|"]; + 479 [label="Access variable R|/QImpl.data|"]; + 480 [label="Const: Null(null)"]; + 481 [label="Equality operator !="]; + 482 [label="Exit when branch condition"]; + } + 483 [label="Synthetic else branch"]; + 484 [label="Enter when branch result"]; + subgraph cluster_96 { + color=blue + 485 [label="Enter block"]; + 486 [label="Access variable R|/q2|"]; + 487 [label="Access variable R|/QImpl.data|"]; + 488 [label="Smart cast: R|/q2|.R|/QImpl.data|"]; + 489 [label="Access variable R|/MyData.s|"]; + 490 [label="Access variable R|/q2|"]; + 491 [label="Access variable R|/QImpl.data|"]; + 492 [label="Smart cast: R|/q2|.R|/QImpl.data|"]; + 493 [label="Access variable R|/MyData.s|"]; + 494 [label="Function call: R|/q2|.R|/QImpl.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; + 495 [label="Exit block"]; + } + 496 [label="Exit when branch result"]; + 497 [label="Exit when"]; + } + 498 [label="Exit block"]; + } + 499 [label="Exit when branch result"]; + 500 [label="Exit when"]; + } + 501 [label="Exit block"]; + } + 502 [label="Exit function test_11" style="filled" fillcolor=red]; + } 432 -> {433}; 433 -> {434}; 434 -> {435}; 435 -> {436}; - 436 -> {437}; + 436 -> {437 439}; 437 -> {438}; 438 -> {439}; - 439 -> {440}; + 439 -> {440 442}; 440 -> {441}; 441 -> {442}; - 442 -> {443}; + 442 -> {443 445}; 443 -> {444}; 444 -> {445}; 445 -> {446}; 446 -> {447}; 447 -> {448}; - 448 -> {449}; - 449 -> {450}; - 450 -> {452 451}; - 451 -> {463}; + 448 -> {450 449}; + 449 -> {500}; + 450 -> {451}; + 451 -> {452}; 452 -> {453}; 453 -> {454}; 454 -> {455}; @@ -1246,74 +1280,25 @@ digraph nullability_kt { 465 -> {466}; 466 -> {467}; 467 -> {468}; - - subgraph cluster_97 { - color=red - 469 [label="Enter function test_12" style="filled" fillcolor=red]; - subgraph cluster_98 { - color=blue - 470 [label="Enter block"]; - subgraph cluster_99 { - color=blue - 471 [label="Enter when"]; - subgraph cluster_100 { - color=blue - 472 [label="Enter when branch condition "]; - 473 [label="Access variable R|/q|"]; - 474 [label="Enter safe call"]; - 475 [label="Access variable R|/QImplWithCustomGetter.data|"]; - 476 [label="Exit safe call"]; - 477 [label="Enter safe call"]; - 478 [label="Access variable R|/MyData.s|"]; - 479 [label="Exit safe call"]; - 480 [label="Enter safe call"]; - 481 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; - 482 [label="Exit safe call"]; - 483 [label="Const: Null(null)"]; - 484 [label="Equality operator !="]; - 485 [label="Exit when branch condition"]; - } - 486 [label="Synthetic else branch"]; - 487 [label="Enter when branch result"]; - subgraph cluster_101 { - color=blue - 488 [label="Enter block"]; - 489 [label="Access variable R|/q|"]; - 490 [label="Access variable R|/QImplWithCustomGetter.data|"]; - 491 [label="Access variable R|/q|"]; - 492 [label="Access variable R|/QImplWithCustomGetter.data|"]; - 493 [label="Access variable #"]; - 494 [label="Access variable R|/q|"]; - 495 [label="Access variable R|/QImplWithCustomGetter.data|"]; - 496 [label="Access variable #"]; - 497 [label="Function call: R|/q|.R|/QImplWithCustomGetter.data|.#.R|kotlin/Int.inc|()"]; - 498 [label="Exit block"]; - } - 499 [label="Exit when branch result"]; - 500 [label="Exit when"]; - } - 501 [label="Exit block"]; - } - 502 [label="Exit function test_12" style="filled" fillcolor=red]; - } + 468 -> {469}; 469 -> {470}; 470 -> {471}; 471 -> {472}; 472 -> {473}; - 473 -> {474 476}; + 473 -> {474}; 474 -> {475}; 475 -> {476}; - 476 -> {477 479}; + 476 -> {477}; 477 -> {478}; 478 -> {479}; - 479 -> {480 482}; + 479 -> {480}; 480 -> {481}; 481 -> {482}; - 482 -> {483}; - 483 -> {484}; + 482 -> {484 483}; + 483 -> {497}; 484 -> {485}; - 485 -> {487 486}; - 486 -> {500}; + 485 -> {486}; + 486 -> {487}; 487 -> {488}; 488 -> {489}; 489 -> {490}; @@ -1330,21 +1315,21 @@ digraph nullability_kt { 500 -> {501}; 501 -> {502}; - subgraph cluster_102 { + subgraph cluster_97 { color=red - 503 [label="Enter function test_13" style="filled" fillcolor=red]; - subgraph cluster_103 { + 503 [label="Enter function test_12" style="filled" fillcolor=red]; + subgraph cluster_98 { color=blue 504 [label="Enter block"]; - subgraph cluster_104 { + subgraph cluster_99 { color=blue 505 [label="Enter when"]; - subgraph cluster_105 { + subgraph cluster_100 { color=blue 506 [label="Enter when branch condition "]; 507 [label="Access variable R|/q|"]; 508 [label="Enter safe call"]; - 509 [label="Access variable R|/QImplMutable.data|"]; + 509 [label="Access variable R|/QImplWithCustomGetter.data|"]; 510 [label="Exit safe call"]; 511 [label="Enter safe call"]; 512 [label="Access variable R|/MyData.s|"]; @@ -1358,26 +1343,32 @@ digraph nullability_kt { } 520 [label="Synthetic else branch"]; 521 [label="Enter when branch result"]; - subgraph cluster_106 { + subgraph cluster_101 { color=blue 522 [label="Enter block"]; 523 [label="Access variable R|/q|"]; - 524 [label="Access variable R|/QImplMutable.data|"]; - 525 [label="Access variable R|/q|"]; - 526 [label="Access variable R|/QImplMutable.data|"]; - 527 [label="Access variable #"]; - 528 [label="Access variable R|/q|"]; - 529 [label="Access variable R|/QImplMutable.data|"]; - 530 [label="Access variable #"]; - 531 [label="Function call: R|/q|.R|/QImplMutable.data|.#.R|kotlin/Int.inc|()"]; - 532 [label="Exit block"]; + 524 [label="Smart cast: R|/q|"]; + 525 [label="Access variable R|/QImplWithCustomGetter.data|"]; + 526 [label="Smart cast: R|/q|.R|/QImplWithCustomGetter.data|"]; + 527 [label="Access variable R|/q|"]; + 528 [label="Smart cast: R|/q|"]; + 529 [label="Access variable R|/QImplWithCustomGetter.data|"]; + 530 [label="Smart cast: R|/q|.R|/QImplWithCustomGetter.data|"]; + 531 [label="Access variable #"]; + 532 [label="Access variable R|/q|"]; + 533 [label="Smart cast: R|/q|"]; + 534 [label="Access variable R|/QImplWithCustomGetter.data|"]; + 535 [label="Smart cast: R|/q|.R|/QImplWithCustomGetter.data|"]; + 536 [label="Access variable #"]; + 537 [label="Function call: R|/q|.R|/QImplWithCustomGetter.data|.#.R|kotlin/Int.inc|()"]; + 538 [label="Exit block"]; } - 533 [label="Exit when branch result"]; - 534 [label="Exit when"]; + 539 [label="Exit when branch result"]; + 540 [label="Exit when"]; } - 535 [label="Exit block"]; + 541 [label="Exit block"]; } - 536 [label="Exit function test_13" style="filled" fillcolor=red]; + 542 [label="Exit function test_12" style="filled" fillcolor=red]; } 503 -> {504}; 504 -> {505}; @@ -1396,7 +1387,7 @@ digraph nullability_kt { 517 -> {518}; 518 -> {519}; 519 -> {521 520}; - 520 -> {534}; + 520 -> {540}; 521 -> {522}; 522 -> {523}; 523 -> {524}; @@ -1412,60 +1403,163 @@ digraph nullability_kt { 533 -> {534}; 534 -> {535}; 535 -> {536}; - - subgraph cluster_107 { - color=red - 537 [label="Enter function test_14" style="filled" fillcolor=red]; - subgraph cluster_108 { - color=blue - 538 [label="Enter block"]; - subgraph cluster_109 { - color=blue - 539 [label="Enter when"]; - subgraph cluster_110 { - color=blue - 540 [label="Enter when branch condition "]; - 541 [label="Access variable R|/q|"]; - 542 [label="Access variable R|/Q.data|"]; - 543 [label="Const: Null(null)"]; - 544 [label="Equality operator =="]; - 545 [label="Exit when branch condition"]; - } - 546 [label="Synthetic else branch"]; - 547 [label="Enter when branch result"]; - subgraph cluster_111 { - color=blue - 548 [label="Enter block"]; - 549 [label="Access variable R|/q|"]; - 550 [label="Access variable R|/Q.data|"]; - 551 [label="Access variable #"]; - 552 [label="Exit block"]; - } - 553 [label="Exit when branch result"]; - 554 [label="Exit when"]; - } - 555 [label="Exit block"]; - } - 556 [label="Exit function test_14" style="filled" fillcolor=red]; - } + 536 -> {537}; 537 -> {538}; 538 -> {539}; 539 -> {540}; 540 -> {541}; 541 -> {542}; - 542 -> {543}; + + subgraph cluster_102 { + color=red + 543 [label="Enter function test_13" style="filled" fillcolor=red]; + subgraph cluster_103 { + color=blue + 544 [label="Enter block"]; + subgraph cluster_104 { + color=blue + 545 [label="Enter when"]; + subgraph cluster_105 { + color=blue + 546 [label="Enter when branch condition "]; + 547 [label="Access variable R|/q|"]; + 548 [label="Enter safe call"]; + 549 [label="Access variable R|/QImplMutable.data|"]; + 550 [label="Exit safe call"]; + 551 [label="Enter safe call"]; + 552 [label="Access variable R|/MyData.s|"]; + 553 [label="Exit safe call"]; + 554 [label="Enter safe call"]; + 555 [label="Function call: $subj$.R|kotlin/Int.inc|()"]; + 556 [label="Exit safe call"]; + 557 [label="Const: Null(null)"]; + 558 [label="Equality operator !="]; + 559 [label="Exit when branch condition"]; + } + 560 [label="Synthetic else branch"]; + 561 [label="Enter when branch result"]; + subgraph cluster_106 { + color=blue + 562 [label="Enter block"]; + 563 [label="Access variable R|/q|"]; + 564 [label="Smart cast: R|/q|"]; + 565 [label="Access variable R|/QImplMutable.data|"]; + 566 [label="Smart cast: R|/q|.R|/QImplMutable.data|"]; + 567 [label="Access variable R|/q|"]; + 568 [label="Smart cast: R|/q|"]; + 569 [label="Access variable R|/QImplMutable.data|"]; + 570 [label="Smart cast: R|/q|.R|/QImplMutable.data|"]; + 571 [label="Access variable #"]; + 572 [label="Access variable R|/q|"]; + 573 [label="Smart cast: R|/q|"]; + 574 [label="Access variable R|/QImplMutable.data|"]; + 575 [label="Smart cast: R|/q|.R|/QImplMutable.data|"]; + 576 [label="Access variable #"]; + 577 [label="Function call: R|/q|.R|/QImplMutable.data|.#.R|kotlin/Int.inc|()"]; + 578 [label="Exit block"]; + } + 579 [label="Exit when branch result"]; + 580 [label="Exit when"]; + } + 581 [label="Exit block"]; + } + 582 [label="Exit function test_13" style="filled" fillcolor=red]; + } 543 -> {544}; 544 -> {545}; - 545 -> {547 546}; - 546 -> {554}; - 547 -> {548}; + 545 -> {546}; + 546 -> {547}; + 547 -> {548 550}; 548 -> {549}; 549 -> {550}; - 550 -> {551}; + 550 -> {551 553}; 551 -> {552}; 552 -> {553}; - 553 -> {554}; + 553 -> {554 556}; 554 -> {555}; 555 -> {556}; + 556 -> {557}; + 557 -> {558}; + 558 -> {559}; + 559 -> {561 560}; + 560 -> {580}; + 561 -> {562}; + 562 -> {563}; + 563 -> {564}; + 564 -> {565}; + 565 -> {566}; + 566 -> {567}; + 567 -> {568}; + 568 -> {569}; + 569 -> {570}; + 570 -> {571}; + 571 -> {572}; + 572 -> {573}; + 573 -> {574}; + 574 -> {575}; + 575 -> {576}; + 576 -> {577}; + 577 -> {578}; + 578 -> {579}; + 579 -> {580}; + 580 -> {581}; + 581 -> {582}; + + subgraph cluster_107 { + color=red + 583 [label="Enter function test_14" style="filled" fillcolor=red]; + subgraph cluster_108 { + color=blue + 584 [label="Enter block"]; + subgraph cluster_109 { + color=blue + 585 [label="Enter when"]; + subgraph cluster_110 { + color=blue + 586 [label="Enter when branch condition "]; + 587 [label="Access variable R|/q|"]; + 588 [label="Access variable R|/Q.data|"]; + 589 [label="Const: Null(null)"]; + 590 [label="Equality operator =="]; + 591 [label="Exit when branch condition"]; + } + 592 [label="Synthetic else branch"]; + 593 [label="Enter when branch result"]; + subgraph cluster_111 { + color=blue + 594 [label="Enter block"]; + 595 [label="Access variable R|/q|"]; + 596 [label="Access variable R|/Q.data|"]; + 597 [label="Smart cast: R|/q|.R|/Q.data|"]; + 598 [label="Access variable #"]; + 599 [label="Exit block"]; + } + 600 [label="Exit when branch result"]; + 601 [label="Exit when"]; + } + 602 [label="Exit block"]; + } + 603 [label="Exit function test_14" style="filled" fillcolor=red]; + } + 583 -> {584}; + 584 -> {585}; + 585 -> {586}; + 586 -> {587}; + 587 -> {588}; + 588 -> {589}; + 589 -> {590}; + 590 -> {591}; + 591 -> {593 592}; + 592 -> {601}; + 593 -> {594}; + 594 -> {595}; + 595 -> {596}; + 596 -> {597}; + 597 -> {598}; + 598 -> {599}; + 599 -> {600}; + 600 -> {601}; + 601 -> {602}; + 602 -> {603}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceiverAsWhenSubject.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceiverAsWhenSubject.dot index 21cf6a48860..f2de3b92d01 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceiverAsWhenSubject.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceiverAsWhenSubject.dot @@ -53,13 +53,14 @@ digraph implicitReceiverAsWhenSubject_kt { color=blue 25 [label="Enter block"]; 26 [label="Access variable this@R|/test_1|"]; - 27 [label="Access variable R|SubstitutionOverride|"]; - 28 [label="Exit block"]; + 27 [label="Smart cast: this@R|/test_1|"]; + 28 [label="Access variable R|SubstitutionOverride|"]; + 29 [label="Exit block"]; } - 29 [label="Exit when branch result"]; - 30 [label="Exit when"]; + 30 [label="Exit when branch result"]; + 31 [label="Exit when"]; } - 31 [label="Jump: ^test_1 when (this@R|/test_1|) { + 32 [label="Jump: ^test_1 when (this@R|/test_1|) { ($subj$ is R|kotlin/collections/List<*>|) -> { this@R|/test_1|.R|SubstitutionOverride| } @@ -71,10 +72,10 @@ digraph implicitReceiverAsWhenSubject_kt { } } "]; - 32 [label="Stub" style="filled" fillcolor=gray]; - 33 [label="Exit block" style="filled" fillcolor=gray]; + 33 [label="Stub" style="filled" fillcolor=gray]; + 34 [label="Exit block" style="filled" fillcolor=gray]; } - 34 [label="Exit function test_1" style="filled" fillcolor=red]; + 35 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -94,12 +95,12 @@ digraph implicitReceiverAsWhenSubject_kt { 15 -> {16}; 16 -> {17}; 17 -> {18}; - 18 -> {30}; + 18 -> {31}; 19 -> {20}; 20 -> {21}; 21 -> {22}; 22 -> {23}; - 23 -> {30}; + 23 -> {31}; 24 -> {25}; 25 -> {26}; 26 -> {27}; @@ -107,73 +108,77 @@ digraph implicitReceiverAsWhenSubject_kt { 28 -> {29}; 29 -> {30}; 30 -> {31}; - 31 -> {34}; - 31 -> {32} [style=dotted]; + 31 -> {32}; + 32 -> {35}; 32 -> {33} [style=dotted]; 33 -> {34} [style=dotted]; + 34 -> {35} [style=dotted]; subgraph cluster_9 { color=red - 35 [label="Enter function test_2" style="filled" fillcolor=red]; + 36 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 36 [label="Enter block"]; + 37 [label="Enter block"]; subgraph cluster_11 { color=blue - 37 [label="Enter when"]; - 38 [label="Access variable this@R|/test_2|"]; - 39 [label="Variable declaration: lval x: R|kotlin/Any|"]; + 38 [label="Enter when"]; + 39 [label="Access variable this@R|/test_2|"]; + 40 [label="Variable declaration: lval x: R|kotlin/Any|"]; subgraph cluster_12 { color=blue - 40 [label="Enter when branch condition "]; - 41 [label="Exit $subj"]; - 42 [label="Type operator: ($subj$ is R|kotlin/collections/List<*>|)"]; - 43 [label="Exit when branch condition"]; + 41 [label="Enter when branch condition "]; + 42 [label="Exit $subj"]; + 43 [label="Type operator: ($subj$ is R|kotlin/collections/List<*>|)"]; + 44 [label="Exit when branch condition"]; } subgraph cluster_13 { color=blue - 44 [label="Enter when branch condition "]; - 45 [label="Exit $subj"]; - 46 [label="Type operator: ($subj$ is R|kotlin/String|)"]; - 47 [label="Exit when branch condition"]; + 45 [label="Enter when branch condition "]; + 46 [label="Exit $subj"]; + 47 [label="Type operator: ($subj$ is R|kotlin/String|)"]; + 48 [label="Exit when branch condition"]; } subgraph cluster_14 { color=blue - 48 [label="Enter when branch condition else"]; - 49 [label="Exit when branch condition"]; + 49 [label="Enter when branch condition else"]; + 50 [label="Exit when branch condition"]; } - 50 [label="Enter when branch result"]; + 51 [label="Enter when branch result"]; subgraph cluster_15 { color=blue - 51 [label="Enter block"]; - 52 [label="Const: Int(0)"]; - 53 [label="Exit block"]; + 52 [label="Enter block"]; + 53 [label="Const: Int(0)"]; + 54 [label="Exit block"]; } - 54 [label="Exit when branch result"]; - 55 [label="Enter when branch result"]; + 55 [label="Exit when branch result"]; + 56 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 56 [label="Enter block"]; - 57 [label="Access variable R|/x|"]; - 58 [label="Access variable R|kotlin/String.length|"]; - 59 [label="Access variable R|kotlin/String.length|"]; - 60 [label="Exit block"]; + 57 [label="Enter block"]; + 58 [label="Access variable R|/x|"]; + 59 [label="Smart cast: R|/x|"]; + 60 [label="Access variable R|kotlin/String.length|"]; + 61 [label="Access variable R|kotlin/String.length|"]; + 62 [label="Exit block"]; } - 61 [label="Exit when branch result"]; - 62 [label="Enter when branch result"]; + 63 [label="Exit when branch result"]; + 64 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 63 [label="Enter block"]; - 64 [label="Access variable R|/x|"]; - 65 [label="Access variable R|SubstitutionOverride|"]; - 66 [label="Access variable this@R|/test_2|"]; - 67 [label="Access variable R|SubstitutionOverride|"]; - 68 [label="Exit block"]; + 65 [label="Enter block"]; + 66 [label="Access variable R|/x|"]; + 67 [label="Smart cast: R|/x|"]; + 68 [label="Access variable R|SubstitutionOverride|"]; + 69 [label="Access variable this@R|/test_2|"]; + 70 [label="Smart cast: this@R|/test_2|"]; + 71 [label="Access variable R|SubstitutionOverride|"]; + 72 [label="Exit block"]; } - 69 [label="Exit when branch result"]; - 70 [label="Exit when"]; + 73 [label="Exit when branch result"]; + 74 [label="Exit when"]; } - 71 [label="Jump: ^test_2 when (lval x: R|kotlin/Any| = this@R|/test_2|) { + 75 [label="Jump: ^test_2 when (lval x: R|kotlin/Any| = this@R|/test_2|) { ($subj$ is R|kotlin/collections/List<*>|) -> { R|/x|.R|SubstitutionOverride| this@R|/test_2|.R|SubstitutionOverride| @@ -187,12 +192,11 @@ digraph implicitReceiverAsWhenSubject_kt { } } "]; - 72 [label="Stub" style="filled" fillcolor=gray]; - 73 [label="Exit block" style="filled" fillcolor=gray]; + 76 [label="Stub" style="filled" fillcolor=gray]; + 77 [label="Exit block" style="filled" fillcolor=gray]; } - 74 [label="Exit function test_2" style="filled" fillcolor=red]; + 78 [label="Exit function test_2" style="filled" fillcolor=red]; } - 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; @@ -200,27 +204,27 @@ digraph implicitReceiverAsWhenSubject_kt { 40 -> {41}; 41 -> {42}; 42 -> {43}; - 43 -> {62 44}; - 44 -> {45}; + 43 -> {44}; + 44 -> {64 45}; 45 -> {46}; 46 -> {47}; - 47 -> {55 48}; - 48 -> {49}; + 47 -> {48}; + 48 -> {56 49}; 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; - 54 -> {70}; - 55 -> {56}; + 54 -> {55}; + 55 -> {74}; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {70}; + 61 -> {62}; 62 -> {63}; - 63 -> {64}; + 63 -> {74}; 64 -> {65}; 65 -> {66}; 66 -> {67}; @@ -228,9 +232,13 @@ digraph implicitReceiverAsWhenSubject_kt { 68 -> {69}; 69 -> {70}; 70 -> {71}; - 71 -> {74}; - 71 -> {72} [style=dotted]; - 72 -> {73} [style=dotted]; - 73 -> {74} [style=dotted]; + 71 -> {72}; + 72 -> {73}; + 73 -> {74}; + 74 -> {75}; + 75 -> {78}; + 75 -> {76} [style=dotted]; + 76 -> {77} [style=dotted]; + 77 -> {78} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.dot index 65c794af4c3..1296cd9b1bf 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.dot @@ -113,19 +113,20 @@ digraph implicitReceivers_kt { color=blue 39 [label="Enter block"]; 40 [label="Access variable this@R|/test_1|"]; - 41 [label="Function call: this@R|/test_1|.R|/A.foo|()"]; + 41 [label="Smart cast: this@R|/test_1|"]; 42 [label="Function call: this@R|/test_1|.R|/A.foo|()"]; - 43 [label="Exit block"]; + 43 [label="Function call: this@R|/test_1|.R|/A.foo|()"]; + 44 [label="Exit block"]; } - 44 [label="Exit when branch result"]; - 45 [label="Exit when"]; + 45 [label="Exit when branch result"]; + 46 [label="Exit when"]; } - 46 [label="Access variable this@R|/test_1|"]; - 47 [label="Function call: this@R|/test_1|.#()"]; - 48 [label="Function call: #()"]; - 49 [label="Exit block"]; + 47 [label="Access variable this@R|/test_1|"]; + 48 [label="Function call: this@R|/test_1|.#()"]; + 49 [label="Function call: #()"]; + 50 [label="Exit block"]; } - 50 [label="Exit function test_1" style="filled" fillcolor=red]; + 51 [label="Exit function test_1" style="filled" fillcolor=red]; } 22 -> {23}; 23 -> {24}; @@ -142,7 +143,7 @@ digraph implicitReceivers_kt { 34 -> {35}; 35 -> {36}; 36 -> {37}; - 37 -> {45}; + 37 -> {46}; 38 -> {39}; 39 -> {40}; 40 -> {41}; @@ -155,65 +156,66 @@ digraph implicitReceivers_kt { 47 -> {48}; 48 -> {49}; 49 -> {50}; + 50 -> {51}; subgraph cluster_17 { color=red - 51 [label="Enter function test_2" style="filled" fillcolor=red]; + 52 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_18 { color=blue - 52 [label="Enter block"]; + 53 [label="Enter block"]; subgraph cluster_19 { color=blue - 53 [label="Enter when"]; + 54 [label="Enter when"]; subgraph cluster_20 { color=blue - 54 [label="Enter when branch condition "]; - 55 [label="Access variable this@R|/test_2|"]; - 56 [label="Type operator: (this@R|/test_2| !is R|A|)"]; - 57 [label="Exit when branch condition"]; + 55 [label="Enter when branch condition "]; + 56 [label="Access variable this@R|/test_2|"]; + 57 [label="Type operator: (this@R|/test_2| !is R|A|)"]; + 58 [label="Exit when branch condition"]; } subgraph cluster_21 { color=blue - 58 [label="Enter when branch condition else"]; - 59 [label="Exit when branch condition"]; + 59 [label="Enter when branch condition else"]; + 60 [label="Exit when branch condition"]; } - 60 [label="Enter when branch result"]; + 61 [label="Enter when branch result"]; subgraph cluster_22 { color=blue - 61 [label="Enter block"]; - 62 [label="Access variable this@R|/test_2|"]; - 63 [label="Function call: this@R|/test_2|.R|/A.foo|()"]; - 64 [label="Function call: this@R|/test_2|.R|/A.foo|()"]; - 65 [label="Exit block"]; + 62 [label="Enter block"]; + 63 [label="Access variable this@R|/test_2|"]; + 64 [label="Smart cast: this@R|/test_2|"]; + 65 [label="Function call: this@R|/test_2|.R|/A.foo|()"]; + 66 [label="Function call: this@R|/test_2|.R|/A.foo|()"]; + 67 [label="Exit block"]; } - 66 [label="Exit when branch result"]; - 67 [label="Enter when branch result"]; + 68 [label="Exit when branch result"]; + 69 [label="Enter when branch result"]; subgraph cluster_23 { color=blue - 68 [label="Enter block"]; - 69 [label="Access variable this@R|/test_2|"]; - 70 [label="Function call: this@R|/test_2|.#()"]; - 71 [label="Function call: #()"]; - 72 [label="Exit block"]; + 70 [label="Enter block"]; + 71 [label="Access variable this@R|/test_2|"]; + 72 [label="Function call: this@R|/test_2|.#()"]; + 73 [label="Function call: #()"]; + 74 [label="Exit block"]; } - 73 [label="Exit when branch result"]; - 74 [label="Exit when"]; + 75 [label="Exit when branch result"]; + 76 [label="Exit when"]; } - 75 [label="Access variable this@R|/test_2|"]; - 76 [label="Function call: this@R|/test_2|.#()"]; - 77 [label="Function call: #()"]; - 78 [label="Exit block"]; + 77 [label="Access variable this@R|/test_2|"]; + 78 [label="Function call: this@R|/test_2|.#()"]; + 79 [label="Function call: #()"]; + 80 [label="Exit block"]; } - 79 [label="Exit function test_2" style="filled" fillcolor=red]; + 81 [label="Exit function test_2" style="filled" fillcolor=red]; } - 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; - 57 -> {67 58}; - 58 -> {59}; + 57 -> {58}; + 58 -> {69 59}; 59 -> {60}; 60 -> {61}; 61 -> {62}; @@ -221,9 +223,9 @@ digraph implicitReceivers_kt { 63 -> {64}; 64 -> {65}; 65 -> {66}; - 66 -> {74}; + 66 -> {67}; 67 -> {68}; - 68 -> {69}; + 68 -> {76}; 69 -> {70}; 70 -> {71}; 71 -> {72}; @@ -234,227 +236,234 @@ digraph implicitReceivers_kt { 76 -> {77}; 77 -> {78}; 78 -> {79}; + 79 -> {80}; + 80 -> {81}; subgraph cluster_24 { color=red - 80 [label="Enter function test_3" style="filled" fillcolor=red]; + 82 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_25 { color=blue - 81 [label="Enter block"]; - 82 [label="Access variable R|/a|"]; - 83 [label="Postponed enter to lambda"]; + 83 [label="Enter block"]; + 84 [label="Access variable R|/a|"]; + 85 [label="Postponed enter to lambda"]; subgraph cluster_26 { color=blue - 89 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 91 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_27 { color=blue - 90 [label="Enter block"]; - 91 [label="Access variable R|/b|"]; - 92 [label="Postponed enter to lambda"]; + 92 [label="Enter block"]; + 93 [label="Access variable R|/b|"]; + 94 [label="Postponed enter to lambda"]; subgraph cluster_28 { color=blue - 97 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 99 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_29 { color=blue - 98 [label="Enter block"]; - 99 [label="Access variable R|/c|"]; - 100 [label="Postponed enter to lambda"]; + 100 [label="Enter block"]; + 101 [label="Access variable R|/c|"]; + 102 [label="Postponed enter to lambda"]; subgraph cluster_30 { color=blue - 109 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 112 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_31 { color=blue - 110 [label="Enter block"]; - 111 [label="Access variable this@R|special/anonymous|"]; - 112 [label="Type operator: (this@R|special/anonymous| as R|A|)"]; - 113 [label="Access variable this@R|special/anonymous|"]; - 114 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; - 115 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; - 116 [label="Exit block"]; + 113 [label="Enter block"]; + 114 [label="Access variable this@R|special/anonymous|"]; + 115 [label="Type operator: (this@R|special/anonymous| as R|A|)"]; + 116 [label="Access variable this@R|special/anonymous|"]; + 117 [label="Smart cast: this@R|special/anonymous|"]; + 118 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; + 119 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; + 120 [label="Exit block"]; } - 117 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 121 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 101 [label="Call arguments union" style="filled" fillcolor=yellow]; - 102 [label="Postponed exit from lambda"]; - 103 [label="Function call: R|kotlin/with|(...)"]; - 104 [label="Access variable this@R|special/anonymous|"]; - 105 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; - 106 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; - 107 [label="Exit block"]; + 103 [label="Call arguments union" style="filled" fillcolor=yellow]; + 104 [label="Postponed exit from lambda"]; + 105 [label="Function call: R|kotlin/with|(...)"]; + 106 [label="Access variable this@R|special/anonymous|"]; + 107 [label="Smart cast: this@R|special/anonymous|"]; + 108 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; + 109 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; + 110 [label="Exit block"]; } - 108 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 111 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 93 [label="Postponed exit from lambda"]; - 94 [label="Function call: R|kotlin/with|(...)"]; - 95 [label="Exit block"]; + 95 [label="Postponed exit from lambda"]; + 96 [label="Function call: R|kotlin/with|(...)"]; + 97 [label="Exit block"]; } - 96 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 98 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 84 [label="Call arguments union" style="filled" fillcolor=yellow]; - 85 [label="Postponed exit from lambda"]; - 86 [label="Function call: R|kotlin/with|(...)"]; - 87 [label="Exit block"]; + 86 [label="Call arguments union" style="filled" fillcolor=yellow]; + 87 [label="Postponed exit from lambda"]; + 88 [label="Function call: R|kotlin/with|(...)"]; + 89 [label="Exit block"]; } - 88 [label="Exit function test_3" style="filled" fillcolor=red]; + 90 [label="Exit function test_3" style="filled" fillcolor=red]; } - 80 -> {81}; - 81 -> {82}; 82 -> {83}; - 83 -> {89}; - 83 -> {85} [color=red]; - 83 -> {89} [style=dashed]; - 84 -> {86} [color=red]; - 85 -> {86} [color=green]; - 86 -> {87}; - 87 -> {88}; + 83 -> {84}; + 84 -> {85}; + 85 -> {91}; + 85 -> {87} [color=red]; + 85 -> {91} [style=dashed]; + 86 -> {88} [color=red]; + 87 -> {88} [color=green]; + 88 -> {89}; 89 -> {90}; - 90 -> {91}; 91 -> {92}; - 92 -> {97}; - 92 -> {93} [color=red]; - 92 -> {97} [style=dashed]; + 92 -> {93}; 93 -> {94}; - 94 -> {95}; + 94 -> {99}; + 94 -> {95} [color=red]; + 94 -> {99} [style=dashed]; 95 -> {96}; - 96 -> {84} [color=red]; - 96 -> {85} [color=green]; + 96 -> {97}; 97 -> {98}; - 98 -> {99}; + 98 -> {86} [color=red]; + 98 -> {87} [color=green]; 99 -> {100}; - 100 -> {109}; - 100 -> {102} [color=red]; - 100 -> {109} [style=dashed]; - 101 -> {103} [color=red]; - 102 -> {103} [color=green]; - 103 -> {104}; - 104 -> {105}; + 100 -> {101}; + 101 -> {102}; + 102 -> {112}; + 102 -> {104} [color=red]; + 102 -> {112} [style=dashed]; + 103 -> {105} [color=red]; + 104 -> {105} [color=green]; 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {93} [color=green]; + 108 -> {109}; 109 -> {110}; 110 -> {111}; - 111 -> {112}; + 111 -> {95} [color=green]; 112 -> {113}; 113 -> {114}; 114 -> {115}; 115 -> {116}; 116 -> {117}; - 117 -> {101} [color=red]; - 117 -> {102} [color=green]; - - subgraph cluster_32 { - color=red - 118 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_33 { - color=blue - 119 [label="Enter block"]; - subgraph cluster_34 { - color=blue - 120 [label="Enter when"]; - subgraph cluster_35 { - color=blue - 121 [label="Enter when branch condition "]; - 122 [label="Access variable this@R|/test_4|"]; - 123 [label="Type operator: (this@R|/test_4| !is R|A|)"]; - 124 [label="Exit when branch condition"]; - } - subgraph cluster_36 { - color=blue - 125 [label="Enter when branch condition "]; - 126 [label="Access variable this@R|/test_4|"]; - 127 [label="Type operator: (this@R|/test_4| !is R|B|)"]; - 128 [label="Exit when branch condition"]; - } - subgraph cluster_37 { - color=blue - 129 [label="Enter when branch condition else"]; - 130 [label="Exit when branch condition"]; - } - 131 [label="Enter when branch result"]; - subgraph cluster_38 { - color=blue - 132 [label="Enter block"]; - 133 [label="Access variable this@R|/test_4|"]; - 134 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; - 135 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; - 136 [label="Access variable this@R|/test_4|"]; - 137 [label="Function call: this@R|/test_4|.R|/B.bar|()"]; - 138 [label="Function call: this@R|/test_4|.R|/B.bar|()"]; - 139 [label="Exit block"]; - } - 140 [label="Exit when branch result"]; - 141 [label="Enter when branch result"]; - subgraph cluster_39 { - color=blue - 142 [label="Enter block"]; - 143 [label="Access variable this@R|/test_4|"]; - 144 [label="Function call: this@R|/test_4|.#()"]; - 145 [label="Function call: #()"]; - 146 [label="Access variable this@R|/test_4|"]; - 147 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; - 148 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; - 149 [label="Exit block"]; - } - 150 [label="Exit when branch result"]; - 151 [label="Enter when branch result"]; - subgraph cluster_40 { - color=blue - 152 [label="Enter block"]; - 153 [label="Access variable this@R|/test_4|"]; - 154 [label="Function call: this@R|/test_4|.#()"]; - 155 [label="Function call: #()"]; - 156 [label="Access variable this@R|/test_4|"]; - 157 [label="Function call: this@R|/test_4|.#()"]; - 158 [label="Function call: #()"]; - 159 [label="Exit block"]; - } - 160 [label="Exit when branch result"]; - 161 [label="Exit when"]; - } - 162 [label="Access variable this@R|/test_4|"]; - 163 [label="Function call: this@R|/test_4|.#()"]; - 164 [label="Function call: #()"]; - 165 [label="Access variable this@R|/test_4|"]; - 166 [label="Function call: this@R|/test_4|.#()"]; - 167 [label="Function call: #()"]; - 168 [label="Exit block"]; - } - 169 [label="Exit function test_4" style="filled" fillcolor=red]; - } + 117 -> {118}; 118 -> {119}; 119 -> {120}; 120 -> {121}; - 121 -> {122}; + 121 -> {103} [color=red]; + 121 -> {104} [color=green]; + + subgraph cluster_32 { + color=red + 122 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_33 { + color=blue + 123 [label="Enter block"]; + subgraph cluster_34 { + color=blue + 124 [label="Enter when"]; + subgraph cluster_35 { + color=blue + 125 [label="Enter when branch condition "]; + 126 [label="Access variable this@R|/test_4|"]; + 127 [label="Type operator: (this@R|/test_4| !is R|A|)"]; + 128 [label="Exit when branch condition"]; + } + subgraph cluster_36 { + color=blue + 129 [label="Enter when branch condition "]; + 130 [label="Access variable this@R|/test_4|"]; + 131 [label="Smart cast: this@R|/test_4|"]; + 132 [label="Type operator: (this@R|/test_4| !is R|B|)"]; + 133 [label="Exit when branch condition"]; + } + subgraph cluster_37 { + color=blue + 134 [label="Enter when branch condition else"]; + 135 [label="Exit when branch condition"]; + } + 136 [label="Enter when branch result"]; + subgraph cluster_38 { + color=blue + 137 [label="Enter block"]; + 138 [label="Access variable this@R|/test_4|"]; + 139 [label="Smart cast: this@R|/test_4|"]; + 140 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; + 141 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; + 142 [label="Access variable this@R|/test_4|"]; + 143 [label="Smart cast: this@R|/test_4|"]; + 144 [label="Function call: this@R|/test_4|.R|/B.bar|()"]; + 145 [label="Function call: this@R|/test_4|.R|/B.bar|()"]; + 146 [label="Exit block"]; + } + 147 [label="Exit when branch result"]; + 148 [label="Enter when branch result"]; + subgraph cluster_39 { + color=blue + 149 [label="Enter block"]; + 150 [label="Access variable this@R|/test_4|"]; + 151 [label="Smart cast: this@R|/test_4|"]; + 152 [label="Function call: this@R|/test_4|.#()"]; + 153 [label="Function call: #()"]; + 154 [label="Access variable this@R|/test_4|"]; + 155 [label="Smart cast: this@R|/test_4|"]; + 156 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; + 157 [label="Function call: this@R|/test_4|.R|/A.foo|()"]; + 158 [label="Exit block"]; + } + 159 [label="Exit when branch result"]; + 160 [label="Enter when branch result"]; + subgraph cluster_40 { + color=blue + 161 [label="Enter block"]; + 162 [label="Access variable this@R|/test_4|"]; + 163 [label="Function call: this@R|/test_4|.#()"]; + 164 [label="Function call: #()"]; + 165 [label="Access variable this@R|/test_4|"]; + 166 [label="Function call: this@R|/test_4|.#()"]; + 167 [label="Function call: #()"]; + 168 [label="Exit block"]; + } + 169 [label="Exit when branch result"]; + 170 [label="Exit when"]; + } + 171 [label="Access variable this@R|/test_4|"]; + 172 [label="Function call: this@R|/test_4|.#()"]; + 173 [label="Function call: #()"]; + 174 [label="Access variable this@R|/test_4|"]; + 175 [label="Function call: this@R|/test_4|.#()"]; + 176 [label="Function call: #()"]; + 177 [label="Exit block"]; + } + 178 [label="Exit function test_4" style="filled" fillcolor=red]; + } 122 -> {123}; 123 -> {124}; - 124 -> {151 125}; + 124 -> {125}; 125 -> {126}; 126 -> {127}; 127 -> {128}; - 128 -> {141 129}; + 128 -> {160 129}; 129 -> {130}; 130 -> {131}; 131 -> {132}; 132 -> {133}; - 133 -> {134}; + 133 -> {148 134}; 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; 138 -> {139}; 139 -> {140}; - 140 -> {161}; + 140 -> {141}; 141 -> {142}; 142 -> {143}; 143 -> {144}; 144 -> {145}; 145 -> {146}; 146 -> {147}; - 147 -> {148}; + 147 -> {170}; 148 -> {149}; 149 -> {150}; - 150 -> {161}; + 150 -> {151}; 151 -> {152}; 152 -> {153}; 153 -> {154}; @@ -463,7 +472,7 @@ digraph implicitReceivers_kt { 156 -> {157}; 157 -> {158}; 158 -> {159}; - 159 -> {160}; + 159 -> {170}; 160 -> {161}; 161 -> {162}; 162 -> {163}; @@ -473,62 +482,71 @@ digraph implicitReceivers_kt { 166 -> {167}; 167 -> {168}; 168 -> {169}; + 169 -> {170}; + 170 -> {171}; + 171 -> {172}; + 172 -> {173}; + 173 -> {174}; + 174 -> {175}; + 175 -> {176}; + 176 -> {177}; + 177 -> {178}; subgraph cluster_41 { color=red - 170 [label="Enter function test_5" style="filled" fillcolor=red]; + 179 [label="Enter function test_5" style="filled" fillcolor=red]; subgraph cluster_42 { color=blue - 171 [label="Enter block"]; + 180 [label="Enter block"]; subgraph cluster_43 { color=blue - 172 [label="Enter when"]; + 181 [label="Enter when"]; subgraph cluster_44 { color=blue - 173 [label="Enter when branch condition "]; - 174 [label="Access variable this@R|/test_5|"]; - 175 [label="Type operator: (this@R|/test_5| is R|kotlin/collections/List<*>|)"]; - 176 [label="Exit when branch condition"]; + 182 [label="Enter when branch condition "]; + 183 [label="Access variable this@R|/test_5|"]; + 184 [label="Type operator: (this@R|/test_5| is R|kotlin/collections/List<*>|)"]; + 185 [label="Exit when branch condition"]; } subgraph cluster_45 { color=blue - 177 [label="Enter when branch condition "]; - 178 [label="Access variable this@R|/test_5|"]; - 179 [label="Type operator: (this@R|/test_5| is R|kotlin/String|)"]; - 180 [label="Exit when branch condition"]; + 186 [label="Enter when branch condition "]; + 187 [label="Access variable this@R|/test_5|"]; + 188 [label="Type operator: (this@R|/test_5| is R|kotlin/String|)"]; + 189 [label="Exit when branch condition"]; } subgraph cluster_46 { color=blue - 181 [label="Enter when branch condition else"]; - 182 [label="Exit when branch condition"]; + 190 [label="Enter when branch condition else"]; + 191 [label="Exit when branch condition"]; } - 183 [label="Enter when branch result"]; + 192 [label="Enter when branch result"]; subgraph cluster_47 { color=blue - 184 [label="Enter block"]; - 185 [label="Const: Int(0)"]; - 186 [label="Exit block"]; + 193 [label="Enter block"]; + 194 [label="Const: Int(0)"]; + 195 [label="Exit block"]; } - 187 [label="Exit when branch result"]; - 188 [label="Enter when branch result"]; + 196 [label="Exit when branch result"]; + 197 [label="Enter when branch result"]; subgraph cluster_48 { color=blue - 189 [label="Enter block"]; - 190 [label="Access variable R|kotlin/String.length|"]; - 191 [label="Exit block"]; + 198 [label="Enter block"]; + 199 [label="Access variable R|kotlin/String.length|"]; + 200 [label="Exit block"]; } - 192 [label="Exit when branch result"]; - 193 [label="Enter when branch result"]; + 201 [label="Exit when branch result"]; + 202 [label="Enter when branch result"]; subgraph cluster_49 { color=blue - 194 [label="Enter block"]; - 195 [label="Access variable R|SubstitutionOverride|"]; - 196 [label="Exit block"]; + 203 [label="Enter block"]; + 204 [label="Access variable R|SubstitutionOverride|"]; + 205 [label="Exit block"]; } - 197 [label="Exit when branch result"]; - 198 [label="Exit when"]; + 206 [label="Exit when branch result"]; + 207 [label="Exit when"]; } - 199 [label="Jump: ^test_5 when () { + 208 [label="Jump: ^test_5 when () { (this@R|/test_5| is R|kotlin/collections/List<*>|) -> { this@R|/test_5|.R|SubstitutionOverride| } @@ -540,69 +558,71 @@ digraph implicitReceivers_kt { } } "]; - 200 [label="Stub" style="filled" fillcolor=gray]; - 201 [label="Exit block" style="filled" fillcolor=gray]; + 209 [label="Stub" style="filled" fillcolor=gray]; + 210 [label="Exit block" style="filled" fillcolor=gray]; } - 202 [label="Exit function test_5" style="filled" fillcolor=red]; + 211 [label="Exit function test_5" style="filled" fillcolor=red]; } - 170 -> {171}; - 171 -> {172}; - 172 -> {173}; - 173 -> {174}; - 174 -> {175}; - 175 -> {176}; - 176 -> {193 177}; - 177 -> {178}; - 178 -> {179}; 179 -> {180}; - 180 -> {188 181}; + 180 -> {181}; 181 -> {182}; 182 -> {183}; 183 -> {184}; 184 -> {185}; - 185 -> {186}; + 185 -> {202 186}; 186 -> {187}; - 187 -> {198}; + 187 -> {188}; 188 -> {189}; - 189 -> {190}; + 189 -> {197 190}; 190 -> {191}; 191 -> {192}; - 192 -> {198}; + 192 -> {193}; 193 -> {194}; 194 -> {195}; 195 -> {196}; - 196 -> {197}; + 196 -> {207}; 197 -> {198}; 198 -> {199}; - 199 -> {202}; - 199 -> {200} [style=dotted]; - 200 -> {201} [style=dotted]; - 201 -> {202} [style=dotted]; - - subgraph cluster_50 { - color=red - 203 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_51 { - color=blue - 204 [label="Enter block"]; - 205 [label="Access variable this@R|/test_6|"]; - 206 [label="Type operator: (this@R|/test_6| as R|kotlin/collections/List<*>|)"]; - 207 [label="Access variable R|SubstitutionOverride|"]; - 208 [label="Access variable this@R|/test_6|"]; - 209 [label="Type operator: (this@R|/test_6| as R|kotlin/String|)"]; - 210 [label="Access variable R|kotlin/String.length|"]; - 211 [label="Exit block"]; - } - 212 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 199 -> {200}; + 200 -> {201}; + 201 -> {207}; + 202 -> {203}; 203 -> {204}; 204 -> {205}; 205 -> {206}; 206 -> {207}; 207 -> {208}; - 208 -> {209}; - 209 -> {210}; - 210 -> {211}; - 211 -> {212}; + 208 -> {211}; + 208 -> {209} [style=dotted]; + 209 -> {210} [style=dotted]; + 210 -> {211} [style=dotted]; + + subgraph cluster_50 { + color=red + 212 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_51 { + color=blue + 213 [label="Enter block"]; + 214 [label="Access variable this@R|/test_6|"]; + 215 [label="Type operator: (this@R|/test_6| as R|kotlin/collections/List<*>|)"]; + 216 [label="Access variable R|SubstitutionOverride|"]; + 217 [label="Access variable this@R|/test_6|"]; + 218 [label="Smart cast: this@R|/test_6|"]; + 219 [label="Type operator: (this@R|/test_6| as R|kotlin/String|)"]; + 220 [label="Access variable R|kotlin/String.length|"]; + 221 [label="Exit block"]; + } + 222 [label="Exit function test_6" style="filled" fillcolor=red]; + } + 212 -> {213}; + 213 -> {214}; + 214 -> {215}; + 215 -> {216}; + 216 -> {217}; + 217 -> {218}; + 218 -> {219}; + 219 -> {220}; + 220 -> {221}; + 221 -> {222}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.dot index b55a5d47c51..68c6fb399ee 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.dot @@ -67,28 +67,30 @@ digraph thisOfExtensionProperty_kt { 22 [label="Exit left part of &&"]; 23 [label="Enter right part of &&"]; 24 [label="Access variable this@R|/check_2|"]; - 25 [label="Access variable R|/B.b|"]; - 26 [label="Exit &&"]; + 25 [label="Smart cast: this@R|/check_2|"]; + 26 [label="Access variable R|/B.b|"]; + 27 [label="Exit &&"]; } - 27 [label="Jump: ^ (this@R|/check_2| is R|B|) && this@R|/check_2|.R|/B.b|"]; - 28 [label="Stub" style="filled" fillcolor=gray]; - 29 [label="Exit block" style="filled" fillcolor=gray]; + 28 [label="Jump: ^ (this@R|/check_2| is R|B|) && this@R|/check_2|.R|/B.b|"]; + 29 [label="Stub" style="filled" fillcolor=gray]; + 30 [label="Exit block" style="filled" fillcolor=gray]; } - 30 [label="Exit function getter" style="filled" fillcolor=red]; + 31 [label="Exit function getter" style="filled" fillcolor=red]; } 17 -> {18}; 18 -> {19}; 19 -> {20}; 20 -> {21}; 21 -> {22}; - 22 -> {26 23}; + 22 -> {27 23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; 26 -> {27}; - 27 -> {30}; - 27 -> {28} [style=dotted]; + 27 -> {28}; + 28 -> {31}; 28 -> {29} [style=dotted]; 29 -> {30} [style=dotted]; + 30 -> {31} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot index a9361910087..6e223209dad 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.dot @@ -96,15 +96,16 @@ digraph assignSafeCall_kt { color=blue 35 [label="Enter block"]; 36 [label="Access variable R|/a|"]; - 37 [label="Function call: R|/a|.R|/A.bar|()"]; - 38 [label="Exit block"]; + 37 [label="Smart cast: R|/a|"]; + 38 [label="Function call: R|/a|.R|/A.bar|()"]; + 39 [label="Exit block"]; } - 39 [label="Exit when branch result"]; - 40 [label="Exit when"]; + 40 [label="Exit when branch result"]; + 41 [label="Exit when"]; } - 41 [label="Exit block"]; + 42 [label="Exit block"]; } - 42 [label="Exit function test_1" style="filled" fillcolor=red]; + 43 [label="Exit function test_1" style="filled" fillcolor=red]; } 20 -> {21}; 21 -> {22}; @@ -119,7 +120,7 @@ digraph assignSafeCall_kt { 30 -> {31}; 31 -> {32}; 32 -> {34 33}; - 33 -> {40}; + 33 -> {41}; 34 -> {35}; 35 -> {36}; 36 -> {37}; @@ -128,49 +129,50 @@ digraph assignSafeCall_kt { 39 -> {40}; 40 -> {41}; 41 -> {42}; + 42 -> {43}; subgraph cluster_12 { color=red - 43 [label="Enter function test_2" style="filled" fillcolor=red]; + 44 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_13 { color=blue - 44 [label="Enter block"]; - 45 [label="Access variable R|/a|"]; - 46 [label="Enter safe call"]; - 47 [label="Function call: $subj$.R|/A.foo|()"]; - 48 [label="Exit safe call"]; - 49 [label="Variable declaration: lval x: R|kotlin/Int?|"]; + 45 [label="Enter block"]; + 46 [label="Access variable R|/a|"]; + 47 [label="Enter safe call"]; + 48 [label="Function call: $subj$.R|/A.foo|()"]; + 49 [label="Exit safe call"]; + 50 [label="Variable declaration: lval x: R|kotlin/Int?|"]; subgraph cluster_14 { color=blue - 50 [label="Enter when"]; + 51 [label="Enter when"]; subgraph cluster_15 { color=blue - 51 [label="Enter when branch condition "]; - 52 [label="Access variable R|/x|"]; - 53 [label="Const: Null(null)"]; - 54 [label="Equality operator !="]; - 55 [label="Exit when branch condition"]; + 52 [label="Enter when branch condition "]; + 53 [label="Access variable R|/x|"]; + 54 [label="Const: Null(null)"]; + 55 [label="Equality operator !="]; + 56 [label="Exit when branch condition"]; } - 56 [label="Synthetic else branch"]; - 57 [label="Enter when branch result"]; + 57 [label="Synthetic else branch"]; + 58 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 58 [label="Enter block"]; - 59 [label="Access variable R|/a|"]; - 60 [label="Function call: R|/a|.R|/A.bar|()"]; - 61 [label="Exit block"]; + 59 [label="Enter block"]; + 60 [label="Access variable R|/a|"]; + 61 [label="Smart cast: R|/a|"]; + 62 [label="Function call: R|/a|.R|/A.bar|()"]; + 63 [label="Exit block"]; } - 62 [label="Exit when branch result"]; - 63 [label="Exit when"]; + 64 [label="Exit when branch result"]; + 65 [label="Exit when"]; } - 64 [label="Exit block"]; + 66 [label="Exit block"]; } - 65 [label="Exit function test_2" style="filled" fillcolor=red]; + 67 [label="Exit function test_2" style="filled" fillcolor=red]; } - 43 -> {44}; 44 -> {45}; - 45 -> {46 48}; - 46 -> {47}; + 45 -> {46}; + 46 -> {47 49}; 47 -> {48}; 48 -> {49}; 49 -> {50}; @@ -179,9 +181,9 @@ digraph assignSafeCall_kt { 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {57 56}; - 56 -> {63}; - 57 -> {58}; + 55 -> {56}; + 56 -> {58 57}; + 57 -> {65}; 58 -> {59}; 59 -> {60}; 60 -> {61}; @@ -189,230 +191,240 @@ digraph assignSafeCall_kt { 62 -> {63}; 63 -> {64}; 64 -> {65}; + 65 -> {66}; + 66 -> {67}; subgraph cluster_17 { color=red - 66 [label="Enter function test_3" style="filled" fillcolor=red]; + 68 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_18 { color=blue - 67 [label="Enter block"]; - 68 [label="Access variable R|/x|"]; - 69 [label="Type operator: (R|/x| as? R|A|)"]; - 70 [label="Exit lhs of ?:"]; - 71 [label="Enter rhs of ?:"]; - 72 [label="Jump: ^test_3 Unit"]; - 73 [label="Stub" style="filled" fillcolor=gray]; - 74 [label="Lhs of ?: is not null"]; - 75 [label="Exit ?:"]; - 76 [label="Variable declaration: lval a: R|A|"]; - 77 [label="Access variable R|/a|"]; - 78 [label="Function call: R|/a|.R|/A.foo|()"]; - 79 [label="Access variable R|/x|"]; - 80 [label="Function call: R|/x|.R|/A.foo|()"]; - 81 [label="Exit block"]; + 69 [label="Enter block"]; + 70 [label="Access variable R|/x|"]; + 71 [label="Type operator: (R|/x| as? R|A|)"]; + 72 [label="Exit lhs of ?:"]; + 73 [label="Enter rhs of ?:"]; + 74 [label="Jump: ^test_3 Unit"]; + 75 [label="Stub" style="filled" fillcolor=gray]; + 76 [label="Lhs of ?: is not null"]; + 77 [label="Exit ?:"]; + 78 [label="Variable declaration: lval a: R|A|"]; + 79 [label="Access variable R|/a|"]; + 80 [label="Function call: R|/a|.R|/A.foo|()"]; + 81 [label="Access variable R|/x|"]; + 82 [label="Smart cast: R|/x|"]; + 83 [label="Function call: R|/x|.R|/A.foo|()"]; + 84 [label="Exit block"]; } - 82 [label="Exit function test_3" style="filled" fillcolor=red]; + 85 [label="Exit function test_3" style="filled" fillcolor=red]; } - 66 -> {67}; - 67 -> {68}; 68 -> {69}; 69 -> {70}; - 70 -> {74 71}; + 70 -> {71}; 71 -> {72}; - 72 -> {82}; - 72 -> {73} [style=dotted]; - 73 -> {75} [style=dotted]; - 74 -> {75}; - 75 -> {76}; + 72 -> {76 73}; + 73 -> {74}; + 74 -> {85}; + 74 -> {75} [style=dotted]; + 75 -> {77} [style=dotted]; 76 -> {77}; 77 -> {78}; 78 -> {79}; 79 -> {80}; 80 -> {81}; 81 -> {82}; + 82 -> {83}; + 83 -> {84}; + 84 -> {85}; subgraph cluster_19 { color=red - 83 [label="Enter function foo" style="filled" fillcolor=red]; - 84 [label="Exit function foo" style="filled" fillcolor=red]; + 86 [label="Enter function foo" style="filled" fillcolor=red]; + 87 [label="Exit function foo" style="filled" fillcolor=red]; } - 83 -> {84}; + 86 -> {87}; subgraph cluster_20 { color=red - 85 [label="Enter function bar" style="filled" fillcolor=red]; - 86 [label="Exit function bar" style="filled" fillcolor=red]; + 88 [label="Enter function bar" style="filled" fillcolor=red]; + 89 [label="Exit function bar" style="filled" fillcolor=red]; } - 85 -> {86}; + 88 -> {89}; subgraph cluster_21 { color=red - 87 [label="Enter class B" style="filled" fillcolor=red]; - 88 [label="Exit class B" style="filled" fillcolor=red]; + 90 [label="Enter class B" style="filled" fillcolor=red]; + 91 [label="Exit class B" style="filled" fillcolor=red]; } - 87 -> {88} [color=green]; + 90 -> {91} [color=green]; subgraph cluster_22 { color=red - 89 [label="Enter function test_1" style="filled" fillcolor=red]; + 92 [label="Enter function test_1" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 90 [label="Enter block"]; - 91 [label="Access variable R|/a|"]; - 92 [label="Enter safe call"]; - 93 [label="Access variable R|/B.x|"]; - 94 [label="Exit safe call"]; - 95 [label="Variable declaration: lval x: R|kotlin/Int?|"]; + 93 [label="Enter block"]; + 94 [label="Access variable R|/a|"]; + 95 [label="Enter safe call"]; + 96 [label="Access variable R|/B.x|"]; + 97 [label="Exit safe call"]; + 98 [label="Variable declaration: lval x: R|kotlin/Int?|"]; subgraph cluster_24 { color=blue - 96 [label="Enter when"]; + 99 [label="Enter when"]; subgraph cluster_25 { color=blue - 97 [label="Enter when branch condition "]; - 98 [label="Access variable R|/x|"]; - 99 [label="Const: Null(null)"]; - 100 [label="Equality operator !="]; - 101 [label="Exit when branch condition"]; + 100 [label="Enter when branch condition "]; + 101 [label="Access variable R|/x|"]; + 102 [label="Const: Null(null)"]; + 103 [label="Equality operator !="]; + 104 [label="Exit when branch condition"]; } - 102 [label="Synthetic else branch"]; - 103 [label="Enter when branch result"]; + 105 [label="Synthetic else branch"]; + 106 [label="Enter when branch result"]; subgraph cluster_26 { color=blue - 104 [label="Enter block"]; - 105 [label="Access variable R|/a|"]; - 106 [label="Function call: R|/a|.R|/B.bar|()"]; - 107 [label="Exit block"]; + 107 [label="Enter block"]; + 108 [label="Access variable R|/a|"]; + 109 [label="Smart cast: R|/a|"]; + 110 [label="Function call: R|/a|.R|/B.bar|()"]; + 111 [label="Exit block"]; } - 108 [label="Exit when branch result"]; - 109 [label="Exit when"]; + 112 [label="Exit when branch result"]; + 113 [label="Exit when"]; } - 110 [label="Exit block"]; + 114 [label="Exit block"]; } - 111 [label="Exit function test_1" style="filled" fillcolor=red]; + 115 [label="Exit function test_1" style="filled" fillcolor=red]; } - 89 -> {90}; - 90 -> {91}; - 91 -> {92 94}; 92 -> {93}; 93 -> {94}; - 94 -> {95}; + 94 -> {95 97}; 95 -> {96}; 96 -> {97}; 97 -> {98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; - 101 -> {103 102}; - 102 -> {109}; + 101 -> {102}; + 102 -> {103}; 103 -> {104}; - 104 -> {105}; - 105 -> {106}; + 104 -> {106 105}; + 105 -> {113}; 106 -> {107}; 107 -> {108}; 108 -> {109}; 109 -> {110}; 110 -> {111}; + 111 -> {112}; + 112 -> {113}; + 113 -> {114}; + 114 -> {115}; subgraph cluster_27 { color=red - 112 [label="Enter function test_2" style="filled" fillcolor=red]; + 116 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_28 { color=blue - 113 [label="Enter block"]; - 114 [label="Access variable R|/a|"]; - 115 [label="Enter safe call"]; - 116 [label="Function call: $subj$.R|/B.foo|()"]; - 117 [label="Exit safe call"]; - 118 [label="Variable declaration: lval x: R|kotlin/Int?|"]; + 117 [label="Enter block"]; + 118 [label="Access variable R|/a|"]; + 119 [label="Enter safe call"]; + 120 [label="Function call: $subj$.R|/B.foo|()"]; + 121 [label="Exit safe call"]; + 122 [label="Variable declaration: lval x: R|kotlin/Int?|"]; subgraph cluster_29 { color=blue - 119 [label="Enter when"]; + 123 [label="Enter when"]; subgraph cluster_30 { color=blue - 120 [label="Enter when branch condition "]; - 121 [label="Access variable R|/x|"]; - 122 [label="Const: Null(null)"]; - 123 [label="Equality operator !="]; - 124 [label="Exit when branch condition"]; + 124 [label="Enter when branch condition "]; + 125 [label="Access variable R|/x|"]; + 126 [label="Const: Null(null)"]; + 127 [label="Equality operator !="]; + 128 [label="Exit when branch condition"]; } - 125 [label="Synthetic else branch"]; - 126 [label="Enter when branch result"]; + 129 [label="Synthetic else branch"]; + 130 [label="Enter when branch result"]; subgraph cluster_31 { color=blue - 127 [label="Enter block"]; - 128 [label="Access variable R|/a|"]; - 129 [label="Function call: R|/a|.R|/B.bar|()"]; - 130 [label="Exit block"]; + 131 [label="Enter block"]; + 132 [label="Access variable R|/a|"]; + 133 [label="Smart cast: R|/a|"]; + 134 [label="Function call: R|/a|.R|/B.bar|()"]; + 135 [label="Exit block"]; } - 131 [label="Exit when branch result"]; - 132 [label="Exit when"]; + 136 [label="Exit when branch result"]; + 137 [label="Exit when"]; } - 133 [label="Exit block"]; + 138 [label="Exit block"]; } - 134 [label="Exit function test_2" style="filled" fillcolor=red]; + 139 [label="Exit function test_2" style="filled" fillcolor=red]; } - 112 -> {113}; - 113 -> {114}; - 114 -> {115 117}; - 115 -> {116}; 116 -> {117}; 117 -> {118}; - 118 -> {119}; + 118 -> {119 121}; 119 -> {120}; 120 -> {121}; 121 -> {122}; 122 -> {123}; 123 -> {124}; - 124 -> {126 125}; - 125 -> {132}; + 124 -> {125}; + 125 -> {126}; 126 -> {127}; 127 -> {128}; - 128 -> {129}; - 129 -> {130}; + 128 -> {130 129}; + 129 -> {137}; 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; - - subgraph cluster_32 { - color=red - 135 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_33 { - color=blue - 136 [label="Enter block"]; - 137 [label="Access variable R|/x|"]; - 138 [label="Type operator: (R|/x| as? R|B|)"]; - 139 [label="Exit lhs of ?:"]; - 140 [label="Enter rhs of ?:"]; - 141 [label="Jump: ^test_3 Unit"]; - 142 [label="Stub" style="filled" fillcolor=gray]; - 143 [label="Lhs of ?: is not null"]; - 144 [label="Exit ?:"]; - 145 [label="Variable declaration: lval a: R|B|"]; - 146 [label="Access variable R|/a|"]; - 147 [label="Function call: R|/a|.R|/B.foo|()"]; - 148 [label="Access variable R|/x|"]; - 149 [label="Function call: R|/x|.R|/B.foo|()"]; - 150 [label="Exit block"]; - } - 151 [label="Exit function test_3" style="filled" fillcolor=red]; - } + 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; 138 -> {139}; - 139 -> {143 140}; + + subgraph cluster_32 { + color=red + 140 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_33 { + color=blue + 141 [label="Enter block"]; + 142 [label="Access variable R|/x|"]; + 143 [label="Type operator: (R|/x| as? R|B|)"]; + 144 [label="Exit lhs of ?:"]; + 145 [label="Enter rhs of ?:"]; + 146 [label="Jump: ^test_3 Unit"]; + 147 [label="Stub" style="filled" fillcolor=gray]; + 148 [label="Lhs of ?: is not null"]; + 149 [label="Exit ?:"]; + 150 [label="Variable declaration: lval a: R|B|"]; + 151 [label="Access variable R|/a|"]; + 152 [label="Function call: R|/a|.R|/B.foo|()"]; + 153 [label="Access variable R|/x|"]; + 154 [label="Smart cast: R|/x|"]; + 155 [label="Function call: R|/x|.R|/B.foo|()"]; + 156 [label="Exit block"]; + } + 157 [label="Exit function test_3" style="filled" fillcolor=red]; + } 140 -> {141}; - 141 -> {151}; - 141 -> {142} [style=dotted]; - 142 -> {144} [style=dotted]; + 141 -> {142}; + 142 -> {143}; 143 -> {144}; - 144 -> {145}; + 144 -> {148 145}; 145 -> {146}; - 146 -> {147}; - 147 -> {148}; + 146 -> {157}; + 146 -> {147} [style=dotted]; + 147 -> {149} [style=dotted]; 148 -> {149}; 149 -> {150}; 150 -> {151}; + 151 -> {152}; + 152 -> {153}; + 153 -> {154}; + 154 -> {155}; + 155 -> {156}; + 156 -> {157}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot index 684490a4478..b456db5865d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot @@ -63,15 +63,16 @@ digraph safeCallAndEqualityToBool_kt { color=blue 27 [label="Enter block"]; 28 [label="Access variable R|/s|"]; - 29 [label="Access variable R|kotlin/String.length|"]; - 30 [label="Exit block"]; + 29 [label="Smart cast: R|/s|"]; + 30 [label="Access variable R|kotlin/String.length|"]; + 31 [label="Exit block"]; } - 31 [label="Exit when branch result"]; - 32 [label="Exit when"]; + 32 [label="Exit when branch result"]; + 33 [label="Exit when"]; } - 33 [label="Exit block"]; + 34 [label="Exit block"]; } - 34 [label="Exit function test_1" style="filled" fillcolor=red]; + 35 [label="Exit function test_1" style="filled" fillcolor=red]; } 7 -> {8}; 8 -> {9}; @@ -91,7 +92,7 @@ digraph safeCallAndEqualityToBool_kt { 22 -> {23}; 23 -> {24}; 24 -> {25}; - 25 -> {32}; + 25 -> {33}; 26 -> {27}; 27 -> {28}; 28 -> {29}; @@ -100,76 +101,77 @@ digraph safeCallAndEqualityToBool_kt { 31 -> {32}; 32 -> {33}; 33 -> {34}; + 34 -> {35}; subgraph cluster_9 { color=red - 35 [label="Enter function test_2" style="filled" fillcolor=red]; + 36 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 36 [label="Enter block"]; + 37 [label="Enter block"]; subgraph cluster_11 { color=blue - 37 [label="Enter when"]; + 38 [label="Enter when"]; subgraph cluster_12 { color=blue - 38 [label="Enter when branch condition "]; - 39 [label="Access variable R|/s|"]; - 40 [label="Enter safe call"]; - 41 [label="Function call: $subj$.R|/check|()"]; - 42 [label="Exit safe call"]; - 43 [label="Const: Boolean(false)"]; - 44 [label="Equality operator =="]; - 45 [label="Exit when branch condition"]; + 39 [label="Enter when branch condition "]; + 40 [label="Access variable R|/s|"]; + 41 [label="Enter safe call"]; + 42 [label="Function call: $subj$.R|/check|()"]; + 43 [label="Exit safe call"]; + 44 [label="Const: Boolean(false)"]; + 45 [label="Equality operator =="]; + 46 [label="Exit when branch condition"]; } subgraph cluster_13 { color=blue - 46 [label="Enter when branch condition else"]; - 47 [label="Exit when branch condition"]; + 47 [label="Enter when branch condition else"]; + 48 [label="Exit when branch condition"]; } - 48 [label="Enter when branch result"]; + 49 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 49 [label="Enter block"]; - 50 [label="Access variable R|/s|"]; - 51 [label="Access variable #"]; - 52 [label="Exit block"]; + 50 [label="Enter block"]; + 51 [label="Access variable R|/s|"]; + 52 [label="Access variable #"]; + 53 [label="Exit block"]; } - 53 [label="Exit when branch result"]; - 54 [label="Enter when branch result"]; + 54 [label="Exit when branch result"]; + 55 [label="Enter when branch result"]; subgraph cluster_15 { color=blue - 55 [label="Enter block"]; - 56 [label="Access variable R|/s|"]; - 57 [label="Access variable R|kotlin/String.length|"]; - 58 [label="Exit block"]; + 56 [label="Enter block"]; + 57 [label="Access variable R|/s|"]; + 58 [label="Smart cast: R|/s|"]; + 59 [label="Access variable R|kotlin/String.length|"]; + 60 [label="Exit block"]; } - 59 [label="Exit when branch result"]; - 60 [label="Exit when"]; + 61 [label="Exit when branch result"]; + 62 [label="Exit when"]; } - 61 [label="Exit block"]; + 63 [label="Exit block"]; } - 62 [label="Exit function test_2" style="filled" fillcolor=red]; + 64 [label="Exit function test_2" style="filled" fillcolor=red]; } - 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; - 39 -> {40 42}; - 40 -> {41}; + 39 -> {40}; + 40 -> {41 43}; 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; - 45 -> {54 46}; - 46 -> {47}; + 45 -> {46}; + 46 -> {55 47}; 47 -> {48}; 48 -> {49}; 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {60}; - 54 -> {55}; + 53 -> {54}; + 54 -> {62}; 55 -> {56}; 56 -> {57}; 57 -> {58}; @@ -177,159 +179,165 @@ digraph safeCallAndEqualityToBool_kt { 59 -> {60}; 60 -> {61}; 61 -> {62}; + 62 -> {63}; + 63 -> {64}; subgraph cluster_16 { color=red - 63 [label="Enter function test_3" style="filled" fillcolor=red]; + 65 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_17 { color=blue - 64 [label="Enter block"]; + 66 [label="Enter block"]; subgraph cluster_18 { color=blue - 65 [label="Enter when"]; + 67 [label="Enter when"]; subgraph cluster_19 { color=blue - 66 [label="Enter when branch condition "]; - 67 [label="Access variable R|/s|"]; - 68 [label="Enter safe call"]; - 69 [label="Function call: $subj$.R|/check|()"]; - 70 [label="Exit safe call"]; - 71 [label="Const: Boolean(true)"]; - 72 [label="Equality operator !="]; - 73 [label="Exit when branch condition"]; + 68 [label="Enter when branch condition "]; + 69 [label="Access variable R|/s|"]; + 70 [label="Enter safe call"]; + 71 [label="Function call: $subj$.R|/check|()"]; + 72 [label="Exit safe call"]; + 73 [label="Const: Boolean(true)"]; + 74 [label="Equality operator !="]; + 75 [label="Exit when branch condition"]; } subgraph cluster_20 { color=blue - 74 [label="Enter when branch condition else"]; - 75 [label="Exit when branch condition"]; + 76 [label="Enter when branch condition else"]; + 77 [label="Exit when branch condition"]; } - 76 [label="Enter when branch result"]; + 78 [label="Enter when branch result"]; subgraph cluster_21 { color=blue - 77 [label="Enter block"]; - 78 [label="Access variable R|/s|"]; - 79 [label="Access variable R|kotlin/String.length|"]; - 80 [label="Exit block"]; + 79 [label="Enter block"]; + 80 [label="Access variable R|/s|"]; + 81 [label="Smart cast: R|/s|"]; + 82 [label="Access variable R|kotlin/String.length|"]; + 83 [label="Exit block"]; } - 81 [label="Exit when branch result"]; - 82 [label="Enter when branch result"]; + 84 [label="Exit when branch result"]; + 85 [label="Enter when branch result"]; subgraph cluster_22 { color=blue - 83 [label="Enter block"]; - 84 [label="Access variable R|/s|"]; - 85 [label="Access variable #"]; - 86 [label="Exit block"]; + 86 [label="Enter block"]; + 87 [label="Access variable R|/s|"]; + 88 [label="Access variable #"]; + 89 [label="Exit block"]; } - 87 [label="Exit when branch result"]; - 88 [label="Exit when"]; + 90 [label="Exit when branch result"]; + 91 [label="Exit when"]; } - 89 [label="Exit block"]; + 92 [label="Exit block"]; } - 90 [label="Exit function test_3" style="filled" fillcolor=red]; + 93 [label="Exit function test_3" style="filled" fillcolor=red]; } - 63 -> {64}; - 64 -> {65}; 65 -> {66}; 66 -> {67}; - 67 -> {68 70}; + 67 -> {68}; 68 -> {69}; - 69 -> {70}; + 69 -> {70 72}; 70 -> {71}; 71 -> {72}; 72 -> {73}; - 73 -> {82 74}; + 73 -> {74}; 74 -> {75}; - 75 -> {76}; + 75 -> {85 76}; 76 -> {77}; 77 -> {78}; 78 -> {79}; 79 -> {80}; 80 -> {81}; - 81 -> {88}; + 81 -> {82}; 82 -> {83}; 83 -> {84}; - 84 -> {85}; + 84 -> {91}; 85 -> {86}; 86 -> {87}; 87 -> {88}; 88 -> {89}; 89 -> {90}; + 90 -> {91}; + 91 -> {92}; + 92 -> {93}; subgraph cluster_23 { color=red - 91 [label="Enter function test_4" style="filled" fillcolor=red]; + 94 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_24 { color=blue - 92 [label="Enter block"]; + 95 [label="Enter block"]; subgraph cluster_25 { color=blue - 93 [label="Enter when"]; + 96 [label="Enter when"]; subgraph cluster_26 { color=blue - 94 [label="Enter when branch condition "]; - 95 [label="Access variable R|/s|"]; - 96 [label="Enter safe call"]; - 97 [label="Function call: $subj$.R|/check|()"]; - 98 [label="Exit safe call"]; - 99 [label="Const: Boolean(false)"]; - 100 [label="Equality operator !="]; - 101 [label="Exit when branch condition"]; + 97 [label="Enter when branch condition "]; + 98 [label="Access variable R|/s|"]; + 99 [label="Enter safe call"]; + 100 [label="Function call: $subj$.R|/check|()"]; + 101 [label="Exit safe call"]; + 102 [label="Const: Boolean(false)"]; + 103 [label="Equality operator !="]; + 104 [label="Exit when branch condition"]; } subgraph cluster_27 { color=blue - 102 [label="Enter when branch condition else"]; - 103 [label="Exit when branch condition"]; + 105 [label="Enter when branch condition else"]; + 106 [label="Exit when branch condition"]; } - 104 [label="Enter when branch result"]; + 107 [label="Enter when branch result"]; subgraph cluster_28 { color=blue - 105 [label="Enter block"]; - 106 [label="Access variable R|/s|"]; - 107 [label="Access variable R|kotlin/String.length|"]; - 108 [label="Exit block"]; + 108 [label="Enter block"]; + 109 [label="Access variable R|/s|"]; + 110 [label="Smart cast: R|/s|"]; + 111 [label="Access variable R|kotlin/String.length|"]; + 112 [label="Exit block"]; } - 109 [label="Exit when branch result"]; - 110 [label="Enter when branch result"]; + 113 [label="Exit when branch result"]; + 114 [label="Enter when branch result"]; subgraph cluster_29 { color=blue - 111 [label="Enter block"]; - 112 [label="Access variable R|/s|"]; - 113 [label="Access variable #"]; - 114 [label="Exit block"]; + 115 [label="Enter block"]; + 116 [label="Access variable R|/s|"]; + 117 [label="Access variable #"]; + 118 [label="Exit block"]; } - 115 [label="Exit when branch result"]; - 116 [label="Exit when"]; + 119 [label="Exit when branch result"]; + 120 [label="Exit when"]; } - 117 [label="Exit block"]; + 121 [label="Exit block"]; } - 118 [label="Exit function test_4" style="filled" fillcolor=red]; + 122 [label="Exit function test_4" style="filled" fillcolor=red]; } - 91 -> {92}; - 92 -> {93}; - 93 -> {94}; 94 -> {95}; - 95 -> {96 98}; + 95 -> {96}; 96 -> {97}; 97 -> {98}; - 98 -> {99}; + 98 -> {99 101}; 99 -> {100}; 100 -> {101}; - 101 -> {110 102}; + 101 -> {102}; 102 -> {103}; 103 -> {104}; - 104 -> {105}; + 104 -> {114 105}; 105 -> {106}; 106 -> {107}; 107 -> {108}; 108 -> {109}; - 109 -> {116}; + 109 -> {110}; 110 -> {111}; 111 -> {112}; 112 -> {113}; - 113 -> {114}; + 113 -> {120}; 114 -> {115}; 115 -> {116}; 116 -> {117}; 117 -> {118}; + 118 -> {119}; + 119 -> {120}; + 120 -> {121}; + 121 -> {122}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot index 4d10b62bb44..f6d65704225 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot @@ -47,20 +47,21 @@ digraph safeCalls_kt { 13 [label="Access variable R|/x|"]; 14 [label="Enter safe call"]; 15 [label="Access variable R|/x|"]; - 16 [label="Access variable R|kotlin/String.length|"]; - 17 [label="Const: Int(1)"]; - 18 [label="Equality operator =="]; - 19 [label="Function call: $subj$.R|/foo|(...)"]; - 20 [label="Exit safe call"]; - 21 [label="Access variable R|/x|"]; - 22 [label="Access variable #"]; - 23 [label="Exit block"]; + 16 [label="Smart cast: R|/x|"]; + 17 [label="Access variable R|kotlin/String.length|"]; + 18 [label="Const: Int(1)"]; + 19 [label="Equality operator =="]; + 20 [label="Function call: $subj$.R|/foo|(...)"]; + 21 [label="Exit safe call"]; + 22 [label="Access variable R|/x|"]; + 23 [label="Access variable #"]; + 24 [label="Exit block"]; } - 24 [label="Exit function test" style="filled" fillcolor=red]; + 25 [label="Exit function test" style="filled" fillcolor=red]; } 11 -> {12}; 12 -> {13}; - 13 -> {14 20}; + 13 -> {14 21}; 14 -> {15}; 15 -> {16}; 16 -> {17}; @@ -71,239 +72,250 @@ digraph safeCalls_kt { 21 -> {22}; 22 -> {23}; 23 -> {24}; + 24 -> {25}; subgraph cluster_6 { color=red - 25 [label="Enter function bar" style="filled" fillcolor=red]; - 26 [label="Exit function bar" style="filled" fillcolor=red]; + 26 [label="Enter function bar" style="filled" fillcolor=red]; + 27 [label="Exit function bar" style="filled" fillcolor=red]; } - 25 -> {26}; + 26 -> {27}; subgraph cluster_7 { color=red - 27 [label="Enter function bool" style="filled" fillcolor=red]; - 28 [label="Exit function bool" style="filled" fillcolor=red]; + 28 [label="Enter function bool" style="filled" fillcolor=red]; + 29 [label="Exit function bool" style="filled" fillcolor=red]; } - 27 -> {28}; + 28 -> {29}; subgraph cluster_8 { color=red - 29 [label="Enter function id" style="filled" fillcolor=red]; - 30 [label="Exit function id" style="filled" fillcolor=red]; + 30 [label="Enter function id" style="filled" fillcolor=red]; + 31 [label="Exit function id" style="filled" fillcolor=red]; } - 29 -> {30}; + 30 -> {31}; subgraph cluster_9 { color=red - 31 [label="Enter class A" style="filled" fillcolor=red]; - 32 [label="Exit class A" style="filled" fillcolor=red]; + 32 [label="Enter class A" style="filled" fillcolor=red]; + 33 [label="Exit class A" style="filled" fillcolor=red]; } - 31 -> {32} [color=green]; + 32 -> {33} [color=green]; subgraph cluster_10 { color=red - 33 [label="Enter function test_2" style="filled" fillcolor=red]; + 34 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 34 [label="Enter block"]; - 35 [label="Access variable R|/x|"]; - 36 [label="Type operator: (R|/x| as? R|A|)"]; - 37 [label="Enter safe call"]; - 38 [label="Access variable R|/x|"]; - 39 [label="Function call: $subj$.R|/A.bar|(...)"]; - 40 [label="Exit safe call"]; - 41 [label="Exit block"]; + 35 [label="Enter block"]; + 36 [label="Access variable R|/x|"]; + 37 [label="Type operator: (R|/x| as? R|A|)"]; + 38 [label="Enter safe call"]; + 39 [label="Access variable R|/x|"]; + 40 [label="Smart cast: R|/x|"]; + 41 [label="Function call: $subj$.R|/A.bar|(...)"]; + 42 [label="Exit safe call"]; + 43 [label="Exit block"]; } - 42 [label="Exit function test_2" style="filled" fillcolor=red]; + 44 [label="Exit function test_2" style="filled" fillcolor=red]; } - 33 -> {34}; 34 -> {35}; 35 -> {36}; - 36 -> {37 40}; - 37 -> {38}; + 36 -> {37}; + 37 -> {38 42}; 38 -> {39}; 39 -> {40}; 40 -> {41}; 41 -> {42}; + 42 -> {43}; + 43 -> {44}; subgraph cluster_12 { color=red - 43 [label="Enter function test_3" style="filled" fillcolor=red]; + 45 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_13 { color=blue - 44 [label="Enter block"]; - 45 [label="Access variable R|/x|"]; - 46 [label="Type operator: (R|/x| as? R|A|)"]; - 47 [label="Enter safe call"]; - 48 [label="Access variable R|/x|"]; - 49 [label="Function call: $subj$.R|/A.bar|(...)"]; - 50 [label="Exit safe call"]; - 51 [label="Enter safe call"]; - 52 [label="Access variable R|/x|"]; - 53 [label="Function call: R|/x|.R|/A.bool|()"]; - 54 [label="Function call: $subj$.R|/foo|(...)"]; - 55 [label="Exit safe call"]; - 56 [label="Enter safe call"]; - 57 [label="Postponed enter to lambda"]; + 46 [label="Enter block"]; + 47 [label="Access variable R|/x|"]; + 48 [label="Type operator: (R|/x| as? R|A|)"]; + 49 [label="Enter safe call"]; + 50 [label="Access variable R|/x|"]; + 51 [label="Smart cast: R|/x|"]; + 52 [label="Function call: $subj$.R|/A.bar|(...)"]; + 53 [label="Exit safe call"]; + 54 [label="Enter safe call"]; + 55 [label="Access variable R|/x|"]; + 56 [label="Smart cast: R|/x|"]; + 57 [label="Function call: R|/x|.R|/A.bool|()"]; + 58 [label="Function call: $subj$.R|/foo|(...)"]; + 59 [label="Exit safe call"]; + 60 [label="Enter safe call"]; + 61 [label="Postponed enter to lambda"]; subgraph cluster_14 { color=blue - 65 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 69 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_15 { color=blue - 66 [label="Enter block"]; - 67 [label="Access variable R|/x|"]; - 68 [label="Function call: R|/x|.R|/A.bool|()"]; - 69 [label="Exit block"]; + 70 [label="Enter block"]; + 71 [label="Access variable R|/x|"]; + 72 [label="Smart cast: R|/x|"]; + 73 [label="Function call: R|/x|.R|/A.bool|()"]; + 74 [label="Exit block"]; } - 70 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 75 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 58 [label="Postponed exit from lambda"]; - 59 [label="Function call: $subj$.R|/let|(...)"]; - 60 [label="Exit safe call"]; - 61 [label="Access variable R|/x|"]; - 62 [label="Function call: R|/x|.#()"]; - 63 [label="Exit block"]; + 62 [label="Postponed exit from lambda"]; + 63 [label="Function call: $subj$.R|/let|(...)"]; + 64 [label="Exit safe call"]; + 65 [label="Access variable R|/x|"]; + 66 [label="Function call: R|/x|.#()"]; + 67 [label="Exit block"]; } - 64 [label="Exit function test_3" style="filled" fillcolor=red]; + 68 [label="Exit function test_3" style="filled" fillcolor=red]; } - 43 -> {44}; - 44 -> {45}; 45 -> {46}; - 46 -> {47 50}; + 46 -> {47}; 47 -> {48}; - 48 -> {49}; + 48 -> {49 53}; 49 -> {50}; - 50 -> {51 55}; + 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {54}; + 53 -> {54 59}; 54 -> {55}; - 55 -> {56 60}; + 55 -> {56}; 56 -> {57}; - 57 -> {58 65}; - 57 -> {65} [style=dashed]; + 57 -> {58}; 58 -> {59}; - 59 -> {60}; + 59 -> {60 64}; 60 -> {61}; - 61 -> {62}; + 61 -> {62 69}; + 61 -> {69} [style=dashed]; 62 -> {63}; 63 -> {64}; + 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; - 68 -> {69}; 69 -> {70}; + 70 -> {71}; + 71 -> {72}; + 72 -> {73}; + 73 -> {74}; + 74 -> {75}; subgraph cluster_16 { color=red - 71 [label="Enter function test_4" style="filled" fillcolor=red]; + 76 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_17 { color=blue - 72 [label="Enter block"]; - 73 [label="Access variable R|/x|"]; - 74 [label="Enter safe call"]; - 75 [label="Function call: $subj$.R|/A.id|()"]; - 76 [label="Exit safe call"]; - 77 [label="Enter safe call"]; - 78 [label="Function call: $subj$.R|/A.bool|()"]; - 79 [label="Exit safe call"]; - 80 [label="Access variable R|/x|"]; - 81 [label="Function call: R|/x|.#()"]; - 82 [label="Exit block"]; + 77 [label="Enter block"]; + 78 [label="Access variable R|/x|"]; + 79 [label="Enter safe call"]; + 80 [label="Function call: $subj$.R|/A.id|()"]; + 81 [label="Exit safe call"]; + 82 [label="Enter safe call"]; + 83 [label="Function call: $subj$.R|/A.bool|()"]; + 84 [label="Exit safe call"]; + 85 [label="Access variable R|/x|"]; + 86 [label="Function call: R|/x|.#()"]; + 87 [label="Exit block"]; } - 83 [label="Exit function test_4" style="filled" fillcolor=red]; + 88 [label="Exit function test_4" style="filled" fillcolor=red]; } - 71 -> {72}; - 72 -> {73}; - 73 -> {74 76}; - 74 -> {75}; - 75 -> {76}; - 76 -> {77 79}; + 76 -> {77}; 77 -> {78}; - 78 -> {79}; + 78 -> {79 81}; 79 -> {80}; 80 -> {81}; - 81 -> {82}; + 81 -> {82 84}; 82 -> {83}; - - subgraph cluster_18 { - color=red - 84 [label="Enter function boo" style="filled" fillcolor=red]; - subgraph cluster_19 { - color=blue - 85 [label="Enter block"]; - 86 [label="Exit block"]; - } - 87 [label="Exit function boo" style="filled" fillcolor=red]; - } + 83 -> {84}; 84 -> {85}; 85 -> {86}; 86 -> {87}; + 87 -> {88}; + + subgraph cluster_18 { + color=red + 89 [label="Enter function boo" style="filled" fillcolor=red]; + subgraph cluster_19 { + color=blue + 90 [label="Enter block"]; + 91 [label="Exit block"]; + } + 92 [label="Exit function boo" style="filled" fillcolor=red]; + } + 89 -> {90}; + 90 -> {91}; + 91 -> {92}; subgraph cluster_20 { color=red - 88 [label="Enter function test_5" style="filled" fillcolor=red]; + 93 [label="Enter function test_5" style="filled" fillcolor=red]; subgraph cluster_21 { color=blue - 89 [label="Enter block"]; - 90 [label="Access variable R|/x|"]; - 91 [label="Enter safe call"]; - 92 [label="Postponed enter to lambda"]; + 94 [label="Enter block"]; + 95 [label="Access variable R|/x|"]; + 96 [label="Enter safe call"]; + 97 [label="Postponed enter to lambda"]; subgraph cluster_22 { color=blue - 107 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 113 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 108 [label="Enter block"]; - 109 [label="Jump: ^test_5 Unit"]; - 110 [label="Stub" style="filled" fillcolor=gray]; - 111 [label="Exit block" style="filled" fillcolor=gray]; + 114 [label="Enter block"]; + 115 [label="Jump: ^test_5 Unit"]; + 116 [label="Stub" style="filled" fillcolor=gray]; + 117 [label="Exit block" style="filled" fillcolor=gray]; } - 112 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray]; + 118 [label="Exit function anonymousFunction" style="filled" fillcolor=red style="filled" fillcolor=gray]; } - 93 [label="Call arguments union" style="filled" fillcolor=gray]; - 94 [label="Postponed exit from lambda" style="filled" fillcolor=gray]; - 95 [label="Function call: $subj$.R|kotlin/let|(...)" style="filled" fillcolor=gray]; - 96 [label="Stub" style="filled" fillcolor=gray]; - 97 [label="Exit safe call"]; - 98 [label="Enter safe call"]; - 99 [label="Access variable R|/x|"]; - 100 [label="Function call: R|/x|.R|/A.bool|()"]; - 101 [label="Function call: $subj$.R|/boo|(...)"]; + 98 [label="Call arguments union" style="filled" fillcolor=gray]; + 99 [label="Postponed exit from lambda" style="filled" fillcolor=gray]; + 100 [label="Function call: $subj$.R|kotlin/let|(...)" style="filled" fillcolor=gray]; + 101 [label="Stub" style="filled" fillcolor=gray]; 102 [label="Exit safe call"]; - 103 [label="Access variable R|/x|"]; - 104 [label="Function call: R|/x|.#()"]; - 105 [label="Exit block"]; + 103 [label="Enter safe call"]; + 104 [label="Access variable R|/x|"]; + 105 [label="Smart cast: R|/x|"]; + 106 [label="Function call: R|/x|.R|/A.bool|()"]; + 107 [label="Function call: $subj$.R|/boo|(...)"]; + 108 [label="Exit safe call"]; + 109 [label="Access variable R|/x|"]; + 110 [label="Function call: R|/x|.#()"]; + 111 [label="Exit block"]; } - 106 [label="Exit function test_5" style="filled" fillcolor=red]; + 112 [label="Exit function test_5" style="filled" fillcolor=red]; } - 88 -> {89}; - 89 -> {90}; - 90 -> {91 97}; - 91 -> {92}; - 92 -> {107}; - 92 -> {94} [color=red]; - 92 -> {107} [style=dashed]; - 93 -> {95} [style=dotted]; - 94 -> {95} [style=dotted]; - 95 -> {96} [style=dotted]; - 95 -> {106} [style=dotted] [label=onUncaughtException]; - 96 -> {97} [style=dotted]; - 97 -> {98 102}; - 98 -> {99}; - 99 -> {100}; - 100 -> {101}; - 101 -> {102}; - 102 -> {103}; + 93 -> {94}; + 94 -> {95}; + 95 -> {96 102}; + 96 -> {97}; + 97 -> {113}; + 97 -> {99} [color=red]; + 97 -> {113} [style=dashed]; + 98 -> {100} [style=dotted]; + 99 -> {100} [style=dotted]; + 100 -> {101} [style=dotted]; + 100 -> {112} [style=dotted] [label=onUncaughtException]; + 101 -> {102} [style=dotted]; + 102 -> {103 108}; 103 -> {104}; 104 -> {105}; 105 -> {106}; + 106 -> {107}; 107 -> {108}; 108 -> {109}; - 109 -> {106}; - 109 -> {110} [style=dotted]; - 110 -> {111} [style=dotted]; - 111 -> {112} [style=dotted]; - 112 -> {94 93} [style=dotted]; + 109 -> {110}; + 110 -> {111}; + 111 -> {112}; + 113 -> {114}; + 114 -> {115}; + 115 -> {112}; + 115 -> {116} [style=dotted]; + 116 -> {117} [style=dotted]; + 117 -> {118} [style=dotted]; + 118 -> {99 98} [style=dotted]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.fir.txt new file mode 100644 index 00000000000..3f9b7f15305 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.fir.txt @@ -0,0 +1,38 @@ +FILE: unstableSmartCastOnSafeCallArgument.kt + public abstract class Foo : R|kotlin/Any| { + public constructor(): R|Foo| { + super() + } + + public abstract val bar: R|Bar?| + public get(): R|Bar?| + + } + public abstract class Bar : R|kotlin/Any| { + public constructor(): R|Bar| { + super() + } + + public abstract val buz: R|Buz?| + public get(): R|Buz?| + + } + public final class Buz : R|kotlin/Any| { + public constructor(): R|Buz| { + super() + } + + } + public final fun takesNullable(b: R|Buz?|): R|kotlin/Unit| { + } + public final fun takesNonNull(b: R|Buz|): R|kotlin/Unit| { + } + public final fun foo(foo: R|Foo|): R|kotlin/Unit| { + when () { + !=(R|/foo|.R|/Foo.bar|?.{ $subj$.R|/Bar.buz| }, Null(null)) -> { + R|/takesNullable|(R|/foo|.R|/Foo.bar|?.{ $subj$.R|/Bar.buz| }) + #(R|/foo|.R|/Foo.bar|?.{ $subj$.R|/Bar.buz| }) + } + } + + } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.kt new file mode 100644 index 00000000000..e5fd9d2a981 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.kt @@ -0,0 +1,21 @@ + +abstract class Foo { + abstract val bar: Bar? +} + +abstract class Bar { + abstract val buz: Buz? +} + +class Buz + +fun takesNullable(b: Buz?) {} +fun takesNonNull(b: Buz) {} + +fun foo(foo: Foo) { + if (foo.bar?.buz != null) { + // Here we have unstable smart-cast on foo.bar?.buz + takesNullable(foo.bar?.buz) // OK + takesNonNull(foo.bar?.buz) // NOT OK + } +} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot index 6bbd0506b72..59c8ca52585 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.dot @@ -65,10 +65,11 @@ digraph smartCastInInit_kt { 19 [label="Function call: R|/s|()"]; 20 [label="Assignment: R|/Main.x|"]; 21 [label="Access variable R|/Main.x|"]; - 22 [label="Function call: this@R|/Main|.R|/Main.x|.R|/S.foo|()"]; - 23 [label="Exit block"]; + 22 [label="Smart cast: this@R|/Main|.R|/Main.x|"]; + 23 [label="Function call: this@R|/Main|.R|/Main.x|.R|/S.foo|()"]; + 24 [label="Exit block"]; } - 24 [label="Exit init block" style="filled" fillcolor=red]; + 25 [label="Exit init block" style="filled" fillcolor=red]; } 17 -> {18}; 18 -> {19}; @@ -77,17 +78,18 @@ digraph smartCastInInit_kt { 21 -> {22}; 22 -> {23}; 23 -> {24}; - 24 -> {27} [color=green]; + 24 -> {25}; + 25 -> {28} [color=green]; subgraph cluster_8 { color=red - 25 [label="Enter class Main" style="filled" fillcolor=red]; - 26 [label="Part of class initialization"]; - 27 [label="Exit class Main" style="filled" fillcolor=red]; + 26 [label="Enter class Main" style="filled" fillcolor=red]; + 27 [label="Part of class initialization"]; + 28 [label="Exit class Main" style="filled" fillcolor=red]; } - 25 -> {26} [color=green]; - 26 -> {27} [style=dotted]; - 26 -> {17} [color=green]; - 26 -> {17} [style=dashed]; + 26 -> {27} [color=green]; + 27 -> {28} [style=dotted]; + 27 -> {17} [color=green]; + 27 -> {17} [style=dashed]; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot index 6d03396af07..4edec316742 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.dot @@ -103,19 +103,20 @@ digraph smartcastInByClause_kt { 36 [label="Exit ?:"]; 37 [label="Variable declaration: lval path: R|kotlin/String|"]; 38 [label="Access variable R|/a|"]; - 39 [label="Access variable R|/A.index|"]; - 40 [label="Function call: R|/takeInt|(...)"]; - 41 [label="Enter anonymous object"]; + 39 [label="Smart cast: R|/a|"]; + 40 [label="Access variable R|/A.index|"]; + 41 [label="Function call: R|/takeInt|(...)"]; + 42 [label="Enter anonymous object"]; subgraph cluster_10 { color=blue - 48 [label="Enter class " style="filled" fillcolor=red]; - 49 [label="Part of class initialization"]; + 49 [label="Enter class " style="filled" fillcolor=red]; 50 [label="Part of class initialization"]; - 51 [label="Exit class " style="filled" fillcolor=red]; + 51 [label="Part of class initialization"]; + 52 [label="Exit class " style="filled" fillcolor=red]; } - 42 [label="Exit anonymous object"]; - 43 [label="Exit anonymous object expression"]; - 44 [label="Jump: ^test object : R|Base| { + 43 [label="Exit anonymous object"]; + 44 [label="Exit anonymous object expression"]; + 45 [label="Jump: ^test object : R|Base| { private constructor(): R|| { super() } @@ -131,10 +132,10 @@ digraph smartcastInByClause_kt { } "]; - 45 [label="Stub" style="filled" fillcolor=gray]; - 46 [label="Exit block" style="filled" fillcolor=gray]; + 46 [label="Stub" style="filled" fillcolor=gray]; + 47 [label="Exit block" style="filled" fillcolor=gray]; } - 47 [label="Exit function test" style="filled" fillcolor=red]; + 48 [label="Exit function test" style="filled" fillcolor=red]; } 24 -> {25}; 25 -> {26}; @@ -147,7 +148,7 @@ digraph smartcastInByClause_kt { 30 -> {35 31}; 31 -> {32}; 32 -> {33}; - 33 -> {47}; + 33 -> {48}; 33 -> {34} [style=dotted]; 34 -> {36} [style=dotted]; 35 -> {36}; @@ -156,94 +157,101 @@ digraph smartcastInByClause_kt { 38 -> {39}; 39 -> {40}; 40 -> {41}; - 40 -> {52 55 60 64} [color=red]; - 41 -> {42} [color=red]; - 41 -> {48} [color=green]; - 41 -> {48} [style=dashed]; - 42 -> {43}; - 42 -> {52 64} [color=green]; - 42 -> {52 64} [style=dashed]; + 41 -> {42}; + 41 -> {53 56 62 67} [color=red]; + 42 -> {43} [color=red]; + 42 -> {49} [color=green]; + 42 -> {49} [style=dashed]; 43 -> {44}; - 44 -> {47}; - 44 -> {45} [style=dotted]; + 43 -> {53 67} [color=green]; + 43 -> {53 67} [style=dashed]; + 44 -> {45}; + 45 -> {48}; 45 -> {46} [style=dotted]; 46 -> {47} [style=dotted]; - 48 -> {49} [color=green]; - 49 -> {50} [style=dotted]; - 49 -> {55} [color=green]; - 49 -> {55} [style=dashed]; + 47 -> {48} [style=dotted]; + 49 -> {50} [color=green]; 50 -> {51} [style=dotted]; - 50 -> {60} [color=green]; - 50 -> {60} [style=dashed]; - 51 -> {42} [color=green]; + 50 -> {56} [color=green]; + 50 -> {56} [style=dashed]; + 51 -> {52} [style=dotted]; + 51 -> {62} [color=green]; + 51 -> {62} [style=dashed]; + 52 -> {43} [color=green]; subgraph cluster_11 { color=red - 52 [label="Enter function " style="filled" fillcolor=red]; - 53 [label="Delegated constructor call: super()"]; - 54 [label="Exit function " style="filled" fillcolor=red]; + 53 [label="Enter function " style="filled" fillcolor=red]; + 54 [label="Delegated constructor call: super()"]; + 55 [label="Exit function " style="filled" fillcolor=red]; } - 52 -> {53}; 53 -> {54}; + 54 -> {55}; subgraph cluster_12 { color=red - 55 [label="Enter field" style="filled" fillcolor=red]; - 56 [label="Access variable R|/a|"]; - 57 [label="Access variable R|/A.index|"]; - 58 [label="Function call: R|/Derived.Derived|(...)"]; - 59 [label="Exit field" style="filled" fillcolor=red]; + 56 [label="Enter field" style="filled" fillcolor=red]; + 57 [label="Access variable R|/a|"]; + 58 [label="Smart cast: R|/a|"]; + 59 [label="Access variable R|/A.index|"]; + 60 [label="Function call: R|/Derived.Derived|(...)"]; + 61 [label="Exit field" style="filled" fillcolor=red]; } - 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; - 59 -> {50} [color=green]; + 59 -> {60}; + 60 -> {61}; + 61 -> {51} [color=green]; subgraph cluster_13 { color=red - 60 [label="Enter property" style="filled" fillcolor=red]; - 61 [label="Access variable R|/a|"]; - 62 [label="Access variable R|/A.index|"]; - 63 [label="Exit property" style="filled" fillcolor=red]; + 62 [label="Enter property" style="filled" fillcolor=red]; + 63 [label="Access variable R|/a|"]; + 64 [label="Smart cast: R|/a|"]; + 65 [label="Access variable R|/A.index|"]; + 66 [label="Exit property" style="filled" fillcolor=red]; } - 60 -> {61}; - 61 -> {62}; 62 -> {63}; - 63 -> {51} [color=green]; + 63 -> {64}; + 64 -> {65}; + 65 -> {66}; + 66 -> {52} [color=green]; subgraph cluster_14 { color=red - 64 [label="Enter function foo" style="filled" fillcolor=red]; + 67 [label="Enter function foo" style="filled" fillcolor=red]; subgraph cluster_15 { color=blue - 65 [label="Enter block"]; - 66 [label="Access variable R|/a|"]; - 67 [label="Access variable R|/A.index|"]; - 68 [label="Function call: R|/takeInt|(...)"]; - 69 [label="Exit block"]; + 68 [label="Enter block"]; + 69 [label="Access variable R|/a|"]; + 70 [label="Smart cast: R|/a|"]; + 71 [label="Access variable R|/A.index|"]; + 72 [label="Function call: R|/takeInt|(...)"]; + 73 [label="Exit block"]; } - 70 [label="Exit function foo" style="filled" fillcolor=red]; + 74 [label="Exit function foo" style="filled" fillcolor=red]; } - 64 -> {65}; - 65 -> {66}; - 66 -> {67}; 67 -> {68}; 68 -> {69}; 69 -> {70}; - - subgraph cluster_16 { - color=red - 71 [label="Enter function takeInt" style="filled" fillcolor=red]; - subgraph cluster_17 { - color=blue - 72 [label="Enter block"]; - 73 [label="Exit block"]; - } - 74 [label="Exit function takeInt" style="filled" fillcolor=red]; - } + 70 -> {71}; 71 -> {72}; 72 -> {73}; 73 -> {74}; + subgraph cluster_16 { + color=red + 75 [label="Enter function takeInt" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 76 [label="Enter block"]; + 77 [label="Exit block"]; + } + 78 [label="Exit function takeInt" style="filled" fillcolor=red]; + } + 75 -> {76}; + 76 -> {77}; + 77 -> {78}; + } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot index c231d723d65..1bed78a8558 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot @@ -334,42 +334,44 @@ digraph smartcastToNothing_kt { color=blue 116 [label="Enter block"]; 117 [label="Access variable R|/a|"]; - 118 [label="Enter safe call"]; - 119 [label="Access variable R|kotlin/String.length|"]; - 120 [label="Exit safe call"]; - 121 [label="Variable declaration: lval b: R|kotlin/Int?|"]; - 122 [label="Exit block"]; + 118 [label="Smart cast: R|/a|"]; + 119 [label="Enter safe call"]; + 120 [label="Access variable R|kotlin/String.length|"]; + 121 [label="Exit safe call"]; + 122 [label="Variable declaration: lval b: R|kotlin/Int?|"]; + 123 [label="Exit block"]; } - 123 [label="Exit when branch result"]; - 124 [label="Exit when"]; + 124 [label="Exit when branch result"]; + 125 [label="Exit when"]; } subgraph cluster_31 { color=blue - 125 [label="Enter when"]; + 126 [label="Enter when"]; subgraph cluster_32 { color=blue - 126 [label="Enter when branch condition "]; - 127 [label="Access variable R|/a|"]; - 128 [label="Type operator: (R|/a| is R|kotlin/Nothing|)"]; - 129 [label="Exit when branch condition"]; + 127 [label="Enter when branch condition "]; + 128 [label="Access variable R|/a|"]; + 129 [label="Type operator: (R|/a| is R|kotlin/Nothing|)"]; + 130 [label="Exit when branch condition"]; } - 130 [label="Synthetic else branch"]; - 131 [label="Enter when branch result"]; + 131 [label="Synthetic else branch"]; + 132 [label="Enter when branch result"]; subgraph cluster_33 { color=blue - 132 [label="Enter block"]; - 133 [label="Access variable R|/a|"]; - 134 [label="Stub" style="filled" fillcolor=gray]; - 135 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray]; - 136 [label="Variable declaration: lval b: R|kotlin/Int|" style="filled" fillcolor=gray]; - 137 [label="Exit block" style="filled" fillcolor=gray]; + 133 [label="Enter block"]; + 134 [label="Access variable R|/a|"]; + 135 [label="Smart cast: R|/a|"]; + 136 [label="Stub" style="filled" fillcolor=gray]; + 137 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray]; + 138 [label="Variable declaration: lval b: R|kotlin/Int|" style="filled" fillcolor=gray]; + 139 [label="Exit block" style="filled" fillcolor=gray]; } - 138 [label="Exit when branch result" style="filled" fillcolor=gray]; - 139 [label="Exit when"]; + 140 [label="Exit when branch result" style="filled" fillcolor=gray]; + 141 [label="Exit when"]; } - 140 [label="Exit block"]; + 142 [label="Exit block"]; } - 141 [label="Exit function test_1" style="filled" fillcolor=red]; + 143 [label="Exit function test_1" style="filled" fillcolor=red]; } 107 -> {108}; 108 -> {109}; @@ -378,11 +380,11 @@ digraph smartcastToNothing_kt { 111 -> {112}; 112 -> {113}; 113 -> {115 114}; - 114 -> {124}; + 114 -> {125}; 115 -> {116}; 116 -> {117}; - 117 -> {118 120}; - 118 -> {119}; + 117 -> {118}; + 118 -> {119 121}; 119 -> {120}; 120 -> {121}; 121 -> {122}; @@ -393,18 +395,20 @@ digraph smartcastToNothing_kt { 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {131 130}; - 130 -> {139}; - 131 -> {132}; + 129 -> {130}; + 130 -> {132 131}; + 131 -> {141}; 132 -> {133}; - 133 -> {141} [label=onUncaughtException]; - 133 -> {134} [style=dotted]; - 134 -> {135} [style=dotted]; + 133 -> {134}; + 134 -> {135}; + 135 -> {143} [label=onUncaughtException]; 135 -> {136} [style=dotted]; 136 -> {137} [style=dotted]; 137 -> {138} [style=dotted]; 138 -> {139} [style=dotted]; - 139 -> {140}; - 140 -> {141}; + 139 -> {140} [style=dotted]; + 140 -> {141} [style=dotted]; + 141 -> {142}; + 142 -> {143}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot index afa2366ccc0..6784b2ea942 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.dot @@ -66,15 +66,16 @@ digraph overridenOpenVal_kt { color=blue 22 [label="Enter block"]; 23 [label="Access variable R|/A.x|"]; - 24 [label="Access variable R|kotlin/String.length|"]; - 25 [label="Exit block"]; + 24 [label="Smart cast: this@R|/B|.R|/A.x|"]; + 25 [label="Access variable R|kotlin/String.length|"]; + 26 [label="Exit block"]; } - 26 [label="Exit when branch result"]; - 27 [label="Exit when"]; + 27 [label="Exit when branch result"]; + 28 [label="Exit when"]; } - 28 [label="Exit block"]; + 29 [label="Exit block"]; } - 29 [label="Exit function test_1" style="filled" fillcolor=red]; + 30 [label="Exit function test_1" style="filled" fillcolor=red]; } 13 -> {14}; 14 -> {15}; @@ -83,7 +84,7 @@ digraph overridenOpenVal_kt { 17 -> {18}; 18 -> {19}; 19 -> {21 20}; - 20 -> {27}; + 20 -> {28}; 21 -> {22}; 22 -> {23}; 23 -> {24}; @@ -92,58 +93,59 @@ digraph overridenOpenVal_kt { 26 -> {27}; 27 -> {28}; 28 -> {29}; + 29 -> {30}; subgraph cluster_9 { color=red - 30 [label="Enter class B" style="filled" fillcolor=red]; - 31 [label="Exit class B" style="filled" fillcolor=red]; + 31 [label="Enter class B" style="filled" fillcolor=red]; + 32 [label="Exit class B" style="filled" fillcolor=red]; } - 30 -> {31} [color=green]; + 31 -> {32} [color=green]; subgraph cluster_10 { color=red - 32 [label="Enter function test_2" style="filled" fillcolor=red]; + 33 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_11 { color=blue - 33 [label="Enter block"]; + 34 [label="Enter block"]; subgraph cluster_12 { color=blue - 34 [label="Enter when"]; + 35 [label="Enter when"]; subgraph cluster_13 { color=blue - 35 [label="Enter when branch condition "]; - 36 [label="Access variable R|/b|"]; - 37 [label="Access variable R|/A.x|"]; - 38 [label="Type operator: (R|/b|.R|/A.x| is R|kotlin/String|)"]; - 39 [label="Exit when branch condition"]; + 36 [label="Enter when branch condition "]; + 37 [label="Access variable R|/b|"]; + 38 [label="Access variable R|/A.x|"]; + 39 [label="Type operator: (R|/b|.R|/A.x| is R|kotlin/String|)"]; + 40 [label="Exit when branch condition"]; } - 40 [label="Synthetic else branch"]; - 41 [label="Enter when branch result"]; + 41 [label="Synthetic else branch"]; + 42 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 42 [label="Enter block"]; - 43 [label="Access variable R|/b|"]; - 44 [label="Access variable R|/A.x|"]; - 45 [label="Access variable R|kotlin/String.length|"]; - 46 [label="Exit block"]; + 43 [label="Enter block"]; + 44 [label="Access variable R|/b|"]; + 45 [label="Access variable R|/A.x|"]; + 46 [label="Smart cast: R|/b|.R|/A.x|"]; + 47 [label="Access variable R|kotlin/String.length|"]; + 48 [label="Exit block"]; } - 47 [label="Exit when branch result"]; - 48 [label="Exit when"]; + 49 [label="Exit when branch result"]; + 50 [label="Exit when"]; } - 49 [label="Exit block"]; + 51 [label="Exit block"]; } - 50 [label="Exit function test_2" style="filled" fillcolor=red]; + 52 [label="Exit function test_2" style="filled" fillcolor=red]; } - 32 -> {33}; 33 -> {34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; - 39 -> {41 40}; - 40 -> {48}; - 41 -> {42}; + 39 -> {40}; + 40 -> {42 41}; + 41 -> {50}; 42 -> {43}; 43 -> {44}; 44 -> {45}; @@ -152,5 +154,7 @@ digraph overridenOpenVal_kt { 47 -> {48}; 48 -> {49}; 49 -> {50}; + 50 -> {51}; + 51 -> {52}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot index fd821650909..77fec0a0a3b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot @@ -70,17 +70,18 @@ digraph delayedAssignment_kt { 26 [label="Function call: R|/A.A|()"]; 27 [label="Assignment: R|/a|"]; 28 [label="Access variable R|/a|"]; - 29 [label="Function call: R|/a|.R|/A.foo|()"]; - 30 [label="Exit block"]; + 29 [label="Smart cast: R|/a|"]; + 30 [label="Function call: R|/a|.R|/A.foo|()"]; + 31 [label="Exit block"]; } - 31 [label="Exit when branch result"]; - 32 [label="Exit when"]; + 32 [label="Exit when branch result"]; + 33 [label="Exit when"]; } - 33 [label="Access variable R|/a|"]; - 34 [label="Function call: R|/a|.#()"]; - 35 [label="Exit block"]; + 34 [label="Access variable R|/a|"]; + 35 [label="Function call: R|/a|.#()"]; + 36 [label="Exit block"]; } - 36 [label="Exit function test" style="filled" fillcolor=red]; + 37 [label="Exit function test" style="filled" fillcolor=red]; } 9 -> {10}; 10 -> {11}; @@ -96,7 +97,7 @@ digraph delayedAssignment_kt { 20 -> {21}; 21 -> {22}; 22 -> {23}; - 23 -> {32}; + 23 -> {33}; 24 -> {25}; 25 -> {26}; 26 -> {27}; @@ -109,5 +110,6 @@ digraph delayedAssignment_kt { 33 -> {34}; 34 -> {35}; 35 -> {36}; + 36 -> {37}; } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot index 571bf9481a3..37e43e8a60c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot @@ -14,10 +14,11 @@ digraph smartcastAfterReassignment_kt { 4 [label="Const: String()"]; 5 [label="Assignment: R|/x|"]; 6 [label="Access variable R|/x|"]; - 7 [label="Access variable R|kotlin/String.length|"]; - 8 [label="Exit block"]; + 7 [label="Smart cast: R|/x|"]; + 8 [label="Access variable R|kotlin/String.length|"]; + 9 [label="Exit block"]; } - 9 [label="Exit function test_1" style="filled" fillcolor=red]; + 10 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -28,45 +29,46 @@ digraph smartcastAfterReassignment_kt { 6 -> {7}; 7 -> {8}; 8 -> {9}; + 9 -> {10}; subgraph cluster_2 { color=red - 10 [label="Enter function test_2" style="filled" fillcolor=red]; + 11 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_3 { color=blue - 11 [label="Enter block"]; - 12 [label="Const: Null(null)"]; - 13 [label="Variable declaration: lvar x: R|kotlin/String?|"]; + 12 [label="Enter block"]; + 13 [label="Const: Null(null)"]; + 14 [label="Variable declaration: lvar x: R|kotlin/String?|"]; subgraph cluster_4 { color=blue - 14 [label="Enter when"]; + 15 [label="Enter when"]; subgraph cluster_5 { color=blue - 15 [label="Enter when branch condition "]; - 16 [label="Access variable R|/x|"]; - 17 [label="Const: Null(null)"]; - 18 [label="Equality operator =="]; - 19 [label="Exit when branch condition"]; + 16 [label="Enter when branch condition "]; + 17 [label="Access variable R|/x|"]; + 18 [label="Const: Null(null)"]; + 19 [label="Equality operator =="]; + 20 [label="Exit when branch condition"]; } - 20 [label="Synthetic else branch"]; - 21 [label="Enter when branch result"]; + 21 [label="Synthetic else branch"]; + 22 [label="Enter when branch result"]; subgraph cluster_6 { color=blue - 22 [label="Enter block"]; - 23 [label="Const: String()"]; - 24 [label="Assignment: R|/x|"]; - 25 [label="Exit block"]; + 23 [label="Enter block"]; + 24 [label="Const: String()"]; + 25 [label="Assignment: R|/x|"]; + 26 [label="Exit block"]; } - 26 [label="Exit when branch result"]; - 27 [label="Exit when"]; + 27 [label="Exit when branch result"]; + 28 [label="Exit when"]; } - 28 [label="Access variable R|/x|"]; - 29 [label="Access variable R|kotlin/String.length|"]; - 30 [label="Exit block"]; + 29 [label="Access variable R|/x|"]; + 30 [label="Smart cast: R|/x|"]; + 31 [label="Access variable R|kotlin/String.length|"]; + 32 [label="Exit block"]; } - 31 [label="Exit function test_2" style="filled" fillcolor=red]; + 33 [label="Exit function test_2" style="filled" fillcolor=red]; } - 10 -> {11}; 11 -> {12}; 12 -> {13}; 13 -> {14}; @@ -75,9 +77,9 @@ digraph smartcastAfterReassignment_kt { 16 -> {17}; 17 -> {18}; 18 -> {19}; - 19 -> {21 20}; - 20 -> {27}; - 21 -> {22}; + 19 -> {20}; + 20 -> {22 21}; + 21 -> {28}; 22 -> {23}; 23 -> {24}; 24 -> {25}; @@ -87,29 +89,31 @@ digraph smartcastAfterReassignment_kt { 28 -> {29}; 29 -> {30}; 30 -> {31}; + 31 -> {32}; + 32 -> {33}; subgraph cluster_7 { color=red - 32 [label="Enter function test_3" style="filled" fillcolor=red]; + 34 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_8 { color=blue - 33 [label="Enter block"]; - 34 [label="Const: Null(null)"]; - 35 [label="Variable declaration: lvar x: R|kotlin/String?|"]; - 36 [label="Const: String()"]; - 37 [label="Assignment: R|/x|"]; - 38 [label="Access variable R|/x|"]; - 39 [label="Access variable R|kotlin/String.length|"]; - 40 [label="Const: Null(null)"]; - 41 [label="Assignment: R|/x|"]; - 42 [label="Access variable R|/x|"]; - 43 [label="Access variable #"]; - 44 [label="Exit block"]; + 35 [label="Enter block"]; + 36 [label="Const: Null(null)"]; + 37 [label="Variable declaration: lvar x: R|kotlin/String?|"]; + 38 [label="Const: String()"]; + 39 [label="Assignment: R|/x|"]; + 40 [label="Access variable R|/x|"]; + 41 [label="Smart cast: R|/x|"]; + 42 [label="Access variable R|kotlin/String.length|"]; + 43 [label="Const: Null(null)"]; + 44 [label="Assignment: R|/x|"]; + 45 [label="Access variable R|/x|"]; + 46 [label="Smart cast: R|/x|"]; + 47 [label="Access variable #"]; + 48 [label="Exit block"]; } - 45 [label="Exit function test_3" style="filled" fillcolor=red]; + 49 [label="Exit function test_3" style="filled" fillcolor=red]; } - 32 -> {33}; - 33 -> {34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; @@ -121,5 +125,9 @@ digraph smartcastAfterReassignment_kt { 42 -> {43}; 43 -> {44}; 44 -> {45}; + 45 -> {46}; + 46 -> {47}; + 47 -> {48}; + 48 -> {49}; } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/conditionalEffects.dot b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/conditionalEffects.dot index 7b03d54defa..8e5f4244495 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/conditionalEffects.dot +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/conditionalEffects.dot @@ -20,10 +20,11 @@ digraph conditionalEffects_kt { 8 [label="Exit contract"]; } 9 [label="Access variable R|/x|"]; - 10 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 11 [label="Exit block"]; + 10 [label="Smart cast: R|/x|"]; + 11 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 12 [label="Exit block"]; } - 12 [label="Exit function test_1" style="filled" fillcolor=red]; + 13 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; 1 -> {2}; @@ -37,30 +38,31 @@ digraph conditionalEffects_kt { 9 -> {10}; 10 -> {11}; 11 -> {12}; + 12 -> {13}; subgraph cluster_3 { color=red - 13 [label="Enter function test_2" style="filled" fillcolor=red]; + 14 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_4 { color=blue - 14 [label="Enter block"]; - 15 [label="Access variable R|/x|"]; - 16 [label="Function call: R|kotlin/requireNotNull|(...)"]; + 15 [label="Enter block"]; + 16 [label="Access variable R|/x|"]; + 17 [label="Function call: R|kotlin/requireNotNull|(...)"]; subgraph cluster_5 { color=blue - 17 [label="Enter contract"]; - 18 [label="Access variable R|/x|"]; - 19 [label="Const: Null(null)"]; - 20 [label="Equality operator !="]; - 21 [label="Exit contract"]; + 18 [label="Enter contract"]; + 19 [label="Access variable R|/x|"]; + 20 [label="Const: Null(null)"]; + 21 [label="Equality operator !="]; + 22 [label="Exit contract"]; } - 22 [label="Access variable R|/x|"]; - 23 [label="Access variable R|kotlin/String.length|"]; - 24 [label="Exit block"]; + 23 [label="Access variable R|/x|"]; + 24 [label="Smart cast: R|/x|"]; + 25 [label="Access variable R|kotlin/String.length|"]; + 26 [label="Exit block"]; } - 25 [label="Exit function test_2" style="filled" fillcolor=red]; + 27 [label="Exit function test_2" style="filled" fillcolor=red]; } - 13 -> {14}; 14 -> {15}; 15 -> {16}; 16 -> {17}; @@ -72,33 +74,34 @@ digraph conditionalEffects_kt { 22 -> {23}; 23 -> {24}; 24 -> {25}; + 25 -> {26}; + 26 -> {27}; subgraph cluster_6 { color=red - 26 [label="Enter function test_3" style="filled" fillcolor=red]; + 28 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_7 { color=blue - 27 [label="Enter block"]; - 28 [label="Access variable R|/x|"]; - 29 [label="Const: Null(null)"]; - 30 [label="Equality operator !="]; - 31 [label="Function call: R|kotlin/require|(...)"]; + 29 [label="Enter block"]; + 30 [label="Access variable R|/x|"]; + 31 [label="Const: Null(null)"]; + 32 [label="Equality operator !="]; + 33 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_8 { color=blue - 32 [label="Enter contract"]; - 33 [label="Access variable R|/x|"]; - 34 [label="Const: Null(null)"]; - 35 [label="Equality operator !="]; - 36 [label="Exit contract"]; + 34 [label="Enter contract"]; + 35 [label="Access variable R|/x|"]; + 36 [label="Const: Null(null)"]; + 37 [label="Equality operator !="]; + 38 [label="Exit contract"]; } - 37 [label="Access variable R|/x|"]; - 38 [label="Access variable R|kotlin/String.length|"]; - 39 [label="Exit block"]; + 39 [label="Access variable R|/x|"]; + 40 [label="Smart cast: R|/x|"]; + 41 [label="Access variable R|kotlin/String.length|"]; + 42 [label="Exit block"]; } - 40 [label="Exit function test_3" style="filled" fillcolor=red]; + 43 [label="Exit function test_3" style="filled" fillcolor=red]; } - 26 -> {27}; - 27 -> {28}; 28 -> {29}; 29 -> {30}; 30 -> {31}; @@ -111,60 +114,62 @@ digraph conditionalEffects_kt { 37 -> {38}; 38 -> {39}; 39 -> {40}; + 40 -> {41}; + 41 -> {42}; + 42 -> {43}; subgraph cluster_9 { color=red - 41 [label="Enter function test_4" style="filled" fillcolor=red]; + 44 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_10 { color=blue - 42 [label="Enter block"]; + 45 [label="Enter block"]; subgraph cluster_11 { color=blue - 43 [label="Enter &&"]; - 44 [label="Access variable R|/x|"]; - 45 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 46 [label="Exit left part of &&"]; - 47 [label="Enter right part of &&"]; - 48 [label="Access variable R|/y|"]; - 49 [label="Const: Null(null)"]; - 50 [label="Equality operator !="]; - 51 [label="Exit &&"]; + 46 [label="Enter &&"]; + 47 [label="Access variable R|/x|"]; + 48 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 49 [label="Exit left part of &&"]; + 50 [label="Enter right part of &&"]; + 51 [label="Access variable R|/y|"]; + 52 [label="Const: Null(null)"]; + 53 [label="Equality operator !="]; + 54 [label="Exit &&"]; } - 52 [label="Function call: R|kotlin/require|(...)"]; + 55 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_12 { color=blue - 53 [label="Enter contract"]; + 56 [label="Enter contract"]; subgraph cluster_13 { color=blue - 54 [label="Enter &&"]; - 55 [label="Access variable R|/x|"]; - 56 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 57 [label="Exit left part of &&"]; - 58 [label="Enter right part of &&"]; - 59 [label="Access variable R|/y|"]; - 60 [label="Const: Null(null)"]; - 61 [label="Equality operator !="]; - 62 [label="Exit &&"]; + 57 [label="Enter &&"]; + 58 [label="Access variable R|/x|"]; + 59 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 60 [label="Exit left part of &&"]; + 61 [label="Enter right part of &&"]; + 62 [label="Access variable R|/y|"]; + 63 [label="Const: Null(null)"]; + 64 [label="Equality operator !="]; + 65 [label="Exit &&"]; } - 63 [label="Exit contract"]; + 66 [label="Exit contract"]; } - 64 [label="Access variable R|/x|"]; - 65 [label="Access variable R|kotlin/String.length|"]; - 66 [label="Access variable R|/y|"]; - 67 [label="Access variable R|kotlin/String.length|"]; - 68 [label="Exit block"]; + 67 [label="Access variable R|/x|"]; + 68 [label="Smart cast: R|/x|"]; + 69 [label="Access variable R|kotlin/String.length|"]; + 70 [label="Access variable R|/y|"]; + 71 [label="Smart cast: R|/y|"]; + 72 [label="Access variable R|kotlin/String.length|"]; + 73 [label="Exit block"]; } - 69 [label="Exit function test_4" style="filled" fillcolor=red]; + 74 [label="Exit function test_4" style="filled" fillcolor=red]; } - 41 -> {42}; - 42 -> {43}; - 43 -> {44}; 44 -> {45}; 45 -> {46}; - 46 -> {51 47}; + 46 -> {47}; 47 -> {48}; 48 -> {49}; - 49 -> {50}; + 49 -> {54 50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; @@ -172,10 +177,10 @@ digraph conditionalEffects_kt { 54 -> {55}; 55 -> {56}; 56 -> {57}; - 57 -> {62 58}; + 57 -> {58}; 58 -> {59}; 59 -> {60}; - 60 -> {61}; + 60 -> {65 61}; 61 -> {62}; 62 -> {63}; 63 -> {64}; @@ -184,82 +189,83 @@ digraph conditionalEffects_kt { 66 -> {67}; 67 -> {68}; 68 -> {69}; - - subgraph cluster_14 { - color=red - 70 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_15 { - color=blue - 71 [label="Enter block"]; - subgraph cluster_16 { - color=blue - 72 [label="Enter when"]; - subgraph cluster_17 { - color=blue - 73 [label="Enter when branch condition "]; - 74 [label="Access variable R|/b|"]; - 75 [label="Exit when branch condition"]; - } - subgraph cluster_18 { - color=blue - 76 [label="Enter when branch condition else"]; - 77 [label="Exit when branch condition"]; - } - 78 [label="Enter when branch result"]; - subgraph cluster_19 { - color=blue - 79 [label="Enter block"]; - 80 [label="Access variable R|/x|"]; - 81 [label="Access variable #"]; - 82 [label="Exit block"]; - } - 83 [label="Exit when branch result"]; - 84 [label="Enter when branch result"]; - subgraph cluster_20 { - color=blue - 85 [label="Enter block"]; - 86 [label="Access variable R|/x|"]; - 87 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 88 [label="Function call: R|kotlin/require|(...)"]; - subgraph cluster_21 { - color=blue - 89 [label="Enter contract"]; - 90 [label="Access variable R|/x|"]; - 91 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 92 [label="Exit contract"]; - } - 93 [label="Access variable R|/x|"]; - 94 [label="Access variable R|kotlin/String.length|"]; - 95 [label="Exit block"]; - } - 96 [label="Exit when branch result"]; - 97 [label="Exit when"]; - } - 98 [label="Access variable R|/x|"]; - 99 [label="Access variable #"]; - 100 [label="Exit block"]; - } - 101 [label="Exit function test_5" style="filled" fillcolor=red]; - } + 69 -> {70}; 70 -> {71}; 71 -> {72}; 72 -> {73}; 73 -> {74}; - 74 -> {75}; - 75 -> {84 76}; + + subgraph cluster_14 { + color=red + 75 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_15 { + color=blue + 76 [label="Enter block"]; + subgraph cluster_16 { + color=blue + 77 [label="Enter when"]; + subgraph cluster_17 { + color=blue + 78 [label="Enter when branch condition "]; + 79 [label="Access variable R|/b|"]; + 80 [label="Exit when branch condition"]; + } + subgraph cluster_18 { + color=blue + 81 [label="Enter when branch condition else"]; + 82 [label="Exit when branch condition"]; + } + 83 [label="Enter when branch result"]; + subgraph cluster_19 { + color=blue + 84 [label="Enter block"]; + 85 [label="Access variable R|/x|"]; + 86 [label="Access variable #"]; + 87 [label="Exit block"]; + } + 88 [label="Exit when branch result"]; + 89 [label="Enter when branch result"]; + subgraph cluster_20 { + color=blue + 90 [label="Enter block"]; + 91 [label="Access variable R|/x|"]; + 92 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 93 [label="Function call: R|kotlin/require|(...)"]; + subgraph cluster_21 { + color=blue + 94 [label="Enter contract"]; + 95 [label="Access variable R|/x|"]; + 96 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 97 [label="Exit contract"]; + } + 98 [label="Access variable R|/x|"]; + 99 [label="Smart cast: R|/x|"]; + 100 [label="Access variable R|kotlin/String.length|"]; + 101 [label="Exit block"]; + } + 102 [label="Exit when branch result"]; + 103 [label="Exit when"]; + } + 104 [label="Access variable R|/x|"]; + 105 [label="Access variable #"]; + 106 [label="Exit block"]; + } + 107 [label="Exit function test_5" style="filled" fillcolor=red]; + } + 75 -> {76}; 76 -> {77}; 77 -> {78}; 78 -> {79}; 79 -> {80}; - 80 -> {81}; + 80 -> {89 81}; 81 -> {82}; 82 -> {83}; - 83 -> {97}; + 83 -> {84}; 84 -> {85}; 85 -> {86}; 86 -> {87}; 87 -> {88}; - 88 -> {89}; + 88 -> {103}; 89 -> {90}; 90 -> {91}; 91 -> {92}; @@ -272,85 +278,88 @@ digraph conditionalEffects_kt { 98 -> {99}; 99 -> {100}; 100 -> {101}; - - subgraph cluster_22 { - color=red - 102 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_23 { - color=blue - 103 [label="Enter block"]; - subgraph cluster_24 { - color=blue - 104 [label="Enter when"]; - subgraph cluster_25 { - color=blue - 105 [label="Enter when branch condition "]; - 106 [label="Access variable R|/b|"]; - 107 [label="Exit when branch condition"]; - } - subgraph cluster_26 { - color=blue - 108 [label="Enter when branch condition else"]; - 109 [label="Exit when branch condition"]; - } - 110 [label="Enter when branch result"]; - subgraph cluster_27 { - color=blue - 111 [label="Enter block"]; - 112 [label="Access variable R|/x|"]; - 113 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 114 [label="Function call: R|kotlin/require|(...)"]; - subgraph cluster_28 { - color=blue - 115 [label="Enter contract"]; - 116 [label="Access variable R|/x|"]; - 117 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 118 [label="Exit contract"]; - } - 119 [label="Access variable R|/x|"]; - 120 [label="Access variable R|kotlin/String.length|"]; - 121 [label="Exit block"]; - } - 122 [label="Exit when branch result"]; - 123 [label="Enter when branch result"]; - subgraph cluster_29 { - color=blue - 124 [label="Enter block"]; - 125 [label="Access variable R|/x|"]; - 126 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 127 [label="Function call: R|kotlin/require|(...)"]; - subgraph cluster_30 { - color=blue - 128 [label="Enter contract"]; - 129 [label="Access variable R|/x|"]; - 130 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 131 [label="Exit contract"]; - } - 132 [label="Access variable R|/x|"]; - 133 [label="Access variable R|kotlin/String.length|"]; - 134 [label="Exit block"]; - } - 135 [label="Exit when branch result"]; - 136 [label="Exit when"]; - } - 137 [label="Access variable R|/x|"]; - 138 [label="Access variable R|kotlin/String.length|"]; - 139 [label="Exit block"]; - } - 140 [label="Exit function test_6" style="filled" fillcolor=red]; - } + 101 -> {102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; 106 -> {107}; - 107 -> {123 108}; + + subgraph cluster_22 { + color=red + 108 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_23 { + color=blue + 109 [label="Enter block"]; + subgraph cluster_24 { + color=blue + 110 [label="Enter when"]; + subgraph cluster_25 { + color=blue + 111 [label="Enter when branch condition "]; + 112 [label="Access variable R|/b|"]; + 113 [label="Exit when branch condition"]; + } + subgraph cluster_26 { + color=blue + 114 [label="Enter when branch condition else"]; + 115 [label="Exit when branch condition"]; + } + 116 [label="Enter when branch result"]; + subgraph cluster_27 { + color=blue + 117 [label="Enter block"]; + 118 [label="Access variable R|/x|"]; + 119 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 120 [label="Function call: R|kotlin/require|(...)"]; + subgraph cluster_28 { + color=blue + 121 [label="Enter contract"]; + 122 [label="Access variable R|/x|"]; + 123 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 124 [label="Exit contract"]; + } + 125 [label="Access variable R|/x|"]; + 126 [label="Smart cast: R|/x|"]; + 127 [label="Access variable R|kotlin/String.length|"]; + 128 [label="Exit block"]; + } + 129 [label="Exit when branch result"]; + 130 [label="Enter when branch result"]; + subgraph cluster_29 { + color=blue + 131 [label="Enter block"]; + 132 [label="Access variable R|/x|"]; + 133 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 134 [label="Function call: R|kotlin/require|(...)"]; + subgraph cluster_30 { + color=blue + 135 [label="Enter contract"]; + 136 [label="Access variable R|/x|"]; + 137 [label="Type operator: (R|/x| is R|kotlin/String|)"]; + 138 [label="Exit contract"]; + } + 139 [label="Access variable R|/x|"]; + 140 [label="Smart cast: R|/x|"]; + 141 [label="Access variable R|kotlin/String.length|"]; + 142 [label="Exit block"]; + } + 143 [label="Exit when branch result"]; + 144 [label="Exit when"]; + } + 145 [label="Access variable R|/x|"]; + 146 [label="Smart cast: R|/x|"]; + 147 [label="Access variable R|kotlin/String.length|"]; + 148 [label="Exit block"]; + } + 149 [label="Exit function test_6" style="filled" fillcolor=red]; + } 108 -> {109}; 109 -> {110}; 110 -> {111}; 111 -> {112}; 112 -> {113}; - 113 -> {114}; + 113 -> {130 114}; 114 -> {115}; 115 -> {116}; 116 -> {117}; @@ -359,14 +368,14 @@ digraph conditionalEffects_kt { 119 -> {120}; 120 -> {121}; 121 -> {122}; - 122 -> {136}; + 122 -> {123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {130}; + 129 -> {144}; 130 -> {131}; 131 -> {132}; 132 -> {133}; @@ -377,5 +386,14 @@ digraph conditionalEffects_kt { 137 -> {138}; 138 -> {139}; 139 -> {140}; + 140 -> {141}; + 141 -> {142}; + 142 -> {143}; + 143 -> {144}; + 144 -> {145}; + 145 -> {146}; + 146 -> {147}; + 147 -> {148}; + 148 -> {149}; } diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java index 6c352a35bee..e701aa9bbb8 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java @@ -4111,6 +4111,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { public void testSafeCalls() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt"); } + + @Test + @TestMetadata("unstableSmartCastOnSafeCallArgument.kt") + public void testUnstableSmartCastOnSafeCallArgument() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.kt"); + } } @Nested diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java index f68b1249670..ca46784d138 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java @@ -4111,6 +4111,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos public void testSafeCalls() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt"); } + + @Test + @TestMetadata("unstableSmartCastOnSafeCallArgument.kt") + public void testUnstableSmartCastOnSafeCallArgument() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/unstableSmartCastOnSafeCallArgument.kt"); + } } @Nested diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt index 6e0795f3b40..9b2c0954b88 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirDestructuringDeclarationChecker.kt @@ -178,7 +178,7 @@ object FirDestructuringDeclarationChecker : FirPropertyChecker() { private val FirExpression.unwrapped: FirExpression get() = when (this) { - is FirExpressionWithSmartcast -> this.originalExpression + is FirSmartCastExpression -> this.originalExpression is FirWrappedExpression -> this.expression else -> this } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt index e6d3d94201f..a241b0219b2 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineDeclarationChecker.kt @@ -114,7 +114,7 @@ abstract class FirInlineDeclarationChecker : FirFunctionChecker() { } // prevent delegation to visitQualifiedAccessExpression, which causes redundant diagnostics - override fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: CheckerContext) {} + override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: CheckerContext) {} override fun visitVariableAssignment(variableAssignment: FirVariableAssignment, data: CheckerContext) { val propertySymbol = variableAssignment.calleeReference.toResolvedCallableSymbol() as? FirPropertySymbol ?: return diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirCastOperatorsChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirCastOperatorsChecker.kt index f6bbf6277d2..2456e002029 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirCastOperatorsChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirCastOperatorsChecker.kt @@ -13,9 +13,9 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.isCastErased import org.jetbrains.kotlin.fir.analysis.checkers.checkCasting import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast import org.jetbrains.kotlin.fir.expressions.FirOperation import org.jetbrains.kotlin.fir.expressions.FirTypeOperatorCall +import org.jetbrains.kotlin.fir.resolve.dfa.unwrapSmartcastExpression import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.types.coneType @@ -23,11 +23,7 @@ object FirCastOperatorsChecker : FirTypeOperatorCallChecker() { override fun check(expression: FirTypeOperatorCall, context: CheckerContext, reporter: DiagnosticReporter) { val session = context.session val firstArgument = expression.argumentList.arguments[0] - val actualType = (if (firstArgument is FirExpressionWithSmartcast) { - firstArgument.originalType.coneType - } else { - firstArgument.typeRef.coneType - }).fullyExpandedType(session) + val actualType = (firstArgument.unwrapSmartcastExpression().typeRef.coneType).fullyExpandedType(session) val conversionTypeRef = expression.conversionTypeRef val targetType = conversionTypeRef.coneType.fullyExpandedType(session) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirConventionFunctionCallChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirConventionFunctionCallChecker.kt index 46ab62d94d9..15a7d825103 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirConventionFunctionCallChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirConventionFunctionCallChecker.kt @@ -12,10 +12,10 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.expressions.FirPropertyAccessExpression import org.jetbrains.kotlin.fir.references.FirErrorNamedReference +import org.jetbrains.kotlin.fir.resolve.dfa.unwrapSmartcastExpression import org.jetbrains.kotlin.fir.resolve.diagnostics.ConePropertyAsOperator import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError import org.jetbrains.kotlin.util.OperatorNameConventions @@ -48,10 +48,7 @@ object FirConventionFunctionCallChecker : FirFunctionCallChecker() { sourceKind !is KtFakeSourceElementKind.GeneratedComparisonExpression && sourceKind !is KtFakeSourceElementKind.DesugaredCompoundAssignment ) return - val unwrapped = when (receiver) { - is FirExpressionWithSmartcast -> receiver.originalExpression - else -> receiver - } + val unwrapped = receiver.unwrapSmartcastExpression() if (unwrapped !is FirPropertyAccessExpression) return val diagnostic = unwrapped.nonFatalDiagnostics.firstIsInstanceOrNull() ?: return reporter.reportOn(callExpression.calleeReference.source, FirErrors.PROPERTY_AS_OPERATOR, diagnostic.symbol, context) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirFunctionReturnTypeMismatchChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirFunctionReturnTypeMismatchChecker.kt index 62019fe7b1d..5ce81e80729 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirFunctionReturnTypeMismatchChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirFunctionReturnTypeMismatchChecker.kt @@ -16,10 +16,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SMARTCAST_IMPOSSI import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction import org.jetbrains.kotlin.fir.declarations.FirConstructor import org.jetbrains.kotlin.fir.declarations.FirErrorFunction -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirReturnExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenExpression -import org.jetbrains.kotlin.fir.expressions.isExhaustive +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.types.* object FirFunctionReturnTypeMismatchChecker : FirReturnExpressionChecker() { @@ -53,7 +50,7 @@ object FirFunctionReturnTypeMismatchChecker : FirReturnExpressionChecker() { } else { val isDueToNullability = context.session.typeContext.isTypeMismatchDueToNullability(returnExpressionType, functionReturnType) - if (resultExpression is FirExpressionWithSmartcast && !resultExpression.isStable && + if (resultExpression is FirSmartCastExpression && !resultExpression.isStable && isSubtypeForTypeMismatch(typeContext, subtype = resultExpression.smartcastType.coneType, supertype = functionReturnType) ) { reporter.reportOn( diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirReassignmentAndInvisibleSetterChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirReassignmentAndInvisibleSetterChecker.kt index 9224eea46b8..af382b49d8c 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirReassignmentAndInvisibleSetterChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirReassignmentAndInvisibleSetterChecker.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClassSymbol import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor import org.jetbrains.kotlin.fir.declarations.utils.visibility -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol import org.jetbrains.kotlin.fir.originalForSubstitutionOverride @@ -58,8 +58,8 @@ object FirReassignmentAndInvisibleSetterChecker : FirVariableAssignmentChecker() if (callableSymbol is FirPropertySymbol && shouldInvisibleSetterBeReported(callableSymbol)) { val explicitReceiver = expression.explicitReceiver // Try to get type from smartcast - if (explicitReceiver is FirExpressionWithSmartcast) { - val symbol = explicitReceiver.originalType.toRegularClassSymbol(context.session) + if (explicitReceiver is FirSmartCastExpression) { + val symbol = explicitReceiver.originalExpression.typeRef.toRegularClassSymbol(context.session) if (symbol != null) { for (declarationSymbol in symbol.declarationSymbols) { if (declarationSymbol is FirPropertySymbol && declarationSymbol.name == callableSymbol.name) { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirWhenConditionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirWhenConditionChecker.kt index 3f5a3888155..f0a16caf65d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirWhenConditionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirWhenConditionChecker.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition +import org.jetbrains.kotlin.fir.resolve.dfa.unwrapSmartcastExpression import org.jetbrains.kotlin.fir.symbols.impl.FirEnumEntrySymbol import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.coneType @@ -38,7 +39,7 @@ object FirWhenConditionChecker : FirWhenExpressionChecker() { when (val condition = branch.condition) { is FirEqualityOperatorCall -> { val arguments = condition.arguments - if (arguments.size == 2 && arguments[0] is FirWhenSubjectExpression) { + if (arguments.size == 2 && arguments[0].unwrapSmartcastExpression() is FirWhenSubjectExpression) { val value = when (val targetExpression = arguments[1]) { is FirConstExpression<*> -> targetExpression.value is FirQualifiedAccessExpression -> targetExpression.calleeReference.toResolvedCallableSymbol() as? FirEnumEntrySymbol diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index 20de96eee53..5f5904b29b6 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -215,10 +215,6 @@ private fun FirCallableSymbol<*>.toSymbolForCall( isDelegate: Boolean = false ): IrSymbol? { val dispatchReceiverLookupTag = when { - dispatchReceiver is FirExpressionWithSmartcastToNothing && dispatchReceiver.smartcastType.coneType is ConeDynamicType -> { - val coneType = dispatchReceiver.smartcastTypeWithoutNullableNothing.coneType - coneType.findClassRepresentation(coneType, declarationStorage.session) - } dispatchReceiver is FirNoReceiverExpression -> { val containingClass = containingClass() if (containingClass != null && containingClass.classId != StandardClassIds.Any) { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt index e1ae0a61963..31c921dd6ac 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt @@ -263,41 +263,15 @@ class Fir2IrImplicitCastInserter( return this } - override fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: IrElement): IrExpression { - return if (expressionWithSmartcast.isStable) { - implicitCastOrExpression(data as IrExpression, expressionWithSmartcast.typeRef) + override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: IrElement): IrElement { + // We don't want an implicit cast to Nothing?. This expression just encompasses nullability after null check. + return if (smartCastExpression.isStable && smartCastExpression.smartcastTypeWithoutNullableNothing == null) { + implicitCastOrExpression(data as IrExpression, smartCastExpression.typeRef) } else { data as IrExpression } } - override fun visitExpressionWithSmartcastToNothing( - expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing, - data: IrElement - ): IrElement { - // We don't want an implicit cast to Nothing?. This expression just encompasses nullability after null check. - return data - } - - override fun visitWhenSubjectExpressionWithSmartcast( - whenSubjectExpressionWithSmartcast: FirWhenSubjectExpressionWithSmartcast, - data: IrElement - ): IrElement { - return if (whenSubjectExpressionWithSmartcast.isStable) { - implicitCastOrExpression(data as IrExpression, whenSubjectExpressionWithSmartcast.typeRef) - } else { - data as IrExpression - } - } - - override fun visitWhenSubjectExpressionWithSmartcastToNothing( - whenSubjectExpressionWithSmartcastToNothing: FirWhenSubjectExpressionWithSmartcastToNothing, - data: IrElement - ): IrElement { - // We don't want an implicit cast to Nothing?. This expression just encompasses nullability after null check. - return data - } - internal fun implicitCastFromDispatchReceiver( original: IrExpression, originalTypeRef: FirTypeRef, diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 107e6bdc6e3..c605bd5d493 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -554,34 +554,10 @@ class Fir2IrVisitor( return visitQualifiedAccessExpression(thisReceiverExpression, data) } - override fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: Any?): IrElement { + override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: Any?): IrElement { // Generate the expression with the original type and then cast it to the smart cast type. - val value = convertToIrExpression(expressionWithSmartcast.originalExpression) - return implicitCastInserter.visitExpressionWithSmartcast(expressionWithSmartcast, value) - } - - override fun visitExpressionWithSmartcastToNothing( - expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing, - data: Any? - ): IrElement { - // This should not be materialized. Generate the expression with the original expression. - return convertToIrExpression(expressionWithSmartcastToNothing.originalExpression) - } - - override fun visitWhenSubjectExpressionWithSmartcast( - whenSubjectExpressionWithSmartcast: FirWhenSubjectExpressionWithSmartcast, - data: Any? - ): IrElement { - val value = visitWhenSubjectExpression(whenSubjectExpressionWithSmartcast.originalExpression, data) - return implicitCastInserter.visitWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast, value) - } - - override fun visitWhenSubjectExpressionWithSmartcastToNothing( - whenSubjectExpressionWithSmartcastToNothing: FirWhenSubjectExpressionWithSmartcastToNothing, - data: Any? - ): IrElement { - // This should not be materialized. Generate the expression with the original expression. - return visitWhenSubjectExpression(whenSubjectExpressionWithSmartcastToNothing.originalExpression, data) + val value = convertToIrExpression(smartCastExpression.originalExpression) + return implicitCastInserter.visitSmartCastExpression(smartCastExpression, value) } override fun visitCallableReferenceAccess(callableReferenceAccess: FirCallableReferenceAccess, data: Any?): IrElement { @@ -663,7 +639,7 @@ class Fir2IrVisitor( return when (expression) { null -> return null is FirResolvedQualifier -> callGenerator.convertToGetObject(expression, callableReferenceAccess) - is FirFunctionCall, is FirThisReceiverExpression, is FirCallableReferenceAccess, is FirExpressionWithSmartcast -> + is FirFunctionCall, is FirThisReceiverExpression, is FirCallableReferenceAccess, is FirSmartCastExpression -> convertToIrExpression(expression) else -> if (expression is FirQualifiedAccessExpression && expression.explicitReceiver == null) { val variableAsFunctionMode = calleeReference is FirResolvedNamedReference && diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index 6743a913195..56b7c8ad5ab 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.references.impl.FirReferencePlaceholderForResolvedAnnotations import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticFunctionSymbol +import org.jetbrains.kotlin.fir.resolve.dfa.unwrapSmartcastExpression import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutorByMap @@ -260,8 +261,9 @@ class CallAndReferenceGenerator( // However, FE 1.0 does it, and currently we have no better way to provide these receivers. // See KT-49507 and KT-48954 as good examples for cases we try to handle here private fun FirExpression.superQualifierSymbolForField(fieldSymbol: IrFieldSymbol): IrClassSymbol? { - if (this !is FirQualifiedAccess) return null - if (calleeReference is FirSuperReference) return superQualifierSymbol() + val unwrapped = this.unwrapSmartcastExpression() + if (unwrapped !is FirQualifiedAccess) return null + if (unwrapped.calleeReference is FirSuperReference) return superQualifierSymbol() if (fieldSymbol.owner.correspondingPropertySymbol != null) return null val originalContainingClass = fieldSymbol.owner.parentClassOrNull ?: return null val ownContainingClass = typeRef.toIrType().classifierOrNull?.owner as? IrClass ?: return null diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/OperatorExpressionGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/OperatorExpressionGenerator.kt index 73620a3708e..5bae0560c1a 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/OperatorExpressionGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/OperatorExpressionGenerator.kt @@ -238,7 +238,7 @@ internal class OperatorExpressionGenerator( comparisonInfo: PrimitiveConeNumericComparisonInfo?, isLeftType: Boolean ): IrExpression { - val isOriginalNullable = (this as? FirExpressionWithSmartcast)?.originalExpression?.typeRef?.isMarkedNullable ?: false + val isOriginalNullable = (this as? FirSmartCastExpression)?.originalExpression?.typeRef?.isMarkedNullable ?: false val irExpression = visitor.convertToIrExpression(this) val operandType = if (isLeftType) comparisonInfo?.leftType else comparisonInfo?.rightType val targetType = comparisonInfo?.comparisonType diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java index 0296f20cea3..06e62776566 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java @@ -2596,12 +2596,6 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt"); } - @Test - @TestMetadata("JCTree.kt") - public void testJCTree() throws Exception { - runTest("compiler/testData/ir/irText/firProblems/JCTree.kt"); - } - @Test @TestMetadata("kt19251.kt") public void testKt19251() throws Exception { @@ -2638,6 +2632,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/MultiList.kt"); } + @Test + @TestMetadata("OutBox.kt") + public void testOutBox() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/OutBox.kt"); + } + @Test @TestMetadata("putIfAbsent.kt") public void testPutIfAbsent() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/LightTreeFir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/LightTreeFir2IrTextTestGenerated.java index cfb85945a13..33b090adb2f 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/LightTreeFir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/LightTreeFir2IrTextTestGenerated.java @@ -2596,12 +2596,6 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt"); } - @Test - @TestMetadata("JCTree.kt") - public void testJCTree() throws Exception { - runTest("compiler/testData/ir/irText/firProblems/JCTree.kt"); - } - @Test @TestMetadata("kt19251.kt") public void testKt19251() throws Exception { @@ -2638,6 +2632,12 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex runTest("compiler/testData/ir/irText/firProblems/MultiList.kt"); } + @Test + @TestMetadata("OutBox.kt") + public void testOutBox() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/OutBox.kt"); + } + @Test @TestMetadata("putIfAbsent.kt") public void testPutIfAbsent() throws Exception { diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt index 98c68201548..6dd5edcc980 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/ScopeUtils.kt @@ -8,8 +8,7 @@ package org.jetbrains.kotlin.fir.resolve import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap import org.jetbrains.kotlin.fir.scopes.FakeOverrideTypeCalculator import org.jetbrains.kotlin.fir.scopes.FirTypeScope @@ -25,17 +24,16 @@ import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl import org.jetbrains.kotlin.name.ClassId -fun FirExpressionWithSmartcast.smartcastScope( +fun FirSmartCastExpression.smartcastScope( useSiteSession: FirSession, scopeSession: ScopeSession ): FirTypeScope? { - val smartcastType = - if (this is FirExpressionWithSmartcastToNothing) smartcastTypeWithoutNullableNothing.coneType else smartcastType.coneType + val smartcastType = smartcastTypeWithoutNullableNothing?.coneType ?: smartcastType.coneType val smartcastScope = smartcastType.scope(useSiteSession, scopeSession, FakeOverrideTypeCalculator.DoNothing) if (isStable) { return smartcastScope } - val originalScope = originalType.coneType.scope(useSiteSession, scopeSession, FakeOverrideTypeCalculator.DoNothing) + val originalScope = originalExpression.typeRef.coneType.scope(useSiteSession, scopeSession, FakeOverrideTypeCalculator.DoNothing) ?: return smartcastScope if (smartcastScope == null) { diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt index 96ecf695386..5751c41b7ee 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt @@ -5,10 +5,13 @@ package org.jetbrains.kotlin.fir.resolve.calls +import org.jetbrains.kotlin.KtFakeSourceElementKind +import org.jetbrains.kotlin.fakeElement import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.copyWithNewSourceKind import org.jetbrains.kotlin.fir.diagnostics.ConeIntermediateDiagnostic import org.jetbrains.kotlin.fir.expressions.* -import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionWithSmartcast +import org.jetbrains.kotlin.fir.expressions.builder.buildSmartCastExpression import org.jetbrains.kotlin.fir.expressions.builder.buildThisReceiverExpression import org.jetbrains.kotlin.fir.references.builder.buildImplicitThisReference import org.jetbrains.kotlin.fir.renderWithType @@ -66,7 +69,7 @@ open class ExpressionReceiverValue( if (receiverExpr is FirCheckNotNullCall) { receiverExpr = receiverExpr.arguments.firstOrNull() } - if (receiverExpr is FirExpressionWithSmartcast) { + if (receiverExpr is FirSmartCastExpression) { return receiverExpr.smartcastScope(useSiteSession, scopeSession) } return type.scope(useSiteSession, scopeSession, FakeOverrideTypeCalculator.DoNothing) @@ -107,11 +110,16 @@ sealed class ImplicitReceiverValue>( receiverExpression = if (type == originalReceiverExpression.typeRef.coneType) { originalReceiverExpression } else { - buildExpressionWithSmartcast { + buildSmartCastExpression { originalExpression = originalReceiverExpression - smartcastType = originalReceiverExpression.typeRef.resolvedTypeFromPrototype(type) + this.source = originalExpression.source?.fakeElement(KtFakeSourceElementKind.SmartCastExpression) + smartcastType = buildResolvedTypeRef { + source = originalReceiverExpression.typeRef.source?.fakeElement(KtFakeSourceElementKind.SmartCastedTypeRef) + this.type = type + } typesFromSmartCast = listOf(type) smartcastStability = SmartcastStability.STABLE_VALUE + typeRef = smartcastType.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) } } implicitScope = type.scope(useSiteSession, scopeSession, FakeOverrideTypeCalculator.DoNothing) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index 93b1de1de66..0d0874b87f6 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -322,24 +322,24 @@ private fun BodyResolveComponents.typeFromSymbol(symbol: FirBasedSymbol<*>, make fun BodyResolveComponents.transformQualifiedAccessUsingSmartcastInfo( qualifiedAccessExpression: FirQualifiedAccessExpression -): FirQualifiedAccessExpression { +): FirExpression { + val (stability, typesFromSmartCast) = + dataFlowAnalyzer.getTypeUsingSmartcastInfo(qualifiedAccessExpression) + ?: return qualifiedAccessExpression val builder = transformExpressionUsingSmartcastInfo( qualifiedAccessExpression, - dataFlowAnalyzer::getTypeUsingSmartcastInfo, - ::FirExpressionWithSmartcastBuilder, - ::FirExpressionWithSmartcastToNothingBuilder + stability, typesFromSmartCast ) ?: return qualifiedAccessExpression return builder.build() } fun BodyResolveComponents.transformWhenSubjectExpressionUsingSmartcastInfo( whenSubjectExpression: FirWhenSubjectExpression -): FirWhenSubjectExpression { +): FirExpression { + val (stability, typesFromSmartCast) = dataFlowAnalyzer.getTypeUsingSmartcastInfo(whenSubjectExpression) ?: return whenSubjectExpression val builder = transformExpressionUsingSmartcastInfo( whenSubjectExpression, - dataFlowAnalyzer::getTypeUsingSmartcastInfo, - ::FirWhenSubjectExpressionWithSmartcastBuilder, - ::FirWhenSubjectExpressionWithSmartcastToNothingBuilder + stability, typesFromSmartCast ) ?: return whenSubjectExpression return builder.build() } @@ -347,13 +347,18 @@ fun BodyResolveComponents.transformWhenSubjectExpressionUsingSmartcastInfo( private val ConeKotlinType.isKindOfNothing get() = lowerBoundIfFlexible().let { it.isNothing || it.isNullableNothing } -private inline fun BodyResolveComponents.transformExpressionUsingSmartcastInfo( +private fun FirSmartCastExpressionBuilder.applyResultTypeRef() { + typeRef = + if (smartcastStability == SmartcastStability.STABLE_VALUE) + smartcastType.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) + else + originalExpression.typeRef.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) +} +private fun BodyResolveComponents.transformExpressionUsingSmartcastInfo( expression: T, - smartcastExtractor: (T) -> Pair>?, - smartcastBuilder: () -> FirWrappedExpressionWithSmartcastBuilder, - smartcastToNothingBuilder: () -> FirWrappedExpressionWithSmartcastToNothingBuilder -): FirWrappedExpressionWithSmartcastBuilder? { - val (stability, typesFromSmartCast) = smartcastExtractor(expression) ?: return null + stability: PropertyStability, + typesFromSmartCast: MutableList +): FirSmartCastExpressionBuilder? { val smartcastStability = stability.impliedSmartcastStability ?: if (dataFlowAnalyzer.isAccessToUnstableLocalVariable(expression)) { SmartcastStability.CAPTURED_VARIABLE @@ -395,20 +400,24 @@ private inline fun BodyResolveComponents.transformExpression annotations += expression.resultType.annotations delegatedTypeRef = expression.resultType } - return smartcastToNothingBuilder().apply { + return FirSmartCastExpressionBuilder().apply { originalExpression = expression + source = originalExpression.source?.fakeElement(KtFakeSourceElementKind.SmartCastExpression) smartcastType = intersectedTypeRef smartcastTypeWithoutNullableNothing = reducedIntersectedTypeRef this.typesFromSmartCast = typesFromSmartCast this.smartcastStability = smartcastStability + applyResultTypeRef() } } - return smartcastBuilder().apply { + return FirSmartCastExpressionBuilder().apply { originalExpression = expression + source = originalExpression.source?.fakeElement(KtFakeSourceElementKind.SmartCastExpression) smartcastType = intersectedTypeRef this.typesFromSmartCast = typesFromSmartCast this.smartcastStability = smartcastStability + applyResultTypeRef() } } @@ -419,7 +428,7 @@ fun FirCheckedSafeCallSubject.propagateTypeFromOriginalReceiver( ) { // If the receiver expression is smartcast to `null`, it would have `Nothing?` as its type, which may not have members called by user // code. Hence, we fallback to the type before intersecting with `Nothing?`. - val receiverType = ((nullableReceiverExpression as? FirExpressionWithSmartcastToNothing) + val receiverType = ((nullableReceiverExpression as? FirSmartCastExpression) ?.takeIf { it.isStable } ?.smartcastTypeWithoutNullableNothing ?: nullableReceiverExpression.typeRef) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index 6ddd4b1cc5c..77ac98b7084 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.lookupTracker import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.createFunctionalType +import org.jetbrains.kotlin.fir.resolve.dfa.unwrapSmartcastExpression import org.jetbrains.kotlin.fir.resolve.fullyExpandedType import org.jetbrains.kotlin.fir.resolve.inference.preprocessCallableReference import org.jetbrains.kotlin.fir.resolve.inference.preprocessLambdaArgument @@ -66,7 +67,7 @@ fun Candidate.resolveArgumentExpression( // and then add constraint: typeOf(`$not-null-receiver$.bar()`).makeNullable() <: EXPECTED_TYPE // NB: argument.regularQualifiedAccess is either a call or a qualified access is FirSafeCallExpression -> { - val nestedQualifier = argument.selector + val nestedQualifier = (argument.selector as? FirExpression)?.unwrapSmartcastExpression() if (nestedQualifier is FirQualifiedAccessExpression) { resolveSubCallArgument( csBuilder, @@ -403,7 +404,7 @@ private fun checkApplicabilityForArgumentType( } if (!csBuilder.addSubtypeConstraintIfCompatible(argumentType, expectedType, position)) { - val smartcastExpression = argument as? FirExpressionWithSmartcast + val smartcastExpression = argument as? FirSmartCastExpression if (smartcastExpression != null && !smartcastExpression.isStable) { val unstableType = smartcastExpression.smartcastType.coneType if (csBuilder.addSubtypeConstraintIfCompatible(unstableType, expectedType, position)) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt index bc38691625b..ff479451124 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt @@ -166,7 +166,7 @@ object CheckDispatchReceiver : ResolutionStage() { val smartcastedReceiver = when (explicitReceiverExpression) { is FirCheckNotNullCall -> explicitReceiverExpression.argument else -> explicitReceiverExpression - } as? FirExpressionWithSmartcast + } as? FirSmartCastExpression if (smartcastedReceiver != null && !smartcastedReceiver.isStable && @@ -184,7 +184,7 @@ object CheckDispatchReceiver : ResolutionStage() { UnstableSmartCast( smartcastedReceiver, targetType, - context.session.typeContext.isTypeMismatchDueToNullability(smartcastedReceiver.originalType.coneType, targetType) + context.session.typeContext.isTypeMismatchDueToNullability(smartcastedReceiver.originalExpression.typeRef.coneType, targetType) ) ) } else if (isReceiverNullable) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/VisibilityUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/VisibilityUtils.kt index 65776cd80f2..d7dccf43dab 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/VisibilityUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/VisibilityUtils.kt @@ -5,7 +5,9 @@ package org.jetbrains.kotlin.fir.resolve.calls +import org.jetbrains.kotlin.KtFakeSourceElementKind import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.fakeElement import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.declarations.FirBackingField import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration @@ -13,9 +15,10 @@ import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration import org.jetbrains.kotlin.fir.declarations.FirProperty import org.jetbrains.kotlin.fir.declarations.utils.getExplicitBackingField import org.jetbrains.kotlin.fir.declarations.utils.visibility -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment -import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionWithSmartcast +import org.jetbrains.kotlin.fir.expressions.builder.buildSmartCastExpression +import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.isNullableNothing import org.jetbrains.kotlin.fir.types.makeConeTypeDefinitelyNotNullOrNotNull @@ -78,12 +81,14 @@ fun FirVisibilityChecker.isVisible( private fun removeSmartCastTypeForAttemptToFitVisibility(dispatchReceiverValue: ReceiverValue?, session: FirSession): ReceiverValue? { val expressionWithSmartcastIfStable = - (dispatchReceiverValue?.receiverExpression as? FirExpressionWithSmartcast)?.takeIf { it.isStable } ?: return null + (dispatchReceiverValue?.receiverExpression as? FirSmartCastExpression)?.takeIf { it.isStable } ?: return null if (dispatchReceiverValue.type.isNullableNothing) return null + val originalExpression = expressionWithSmartcastIfStable.originalExpression + val originalType = originalExpression.typeRef.coneType val originalTypeNotNullable = - expressionWithSmartcastIfStable.originalType.coneType.makeConeTypeDefinitelyNotNullOrNotNull(session.typeContext) + originalType.makeConeTypeDefinitelyNotNullOrNotNull(session.typeContext) // Basically, this `if` is just for sake of optimizaton // We have only nullability enhancement, here, so return initial smart cast receiver value @@ -91,15 +96,19 @@ private fun removeSmartCastTypeForAttemptToFitVisibility(dispatchReceiverValue: val expressionForReceiver = with(session.typeContext) { when { - expressionWithSmartcastIfStable.originalType.coneType.isNullableType() && !dispatchReceiverValue.type.isNullableType() -> - buildExpressionWithSmartcast { - originalExpression = expressionWithSmartcastIfStable.originalExpression - smartcastType = - expressionWithSmartcastIfStable.originalExpression.typeRef.resolvedTypeFromPrototype(originalTypeNotNullable) + originalType.isNullableType() && !dispatchReceiverValue.type.isNullableType() -> + buildSmartCastExpression { + source = originalExpression.source?.fakeElement(KtFakeSourceElementKind.SmartCastExpression) + this.originalExpression = originalExpression + smartcastType = buildResolvedTypeRef { + source = originalExpression.typeRef.source?.fakeElement(KtFakeSourceElementKind.SmartCastedTypeRef) + type = originalTypeNotNullable + } typesFromSmartCast = listOf(originalTypeNotNullable) smartcastStability = expressionWithSmartcastIfStable.smartcastStability + typeRef = smartcastType.copyWithNewSourceKind(KtFakeSourceElementKind.ImplicitTypeRef) } - else -> expressionWithSmartcastIfStable.originalExpression + else -> originalExpression } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt index 5157def6c8f..21c605b4e1e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt @@ -318,7 +318,9 @@ private fun BodyResolveComponents.createExplicitReceiverForInvokeByCallable( if (candidate.currentApplicability == CandidateApplicability.K2_PROPERTY_AS_OPERATOR) { nonFatalDiagnostics.add(ConePropertyAsOperator(candidate.symbol as FirPropertySymbol)) } - }.build().let(::transformQualifiedAccessUsingSmartcastInfo) + }.build().let { + transformQualifiedAccessUsingSmartcastInfo(it) + } } private class InvokeReceiverResolveTask( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt index 75b008d2685..8d9c303d8be 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/TowerLevels.kt @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.fir.declarations.ContextReceiverGroup import org.jetbrains.kotlin.fir.declarations.FirConstructor import org.jetbrains.kotlin.fir.declarations.getAnnotationByClassId import org.jetbrains.kotlin.fir.declarations.utils.isInner -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.builder.buildResolvedQualifier import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.calls.* @@ -84,9 +84,9 @@ class MemberScopeTowerLevel( val scope = dispatchReceiverValue.scope(session, scopeSession) ?: return ProcessResult.SCOPE_EMPTY var (empty, candidates) = scope.collectCandidates(processScopeMembers) - val scopeWithoutSmartcast = (dispatchReceiverValue.receiverExpression as? FirExpressionWithSmartcast) + val scopeWithoutSmartcast = (dispatchReceiverValue.receiverExpression as? FirSmartCastExpression) ?.takeIf { it.isStable } - ?.originalType + ?.originalExpression?.typeRef ?.coneType ?.scope(session, scopeSession, bodyResolveComponents.returnTypeCalculator.fakeOverrideTypeCalculator) if (scopeWithoutSmartcast == null) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt index 3dbb39b4f40..bc4dd31022b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt @@ -168,6 +168,7 @@ abstract class FirDataFlowAnalyzer( fun isAccessToUnstableLocalVariable(expression: FirExpression): Boolean { val qualifiedAccessExpression = when (expression) { + is FirSmartCastExpression -> expression.originalExpression as FirQualifiedAccessExpression is FirQualifiedAccessExpression -> expression is FirWhenSubjectExpression -> { val whenExpression = expression.whenRef.value @@ -1002,6 +1003,10 @@ abstract class FirDataFlowAnalyzer( processConditionalContract(qualifiedAccessExpression) } + fun exitSmartCastExpression(smartCastExpression: FirSmartCastExpression) { + graphBuilder.exitSmartCastExpression(smartCastExpression).mergeIncomingFlow() + } + fun enterSafeCallAfterNullCheck(safeCall: FirSafeCallExpression) { val node = graphBuilder.enterSafeCall(safeCall).mergeIncomingFlow() val previousNode = node.firstPreviousNode @@ -1239,7 +1244,7 @@ abstract class FirDataFlowAnalyzer( logicSystem.recordNewAssignment(flow, propertyVariable, context.newAssignmentIndex()) } - variableStorage.getOrCreateRealVariable(flow, initializer.symbol, initializer) + variableStorage.getOrCreateRealVariable(flow, initializer.symbol, initializer.unwrapSmartcastExpression()) ?.let { initializerVariable -> val isInitializerStable = initializerVariable.isStable || (initializerVariable.hasLocalStability && initializer.isAccessToStableVariable()) @@ -1274,7 +1279,7 @@ abstract class FirDataFlowAnalyzer( } private fun FirExpression.isAccessToStableVariable(): Boolean = - this is FirQualifiedAccessExpression && !isAccessToUnstableLocalVariable(this) + !isAccessToUnstableLocalVariable(this) private val RealVariable.isStable get() = stability == PropertyStability.STABLE_VALUE private val RealVariable.hasLocalStability get() = stability == PropertyStability.LOCAL_VAR diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt index b0245b952ce..6f38ce31e15 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt @@ -1087,6 +1087,17 @@ class ControlFlowGraphBuilder { return node } + fun exitSmartCastExpression(smartCastExpression: FirSmartCastExpression): SmartCastExpressionExitNode { + val returnsNothing = smartCastExpression.resultType.isNothing + val node = createSmartCastExitNode(smartCastExpression) + if (returnsNothing) { + addNodeThatReturnsNothing(node) + } else { + addNewSimpleNode(node) + } + return node + } + fun exitResolvedQualifierNode(resolvedQualifier: FirResolvedQualifier): ResolvedQualifierNode { return createResolvedQualifierNode(resolvedQualifier).also(this::addNewSimpleNode) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt index edaaf6dbf8b..4bd74b59b2a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt @@ -264,3 +264,6 @@ fun ControlFlowGraphBuilder.createExitDefaultArgumentsNode(fir: FirValueParamete fun ControlFlowGraphBuilder.createComparisonExpressionNode(fir: FirComparisonExpression): ComparisonExpressionNode = ComparisonExpressionNode(currentGraph, fir, levelCounter, createId()) + +fun ControlFlowGraphBuilder.createSmartCastExitNode(fir: FirSmartCastExpression): SmartCastExpressionExitNode = + SmartCastExpressionExitNode(currentGraph, fir, levelCounter, createId()) \ No newline at end of file diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt index 4d49db0dd01..5f18e6a2888 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirCallCompletionResultsWriterTransformer.kt @@ -429,6 +429,10 @@ class FirCallCompletionResultsWriterTransformer( ) } + override fun transformSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: ExpectedArgumentType?): FirStatement { + return smartCastExpression.transformOriginalExpression(this, data) + } + private inner class TypeUpdaterForDelegateArguments : FirTransformer() { override fun transformElement(element: E, data: Any?): E { return element diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index 1ace3c265d0..e581eb37cef 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -160,9 +160,13 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform } when (result) { is FirQualifiedAccessExpression -> { + // TODO: Is it really needed? dataFlowAnalyzer.enterQualifiedAccessExpression() - result = components.transformQualifiedAccessUsingSmartcastInfo(result) dataFlowAnalyzer.exitQualifiedAccessExpression(result) + result = components.transformQualifiedAccessUsingSmartcastInfo(result) + if (result is FirSmartCastExpression) { + dataFlowAnalyzer.exitSmartCastExpression(result) + } } is FirResolvedQualifier -> { dataFlowAnalyzer.exitResolvedQualifierNode(result) @@ -375,7 +379,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform try { val initialExplicitReceiver = functionCall.explicitReceiver val resultExpression = callResolver.resolveCallAndSelectCandidate(functionCall) - val resultExplicitReceiver = resultExpression.explicitReceiver + val resultExplicitReceiver = resultExpression.explicitReceiver?.unwrapSmartcastExpression() if (initialExplicitReceiver !== resultExplicitReceiver && resultExplicitReceiver is FirQualifiedAccess) { // name.invoke() case callCompleter.completeCall(resultExplicitReceiver, noExpectedType) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt index 3ef19a8d5ed..c0f593a6084 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/ConeEffectExtractor.kt @@ -111,18 +111,8 @@ class ConeEffectExtractor( return ConeIsNullPredicate(arg, isNegated) } - override fun visitExpressionWithSmartcast( - expressionWithSmartcast: FirExpressionWithSmartcast, - data: Nothing? - ): ConeContractDescriptionElement? { - return expressionWithSmartcast.originalExpression.accept(this, data) - } - - override fun visitExpressionWithSmartcastToNothing( - expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing, - data: Nothing? - ): ConeContractDescriptionElement? { - return expressionWithSmartcastToNothing.originalExpression.accept(this, data) + override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: Nothing?): ConeContractDescriptionElement? { + return smartCastExpression.originalExpression.accept(this, data) } override fun visitQualifiedAccessExpression( diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt index 0be3983d5ce..bcd1192cec0 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt @@ -9,8 +9,8 @@ import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.fir.declarations.FirFunction import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.types.ConeKotlinType @@ -103,7 +103,7 @@ object LowerPriorityForDynamic : ResolutionDiagnostic(K2_SYNTHETIC_RESOLVED) object CandidateChosenUsingOverloadResolutionByLambdaAnnotation : ResolutionDiagnostic(RESOLVED) -class UnstableSmartCast(val argument: FirExpressionWithSmartcast, val targetType: ConeKotlinType, val isCastToNotNull: Boolean) : +class UnstableSmartCast(val argument: FirSmartCastExpression, val targetType: ConeKotlinType, val isCastToNotNull: Boolean) : ResolutionDiagnostic(UNSTABLE_SMARTCAST) class ArgumentTypeMismatch( diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorageImpl.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorageImpl.kt index 152fd7732d2..fb581a11db7 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorageImpl.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/VariableStorageImpl.kt @@ -62,7 +62,7 @@ class VariableStorageImpl(private val session: FirSession) : VariableStorage() { private fun FirElement.unwrapElement(): FirElement = when (this) { is FirWhenSubjectExpression -> whenRef.value.let { it.subjectVariable ?: it.subject }?.unwrapElement() ?: this - is FirExpressionWithSmartcast -> originalExpression.unwrapElement() + is FirSmartCastExpression -> originalExpression.unwrapElement() is FirSafeCallExpression -> selector.unwrapElement() is FirCheckedSafeCallSubject -> originalReceiverRef.value.unwrapElement() is FirCheckNotNullCall -> argument.unwrapElement() diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt index 99462469393..3e314bae804 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt @@ -857,3 +857,12 @@ object FirStub : FirElement { return this } } + + +// ----------------------------------- Smart-cast node ----------------------------------- + +class SmartCastExpressionExitNode(owner: ControlFlowGraph, override val fir: FirSmartCastExpression, level: Int, id: Int) : CFGNode(owner, level, id) { + override fun accept(visitor: ControlFlowGraphVisitor, data: D): R { + return visitor.visitSmartCastExpressionExitNode(this, data) + } +} \ No newline at end of file diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt index 44dd29f8a23..511b771e187 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt @@ -44,6 +44,7 @@ fun CFGNode<*>.render(): String = is ResolvedQualifierNode -> "Access qualifier ${fir.classId}" is ComparisonExpressionNode -> "Comparison ${fir.operation.operator}" is TypeOperatorCallNode -> "Type operator: \"${CfgRenderer.renderElementAsString(fir)}\"" + is SmartCastExpressionExitNode -> "Smart cast: \"${CfgRenderer.renderElementAsString(fir)}\"" is EqualityOperatorCallNode -> "Equality operator ${fir.operation.operator}" is JumpNode -> "Jump: ${fir.render()}" is StubNode -> "Stub" diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt index 511c784d8ab..7a778edd6fe 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt @@ -386,4 +386,8 @@ abstract class ControlFlowGraphVisitor { open fun visitAnnotationExitNode(node: AnnotationExitNode, data: D): R { return visitNode(node, data) } + + open fun visitSmartCastExpressionExitNode(node: SmartCastExpressionExitNode, data: D): R { + return visitNode(node, data) + } } diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/util.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/util.kt index 57826bceeee..093ce4943e0 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/util.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/dfa/util.kt @@ -99,6 +99,7 @@ val FirElement.symbol: FirBasedSymbol<*>? is FirDeclaration -> symbol is FirWhenSubjectExpression -> whenRef.value.subject?.symbol is FirSafeCallExpression -> selector.symbol + is FirSmartCastExpression -> originalExpression.symbol else -> null }?.takeIf { (this as? FirExpression)?.unwrapSmartcastExpression() is FirThisReceiverExpression || @@ -116,6 +117,6 @@ internal val FirResolvable.symbol: FirBasedSymbol<*>? fun FirExpression.unwrapSmartcastExpression(): FirExpression = when (this) { - is FirExpressionWithSmartcast -> originalExpression + is FirSmartCastExpression -> originalExpression else -> this } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcast.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcast.kt deleted file mode 100644 index 1928a104f44..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcast.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.references.FirReference -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirTypeProjection -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.types.SmartcastStability -import org.jetbrains.kotlin.fir.visitors.* -import org.jetbrains.kotlin.fir.FirImplementationDetail - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -abstract class FirExpressionWithSmartcast : FirQualifiedAccessExpression(), FirWrappedExpressionWithSmartcast { - abstract override val source: KtSourceElement? - abstract override val typeRef: FirTypeRef - abstract override val annotations: List - abstract override val calleeReference: FirReference - abstract override val contextReceiverArguments: List - abstract override val typeArguments: List - abstract override val explicitReceiver: FirExpression? - abstract override val dispatchReceiver: FirExpression - abstract override val extensionReceiver: FirExpression - abstract override val originalExpression: FirQualifiedAccessExpression - abstract override val typesFromSmartCast: Collection - abstract override val originalType: FirTypeRef - abstract override val smartcastType: FirTypeRef - abstract override val isStable: Boolean - abstract override val smartcastStability: SmartcastStability - - override fun accept(visitor: FirVisitor, data: D): R = visitor.visitExpressionWithSmartcast(this, data) - - @Suppress("UNCHECKED_CAST") - override fun transform(transformer: FirTransformer, data: D): E = - transformer.transformExpressionWithSmartcast(this, data) as E - - @FirImplementationDetail - abstract override fun replaceSource(newSource: KtSourceElement?) - - abstract override fun replaceTypeRef(newTypeRef: FirTypeRef) - - abstract override fun replaceCalleeReference(newCalleeReference: FirReference) - - abstract override fun replaceContextReceiverArguments(newContextReceiverArguments: List) - - abstract override fun replaceTypeArguments(newTypeArguments: List) - - abstract override fun replaceExplicitReceiver(newExplicitReceiver: FirExpression?) - - abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirExpressionWithSmartcast - - abstract override fun transformCalleeReference(transformer: FirTransformer, data: D): FirExpressionWithSmartcast - - abstract override fun transformTypeArguments(transformer: FirTransformer, data: D): FirExpressionWithSmartcast - - abstract override fun transformExplicitReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcast - - abstract override fun transformDispatchReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcast - - abstract override fun transformExtensionReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcast -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcastToNothing.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcastToNothing.kt deleted file mode 100644 index 642570ebb34..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirExpressionWithSmartcastToNothing.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.references.FirReference -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirTypeProjection -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.types.SmartcastStability -import org.jetbrains.kotlin.fir.visitors.* -import org.jetbrains.kotlin.fir.FirImplementationDetail - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -abstract class FirExpressionWithSmartcastToNothing : FirExpressionWithSmartcast(), FirWrappedExpressionWithSmartcastToNothing { - abstract override val source: KtSourceElement? - abstract override val typeRef: FirTypeRef - abstract override val annotations: List - abstract override val calleeReference: FirReference - abstract override val contextReceiverArguments: List - abstract override val typeArguments: List - abstract override val explicitReceiver: FirExpression? - abstract override val dispatchReceiver: FirExpression - abstract override val extensionReceiver: FirExpression - abstract override val originalExpression: FirQualifiedAccessExpression - abstract override val typesFromSmartCast: Collection - abstract override val originalType: FirTypeRef - abstract override val smartcastType: FirTypeRef - abstract override val isStable: Boolean - abstract override val smartcastStability: SmartcastStability - abstract override val smartcastTypeWithoutNullableNothing: FirTypeRef - - override fun accept(visitor: FirVisitor, data: D): R = visitor.visitExpressionWithSmartcastToNothing(this, data) - - @Suppress("UNCHECKED_CAST") - override fun transform(transformer: FirTransformer, data: D): E = - transformer.transformExpressionWithSmartcastToNothing(this, data) as E - - @FirImplementationDetail - abstract override fun replaceSource(newSource: KtSourceElement?) - - abstract override fun replaceTypeRef(newTypeRef: FirTypeRef) - - abstract override fun replaceCalleeReference(newCalleeReference: FirReference) - - abstract override fun replaceContextReceiverArguments(newContextReceiverArguments: List) - - abstract override fun replaceTypeArguments(newTypeArguments: List) - - abstract override fun replaceExplicitReceiver(newExplicitReceiver: FirExpression?) - - abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing - - abstract override fun transformCalleeReference(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing - - abstract override fun transformTypeArguments(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing - - abstract override fun transformExplicitReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing - - abstract override fun transformDispatchReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing - - abstract override fun transformExtensionReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWhenSubjectExpressionWithSmartcast.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirSmartCastExpression.kt similarity index 56% rename from compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWhenSubjectExpressionWithSmartcast.kt rename to compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirSmartCastExpression.kt index b982615d6d2..72c4c6c5c52 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWhenSubjectExpressionWithSmartcast.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirSmartCastExpression.kt @@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.expressions import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirExpressionRef import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.FirTypeRef import org.jetbrains.kotlin.types.SmartcastStability @@ -18,25 +17,26 @@ import org.jetbrains.kotlin.fir.visitors.* * DO NOT MODIFY IT MANUALLY */ -abstract class FirWhenSubjectExpressionWithSmartcast : FirWhenSubjectExpression(), FirWrappedExpressionWithSmartcast { +abstract class FirSmartCastExpression : FirExpression() { abstract override val source: KtSourceElement? - abstract override val typeRef: FirTypeRef abstract override val annotations: List - abstract override val whenRef: FirExpressionRef - abstract override val originalExpression: FirWhenSubjectExpression - abstract override val typesFromSmartCast: Collection - abstract override val originalType: FirTypeRef - abstract override val smartcastType: FirTypeRef - abstract override val isStable: Boolean - abstract override val smartcastStability: SmartcastStability + abstract override val typeRef: FirTypeRef + abstract val originalExpression: FirExpression + abstract val typesFromSmartCast: Collection + abstract val smartcastType: FirTypeRef + abstract val smartcastTypeWithoutNullableNothing: FirTypeRef? + abstract val isStable: Boolean + abstract val smartcastStability: SmartcastStability - override fun accept(visitor: FirVisitor, data: D): R = visitor.visitWhenSubjectExpressionWithSmartcast(this, data) + override fun accept(visitor: FirVisitor, data: D): R = visitor.visitSmartCastExpression(this, data) @Suppress("UNCHECKED_CAST") override fun transform(transformer: FirTransformer, data: D): E = - transformer.transformWhenSubjectExpressionWithSmartcast(this, data) as E + transformer.transformSmartCastExpression(this, data) as E abstract override fun replaceTypeRef(newTypeRef: FirTypeRef) - abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirWhenSubjectExpressionWithSmartcast + abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirSmartCastExpression + + abstract fun transformOriginalExpression(transformer: FirTransformer, data: D): FirSmartCastExpression } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWhenSubjectExpressionWithSmartcastToNothing.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWhenSubjectExpressionWithSmartcastToNothing.kt deleted file mode 100644 index c2df8520805..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWhenSubjectExpressionWithSmartcastToNothing.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirExpressionRef -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.types.SmartcastStability -import org.jetbrains.kotlin.fir.visitors.* - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -abstract class FirWhenSubjectExpressionWithSmartcastToNothing : FirWhenSubjectExpression(), FirWrappedExpressionWithSmartcastToNothing { - abstract override val source: KtSourceElement? - abstract override val typeRef: FirTypeRef - abstract override val annotations: List - abstract override val whenRef: FirExpressionRef - abstract override val originalExpression: FirWhenSubjectExpression - abstract override val typesFromSmartCast: Collection - abstract override val originalType: FirTypeRef - abstract override val smartcastType: FirTypeRef - abstract override val isStable: Boolean - abstract override val smartcastStability: SmartcastStability - abstract override val smartcastTypeWithoutNullableNothing: FirTypeRef - - override fun accept(visitor: FirVisitor, data: D): R = visitor.visitWhenSubjectExpressionWithSmartcastToNothing(this, data) - - @Suppress("UNCHECKED_CAST") - override fun transform(transformer: FirTransformer, data: D): E = - transformer.transformWhenSubjectExpressionWithSmartcastToNothing(this, data) as E - - abstract override fun replaceTypeRef(newTypeRef: FirTypeRef) - - abstract override fun transformAnnotations(transformer: FirTransformer, data: D): FirWhenSubjectExpressionWithSmartcastToNothing -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcast.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcast.kt deleted file mode 100644 index 2ca37167fe2..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcast.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.types.SmartcastStability -import org.jetbrains.kotlin.fir.visitors.* - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -interface FirWrappedExpressionWithSmartcast : FirElement { - override val source: KtSourceElement? - val typeRef: FirTypeRef - val originalExpression: E - val typesFromSmartCast: Collection - val originalType: FirTypeRef - val smartcastType: FirTypeRef - val isStable: Boolean - val smartcastStability: SmartcastStability - - override fun accept(visitor: FirVisitor, data: D): R = visitor.visitWrappedExpressionWithSmartcast(this, data) - - @Suppress("UNCHECKED_CAST") - override fun transform(transformer: FirTransformer, data: D): E = - transformer.transformWrappedExpressionWithSmartcast(this, data) as E - - fun replaceTypeRef(newTypeRef: FirTypeRef) -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcastToNothing.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcastToNothing.kt deleted file mode 100644 index a6653beca6a..00000000000 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/FirWrappedExpressionWithSmartcastToNothing.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.types.SmartcastStability -import org.jetbrains.kotlin.fir.visitors.* - -/* - * This file was generated automatically - * DO NOT MODIFY IT MANUALLY - */ - -interface FirWrappedExpressionWithSmartcastToNothing : FirWrappedExpressionWithSmartcast { - override val source: KtSourceElement? - override val typeRef: FirTypeRef - override val originalExpression: E - override val typesFromSmartCast: Collection - override val originalType: FirTypeRef - override val smartcastType: FirTypeRef - override val isStable: Boolean - override val smartcastStability: SmartcastStability - val smartcastTypeWithoutNullableNothing: FirTypeRef - - override fun accept(visitor: FirVisitor, data: D): R = visitor.visitWrappedExpressionWithSmartcastToNothing(this, data) - - @Suppress("UNCHECKED_CAST") - override fun transform(transformer: FirTransformer, data: D): E = - transformer.transformWrappedExpressionWithSmartcastToNothing(this, data) as E - - override fun replaceTypeRef(newTypeRef: FirTypeRef) -} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/builder/FirSmartCastExpressionBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/builder/FirSmartCastExpressionBuilder.kt new file mode 100644 index 00000000000..d01615928fc --- /dev/null +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/builder/FirSmartCastExpressionBuilder.kt @@ -0,0 +1,61 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("DuplicatedCode") + +package org.jetbrains.kotlin.fir.expressions.builder + +import kotlin.contracts.* +import org.jetbrains.kotlin.KtSourceElement +import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder +import org.jetbrains.kotlin.fir.builder.FirBuilderDsl +import org.jetbrains.kotlin.fir.expressions.FirAnnotation +import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression +import org.jetbrains.kotlin.fir.expressions.builder.FirExpressionBuilder +import org.jetbrains.kotlin.fir.expressions.impl.FirSmartCastExpressionImpl +import org.jetbrains.kotlin.fir.types.ConeKotlinType +import org.jetbrains.kotlin.fir.types.FirTypeRef +import org.jetbrains.kotlin.fir.visitors.* +import org.jetbrains.kotlin.types.SmartcastStability + +/* + * This file was generated automatically + * DO NOT MODIFY IT MANUALLY + */ + +@FirBuilderDsl +class FirSmartCastExpressionBuilder : FirAnnotationContainerBuilder, FirExpressionBuilder { + override var source: KtSourceElement? = null + override val annotations: MutableList = mutableListOf() + override lateinit var typeRef: FirTypeRef + lateinit var originalExpression: FirExpression + lateinit var typesFromSmartCast: Collection + lateinit var smartcastType: FirTypeRef + var smartcastTypeWithoutNullableNothing: FirTypeRef? = null + lateinit var smartcastStability: SmartcastStability + + override fun build(): FirSmartCastExpression { + return FirSmartCastExpressionImpl( + source, + annotations, + typeRef, + originalExpression, + typesFromSmartCast, + smartcastType, + smartcastTypeWithoutNullableNothing, + smartcastStability, + ) + } + +} + +@OptIn(ExperimentalContracts::class) +inline fun buildSmartCastExpression(init: FirSmartCastExpressionBuilder.() -> Unit): FirSmartCastExpression { + contract { + callsInPlace(init, kotlin.contracts.InvocationKind.EXACTLY_ONCE) + } + return FirSmartCastExpressionBuilder().apply(init).build() +} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/impl/FirSmartCastExpressionImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/impl/FirSmartCastExpressionImpl.kt new file mode 100644 index 00000000000..7dfe3a50483 --- /dev/null +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/expressions/impl/FirSmartCastExpressionImpl.kt @@ -0,0 +1,66 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("DuplicatedCode") + +package org.jetbrains.kotlin.fir.expressions.impl + +import org.jetbrains.kotlin.KtSourceElement +import org.jetbrains.kotlin.fir.expressions.FirAnnotation +import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression +import org.jetbrains.kotlin.fir.types.ConeKotlinType +import org.jetbrains.kotlin.fir.types.FirTypeRef +import org.jetbrains.kotlin.types.SmartcastStability +import org.jetbrains.kotlin.fir.visitors.* + +/* + * This file was generated automatically + * DO NOT MODIFY IT MANUALLY + */ + +internal class FirSmartCastExpressionImpl( + override val source: KtSourceElement?, + override val annotations: MutableList, + override var typeRef: FirTypeRef, + override var originalExpression: FirExpression, + override val typesFromSmartCast: Collection, + override var smartcastType: FirTypeRef, + override var smartcastTypeWithoutNullableNothing: FirTypeRef?, + override val smartcastStability: SmartcastStability, +) : FirSmartCastExpression() { + override val isStable: Boolean get() = smartcastStability == SmartcastStability.STABLE_VALUE + + override fun acceptChildren(visitor: FirVisitor, data: D) { + annotations.forEach { it.accept(visitor, data) } + typeRef.accept(visitor, data) + originalExpression.accept(visitor, data) + smartcastType.accept(visitor, data) + smartcastTypeWithoutNullableNothing?.accept(visitor, data) + } + + override fun transformChildren(transformer: FirTransformer, data: D): FirSmartCastExpressionImpl { + transformAnnotations(transformer, data) + typeRef = typeRef.transform(transformer, data) + transformOriginalExpression(transformer, data) + smartcastType = smartcastType.transform(transformer, data) + smartcastTypeWithoutNullableNothing = smartcastTypeWithoutNullableNothing?.transform(transformer, data) + return this + } + + override fun transformAnnotations(transformer: FirTransformer, data: D): FirSmartCastExpressionImpl { + annotations.transformInplace(transformer, data) + return this + } + + override fun transformOriginalExpression(transformer: FirTransformer, data: D): FirSmartCastExpressionImpl { + originalExpression = originalExpression.transform(transformer, data) + return this + } + + override fun replaceTypeRef(newTypeRef: FirTypeRef) { + typeRef = newTypeRef + } +} diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitor.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitor.kt index 57855f2ecaa..a70c39e0c26 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitor.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitor.kt @@ -98,10 +98,7 @@ import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall import org.jetbrains.kotlin.fir.expressions.FirComponentCall import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess import org.jetbrains.kotlin.fir.expressions.FirThisReceiverExpression -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression import org.jetbrains.kotlin.fir.expressions.FirCheckedSafeCallSubject import org.jetbrains.kotlin.fir.expressions.FirGetClassCall @@ -119,8 +116,6 @@ import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall import org.jetbrains.kotlin.fir.expressions.FirThrowExpression import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcastToNothing import org.jetbrains.kotlin.fir.expressions.FirWrappedDelegateExpression import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.references.FirErrorNamedReference @@ -223,7 +218,7 @@ abstract class FirDefaultVisitor : FirVisitor() { override fun visitThisReceiverExpression(thisReceiverExpression: FirThisReceiverExpression, data: D): R = visitQualifiedAccessExpression(thisReceiverExpression, data) - override fun visitWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing: FirWrappedExpressionWithSmartcastToNothing, data: D): R = visitWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcastToNothing, data) + override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: D): R = visitExpression(smartCastExpression, data) override fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression, data: D): R = visitExpression(safeCallExpression, data) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitorVoid.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitorVoid.kt index e60f959dc3a..f86caa2366b 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitorVoid.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirDefaultVisitorVoid.kt @@ -98,10 +98,7 @@ import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall import org.jetbrains.kotlin.fir.expressions.FirComponentCall import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess import org.jetbrains.kotlin.fir.expressions.FirThisReceiverExpression -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression import org.jetbrains.kotlin.fir.expressions.FirCheckedSafeCallSubject import org.jetbrains.kotlin.fir.expressions.FirGetClassCall @@ -119,8 +116,6 @@ import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall import org.jetbrains.kotlin.fir.expressions.FirThrowExpression import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcastToNothing import org.jetbrains.kotlin.fir.expressions.FirWrappedDelegateExpression import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.references.FirErrorNamedReference @@ -223,7 +218,7 @@ abstract class FirDefaultVisitorVoid : FirVisitorVoid() { override fun visitThisReceiverExpression(thisReceiverExpression: FirThisReceiverExpression) = visitQualifiedAccessExpression(thisReceiverExpression) - override fun visitWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing: FirWrappedExpressionWithSmartcastToNothing) = visitWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcastToNothing) + override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression) = visitExpression(smartCastExpression) override fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression) = visitExpression(safeCallExpression) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt index b8117d54f10..62eef479067 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirTransformer.kt @@ -98,10 +98,7 @@ import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall import org.jetbrains.kotlin.fir.expressions.FirComponentCall import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess import org.jetbrains.kotlin.fir.expressions.FirThisReceiverExpression -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression import org.jetbrains.kotlin.fir.expressions.FirCheckedSafeCallSubject import org.jetbrains.kotlin.fir.expressions.FirGetClassCall @@ -119,8 +116,6 @@ import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall import org.jetbrains.kotlin.fir.expressions.FirThrowExpression import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcastToNothing import org.jetbrains.kotlin.fir.expressions.FirWrappedDelegateExpression import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.references.FirErrorNamedReference @@ -522,20 +517,8 @@ abstract class FirTransformer : FirVisitor() { return transformElement(thisReceiverExpression, data) } - open fun transformWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcast: FirWrappedExpressionWithSmartcast, data: D): FirWrappedExpressionWithSmartcast { - return transformElement(wrappedExpressionWithSmartcast, data) - } - - open fun transformWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing: FirWrappedExpressionWithSmartcastToNothing, data: D): FirWrappedExpressionWithSmartcastToNothing { - return transformElement(wrappedExpressionWithSmartcastToNothing, data) - } - - open fun transformExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: D): FirStatement { - return transformElement(expressionWithSmartcast, data) - } - - open fun transformExpressionWithSmartcastToNothing(expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing, data: D): FirStatement { - return transformElement(expressionWithSmartcastToNothing, data) + open fun transformSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: D): FirStatement { + return transformElement(smartCastExpression, data) } open fun transformSafeCallExpression(safeCallExpression: FirSafeCallExpression, data: D): FirStatement { @@ -606,14 +589,6 @@ abstract class FirTransformer : FirVisitor() { return transformElement(whenSubjectExpression, data) } - open fun transformWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast: FirWhenSubjectExpressionWithSmartcast, data: D): FirStatement { - return transformElement(whenSubjectExpressionWithSmartcast, data) - } - - open fun transformWhenSubjectExpressionWithSmartcastToNothing(whenSubjectExpressionWithSmartcastToNothing: FirWhenSubjectExpressionWithSmartcastToNothing, data: D): FirStatement { - return transformElement(whenSubjectExpressionWithSmartcastToNothing, data) - } - open fun transformWrappedDelegateExpression(wrappedDelegateExpression: FirWrappedDelegateExpression, data: D): FirStatement { return transformElement(wrappedDelegateExpression, data) } @@ -1078,20 +1053,8 @@ abstract class FirTransformer : FirVisitor() { return transformThisReceiverExpression(thisReceiverExpression, data) } - final override fun visitWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcast: FirWrappedExpressionWithSmartcast, data: D): FirWrappedExpressionWithSmartcast { - return transformWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcast, data) - } - - final override fun visitWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing: FirWrappedExpressionWithSmartcastToNothing, data: D): FirWrappedExpressionWithSmartcastToNothing { - return transformWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing, data) - } - - final override fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: D): FirStatement { - return transformExpressionWithSmartcast(expressionWithSmartcast, data) - } - - final override fun visitExpressionWithSmartcastToNothing(expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing, data: D): FirStatement { - return transformExpressionWithSmartcastToNothing(expressionWithSmartcastToNothing, data) + final override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: D): FirStatement { + return transformSmartCastExpression(smartCastExpression, data) } final override fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression, data: D): FirStatement { @@ -1162,14 +1125,6 @@ abstract class FirTransformer : FirVisitor() { return transformWhenSubjectExpression(whenSubjectExpression, data) } - final override fun visitWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast: FirWhenSubjectExpressionWithSmartcast, data: D): FirStatement { - return transformWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast, data) - } - - final override fun visitWhenSubjectExpressionWithSmartcastToNothing(whenSubjectExpressionWithSmartcastToNothing: FirWhenSubjectExpressionWithSmartcastToNothing, data: D): FirStatement { - return transformWhenSubjectExpressionWithSmartcastToNothing(whenSubjectExpressionWithSmartcastToNothing, data) - } - final override fun visitWrappedDelegateExpression(wrappedDelegateExpression: FirWrappedDelegateExpression, data: D): FirStatement { return transformWrappedDelegateExpression(wrappedDelegateExpression, data) } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt index fb53d3dd89f..e2a8dc29fdd 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitor.kt @@ -98,10 +98,7 @@ import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall import org.jetbrains.kotlin.fir.expressions.FirComponentCall import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess import org.jetbrains.kotlin.fir.expressions.FirThisReceiverExpression -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression import org.jetbrains.kotlin.fir.expressions.FirCheckedSafeCallSubject import org.jetbrains.kotlin.fir.expressions.FirGetClassCall @@ -119,8 +116,6 @@ import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall import org.jetbrains.kotlin.fir.expressions.FirThrowExpression import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcastToNothing import org.jetbrains.kotlin.fir.expressions.FirWrappedDelegateExpression import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.references.FirErrorNamedReference @@ -337,13 +332,7 @@ abstract class FirVisitor { open fun visitThisReceiverExpression(thisReceiverExpression: FirThisReceiverExpression, data: D): R = visitElement(thisReceiverExpression, data) - open fun visitWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcast: FirWrappedExpressionWithSmartcast, data: D): R = visitElement(wrappedExpressionWithSmartcast, data) - - open fun visitWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing: FirWrappedExpressionWithSmartcastToNothing, data: D): R = visitElement(wrappedExpressionWithSmartcastToNothing, data) - - open fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: D): R = visitElement(expressionWithSmartcast, data) - - open fun visitExpressionWithSmartcastToNothing(expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing, data: D): R = visitElement(expressionWithSmartcastToNothing, data) + open fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: D): R = visitElement(smartCastExpression, data) open fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression, data: D): R = visitElement(safeCallExpression, data) @@ -379,10 +368,6 @@ abstract class FirVisitor { open fun visitWhenSubjectExpression(whenSubjectExpression: FirWhenSubjectExpression, data: D): R = visitElement(whenSubjectExpression, data) - open fun visitWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast: FirWhenSubjectExpressionWithSmartcast, data: D): R = visitElement(whenSubjectExpressionWithSmartcast, data) - - open fun visitWhenSubjectExpressionWithSmartcastToNothing(whenSubjectExpressionWithSmartcastToNothing: FirWhenSubjectExpressionWithSmartcastToNothing, data: D): R = visitElement(whenSubjectExpressionWithSmartcastToNothing, data) - open fun visitWrappedDelegateExpression(wrappedDelegateExpression: FirWrappedDelegateExpression, data: D): R = visitElement(wrappedDelegateExpression, data) open fun visitNamedReference(namedReference: FirNamedReference, data: D): R = visitElement(namedReference, data) diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt index 1870bf04748..67d0c7a9c15 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/visitors/FirVisitorVoid.kt @@ -98,10 +98,7 @@ import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall import org.jetbrains.kotlin.fir.expressions.FirComponentCall import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess import org.jetbrains.kotlin.fir.expressions.FirThisReceiverExpression -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWrappedExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.expressions.FirSafeCallExpression import org.jetbrains.kotlin.fir.expressions.FirCheckedSafeCallSubject import org.jetbrains.kotlin.fir.expressions.FirGetClassCall @@ -119,8 +116,6 @@ import org.jetbrains.kotlin.fir.expressions.FirStringConcatenationCall import org.jetbrains.kotlin.fir.expressions.FirThrowExpression import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcastToNothing import org.jetbrains.kotlin.fir.expressions.FirWrappedDelegateExpression import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.references.FirErrorNamedReference @@ -521,20 +516,8 @@ abstract class FirVisitorVoid : FirVisitor() { visitElement(thisReceiverExpression) } - open fun visitWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcast: FirWrappedExpressionWithSmartcast) { - visitElement(wrappedExpressionWithSmartcast) - } - - open fun visitWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing: FirWrappedExpressionWithSmartcastToNothing) { - visitElement(wrappedExpressionWithSmartcastToNothing) - } - - open fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast) { - visitElement(expressionWithSmartcast) - } - - open fun visitExpressionWithSmartcastToNothing(expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing) { - visitElement(expressionWithSmartcastToNothing) + open fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression) { + visitElement(smartCastExpression) } open fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression) { @@ -605,14 +588,6 @@ abstract class FirVisitorVoid : FirVisitor() { visitElement(whenSubjectExpression) } - open fun visitWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast: FirWhenSubjectExpressionWithSmartcast) { - visitElement(whenSubjectExpressionWithSmartcast) - } - - open fun visitWhenSubjectExpressionWithSmartcastToNothing(whenSubjectExpressionWithSmartcastToNothing: FirWhenSubjectExpressionWithSmartcastToNothing) { - visitElement(whenSubjectExpressionWithSmartcastToNothing) - } - open fun visitWrappedDelegateExpression(wrappedDelegateExpression: FirWrappedDelegateExpression) { visitElement(wrappedDelegateExpression) } @@ -1077,20 +1052,8 @@ abstract class FirVisitorVoid : FirVisitor() { visitThisReceiverExpression(thisReceiverExpression) } - final override fun visitWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcast: FirWrappedExpressionWithSmartcast, data: Nothing?) { - visitWrappedExpressionWithSmartcast(wrappedExpressionWithSmartcast) - } - - final override fun visitWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing: FirWrappedExpressionWithSmartcastToNothing, data: Nothing?) { - visitWrappedExpressionWithSmartcastToNothing(wrappedExpressionWithSmartcastToNothing) - } - - final override fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast, data: Nothing?) { - visitExpressionWithSmartcast(expressionWithSmartcast) - } - - final override fun visitExpressionWithSmartcastToNothing(expressionWithSmartcastToNothing: FirExpressionWithSmartcastToNothing, data: Nothing?) { - visitExpressionWithSmartcastToNothing(expressionWithSmartcastToNothing) + final override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression, data: Nothing?) { + visitSmartCastExpression(smartCastExpression) } final override fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression, data: Nothing?) { @@ -1161,14 +1124,6 @@ abstract class FirVisitorVoid : FirVisitor() { visitWhenSubjectExpression(whenSubjectExpression) } - final override fun visitWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast: FirWhenSubjectExpressionWithSmartcast, data: Nothing?) { - visitWhenSubjectExpressionWithSmartcast(whenSubjectExpressionWithSmartcast) - } - - final override fun visitWhenSubjectExpressionWithSmartcastToNothing(whenSubjectExpressionWithSmartcastToNothing: FirWhenSubjectExpressionWithSmartcastToNothing, data: Nothing?) { - visitWhenSubjectExpressionWithSmartcastToNothing(whenSubjectExpressionWithSmartcastToNothing) - } - final override fun visitWrappedDelegateExpression(wrappedDelegateExpression: FirWrappedDelegateExpression, data: Nothing?) { visitWrappedDelegateExpression(wrappedDelegateExpression) } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt index 64d6b4a2182..b4daf07530c 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirExpressionUtil.kt @@ -75,6 +75,7 @@ fun FirExpression.toResolvedCallableReference(): FirResolvedNamedReference? { fun FirExpression.toReference(): FirReference? { if (this is FirWrappedArgumentExpression) return expression.toResolvedCallableReference() + if (this is FirSmartCastExpression) return originalExpression.toReference() return (this as? FirResolvable)?.calleeReference } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastBuilder.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastBuilder.kt deleted file mode 100644 index ae9c205df18..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastBuilder.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.builder - -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression -import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionWithSmartcastImpl - -class FirExpressionWithSmartcastBuilder : FirWrappedExpressionWithSmartcastBuilder() { - override fun build(): FirExpressionWithSmartcast { - return FirExpressionWithSmartcastImpl(originalExpression, smartcastType, typesFromSmartCast, smartcastStability) - } -} - -inline fun buildExpressionWithSmartcast(init: FirExpressionWithSmartcastBuilder.() -> Unit): FirExpressionWithSmartcast { - return FirExpressionWithSmartcastBuilder().apply(init).build() -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastToNullBuilder.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastToNullBuilder.kt deleted file mode 100644 index 5e8a7e7c8db..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirExpressionWithSmartcastToNullBuilder.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.builder - -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression -import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionWithSmartcastToNothingImpl - -class FirExpressionWithSmartcastToNothingBuilder : FirWrappedExpressionWithSmartcastToNothingBuilder() { - override fun build(): FirExpressionWithSmartcastToNothing { - return FirExpressionWithSmartcastToNothingImpl( - originalExpression, - smartcastType, - typesFromSmartCast, - smartcastStability, - smartcastTypeWithoutNullableNothing - ) - } -} - -inline fun buildExpressionWithSmartcastToNothing(init: FirExpressionWithSmartcastToNothingBuilder.() -> Unit): FirExpressionWithSmartcastToNothing { - return FirExpressionWithSmartcastToNothingBuilder().apply(init).build() -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastBuilder.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastBuilder.kt deleted file mode 100644 index eb1b09109dd..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastBuilder.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.builder - -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.impl.FirWhenSubjectExpressionWithSmartcastImpl - -class FirWhenSubjectExpressionWithSmartcastBuilder : FirWrappedExpressionWithSmartcastBuilder() { - override fun build(): FirWhenSubjectExpressionWithSmartcast { - return FirWhenSubjectExpressionWithSmartcastImpl(originalExpression, smartcastType, typesFromSmartCast, smartcastStability) - } -} - -fun buildWhenSubjectExpressionWithSmartcast(init: FirWhenSubjectExpressionWithSmartcastBuilder.() -> Unit): FirWhenSubjectExpressionWithSmartcast { - return FirWhenSubjectExpressionWithSmartcastBuilder().apply(init).build() -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastToNullBuilder.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastToNullBuilder.kt deleted file mode 100644 index d825a6f87c5..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWhenSubjectExpressionWithSmartcastToNullBuilder.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.builder - -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpression -import org.jetbrains.kotlin.fir.expressions.FirWhenSubjectExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.impl.FirWhenSubjectExpressionWithSmartcastToNothingImpl - -class FirWhenSubjectExpressionWithSmartcastToNothingBuilder : FirWrappedExpressionWithSmartcastToNothingBuilder() { - override fun build(): FirWhenSubjectExpressionWithSmartcastToNothing { - return FirWhenSubjectExpressionWithSmartcastToNothingImpl( - originalExpression, - smartcastType, - typesFromSmartCast, - smartcastStability, - smartcastTypeWithoutNullableNothing - ) - } -} - -fun buildWhenSubjectExpressionWithSmartcastToNothing(init: FirWhenSubjectExpressionWithSmartcastToNothingBuilder.() -> Unit): FirWhenSubjectExpressionWithSmartcastToNothing { - return FirWhenSubjectExpressionWithSmartcastToNothingBuilder().apply(init).build() -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWrappedExpressionWithSmartcastBuilder.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWrappedExpressionWithSmartcastBuilder.kt deleted file mode 100644 index 4722792cc24..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/builder/FirWrappedExpressionWithSmartcastBuilder.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.builder - -import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.types.SmartcastStability - -abstract class FirWrappedExpressionWithSmartcastBuilder { - lateinit var originalExpression: E - lateinit var smartcastType: FirTypeRef - lateinit var typesFromSmartCast: Collection - lateinit var smartcastStability: SmartcastStability - - abstract fun build(): E -} - -abstract class FirWrappedExpressionWithSmartcastToNothingBuilder : FirWrappedExpressionWithSmartcastBuilder() { - lateinit var smartcastTypeWithoutNullableNothing: FirTypeRef -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastImpl.kt deleted file mode 100644 index 917ebcee1a4..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastImpl.kt +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.impl - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirImplementationDetail -import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression -import org.jetbrains.kotlin.fir.references.FirReference -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.types.FirTypeProjection -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.fir.visitors.FirTransformer -import org.jetbrains.kotlin.fir.visitors.FirVisitor -import org.jetbrains.kotlin.fir.visitors.transformSingle -import org.jetbrains.kotlin.types.SmartcastStability - -internal class FirExpressionWithSmartcastImpl( - override var originalExpression: FirQualifiedAccessExpression, - override val smartcastType: FirTypeRef, - override val typesFromSmartCast: Collection, - override val smartcastStability: SmartcastStability -) : FirExpressionWithSmartcast() { - init { - assert(originalExpression.typeRef is FirResolvedTypeRef) - } - - override val source: KtSourceElement? get() = originalExpression.source - override val annotations: List get() = originalExpression.annotations - override val typeArguments: List get() = originalExpression.typeArguments - override val explicitReceiver: FirExpression? get() = originalExpression.explicitReceiver - override val dispatchReceiver: FirExpression get() = originalExpression.dispatchReceiver - override val extensionReceiver: FirExpression get() = originalExpression.extensionReceiver - override val contextReceiverArguments: List get() = originalExpression.contextReceiverArguments - override val calleeReference: FirReference get() = originalExpression.calleeReference - override val originalType: FirTypeRef get() = originalExpression.typeRef - override val isStable: Boolean get() = smartcastStability == SmartcastStability.STABLE_VALUE - - // A FirExpressionWithSmartcast is only an effective smartcast if `smartcastStability == SmartcastStability.STABLE_VALUE`. Otherwise, - // it's the same as the `originalExpression` under the hood. The reason we still create such a smartcast expression is for diagnostics - // purpose only. - override val typeRef: FirTypeRef get() = if (isStable) smartcastType else originalType - - override fun transformChildren(transformer: FirTransformer, data: D): FirExpressionWithSmartcast { - originalExpression = originalExpression.transformSingle(transformer, data) - return this - } - - override fun acceptChildren(visitor: FirVisitor, data: D) { - originalExpression.accept(visitor, data) - } - - override fun transformCalleeReference(transformer: FirTransformer, data: D): FirExpressionWithSmartcast { - throw IllegalStateException() - } - - override fun transformExplicitReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcast { - throw IllegalStateException() - } - - override fun transformDispatchReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcast { - throw IllegalStateException() - } - - override fun transformExtensionReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcast { - throw IllegalStateException() - } - - override fun transformTypeArguments(transformer: FirTransformer, data: D): FirExpressionWithSmartcast { - throw IllegalStateException() - } - - override fun transformAnnotations(transformer: FirTransformer, data: D): FirExpressionWithSmartcast { - throw IllegalStateException() - } - - override fun replaceTypeArguments(newTypeArguments: List) { - throw IllegalStateException() - } - - override fun replaceCalleeReference(newCalleeReference: FirReference) { - throw IllegalStateException() - } - - override fun replaceExplicitReceiver(newExplicitReceiver: FirExpression?) { - throw IllegalStateException() - } - - override fun replaceTypeRef(newTypeRef: FirTypeRef) {} - - @FirImplementationDetail - override fun replaceSource(newSource: KtSourceElement?) { - } - - override fun replaceContextReceiverArguments(newContextReceiverArguments: List) { - throw IllegalStateException() - } -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastToNullImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastToNullImpl.kt deleted file mode 100644 index 1f1a37692d6..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirExpressionWithSmartcastToNullImpl.kt +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.impl - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirImplementationDetail -import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcastToNothing -import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression -import org.jetbrains.kotlin.fir.references.FirReference -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.types.FirTypeProjection -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.fir.visitors.FirTransformer -import org.jetbrains.kotlin.fir.visitors.FirVisitor -import org.jetbrains.kotlin.fir.visitors.transformSingle -import org.jetbrains.kotlin.types.SmartcastStability - -class FirExpressionWithSmartcastToNothingImpl( - override var originalExpression: FirQualifiedAccessExpression, - override val smartcastType: FirTypeRef, - override val typesFromSmartCast: Collection, - override val smartcastStability: SmartcastStability, - override val smartcastTypeWithoutNullableNothing: FirTypeRef -) : FirExpressionWithSmartcastToNothing() { - init { - assert(originalExpression.typeRef is FirResolvedTypeRef) - } - - override val source: KtSourceElement? get() = originalExpression.source - override val annotations: List get() = originalExpression.annotations - override val typeArguments: List get() = originalExpression.typeArguments - override val explicitReceiver: FirExpression? get() = originalExpression.explicitReceiver - override val dispatchReceiver: FirExpression get() = originalExpression.dispatchReceiver - override val extensionReceiver: FirExpression get() = originalExpression.extensionReceiver - override val contextReceiverArguments: List get() = originalExpression.contextReceiverArguments - override val isStable: Boolean get() = smartcastStability == SmartcastStability.STABLE_VALUE - override val calleeReference: FirReference get() = originalExpression.calleeReference - override val originalType: FirTypeRef get() = originalExpression.typeRef - - // A FirExpressionWithSmartcast is only an effective smartcast if `smartcastStability == SmartcastStability.STABLE_VALUE`. Otherwise, - // it's the same as the `originalExpression` under the hood. The reason we still create such a smartcast expression is for diagnostics - // purpose only. - override val typeRef: FirTypeRef get() = if (isStable) smartcastType else originalType - - override fun transformChildren(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing { - originalExpression = originalExpression.transformSingle(transformer, data) - return this - } - - override fun acceptChildren(visitor: FirVisitor, data: D) { - originalExpression.accept(visitor, data) - } - - override fun transformCalleeReference(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing { - throw IllegalStateException() - } - - override fun transformExplicitReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing { - throw IllegalStateException() - } - - override fun transformDispatchReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing { - throw IllegalStateException() - } - - override fun transformExtensionReceiver(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing { - throw IllegalStateException() - } - - override fun transformTypeArguments(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing { - throw IllegalStateException() - } - - override fun transformAnnotations(transformer: FirTransformer, data: D): FirExpressionWithSmartcastToNothing { - throw IllegalStateException() - } - - override fun replaceTypeArguments(newTypeArguments: List) { - throw IllegalStateException() - } - - override fun replaceCalleeReference(newCalleeReference: FirReference) { - throw IllegalStateException() - } - - override fun replaceExplicitReceiver(newExplicitReceiver: FirExpression?) { - throw IllegalStateException() - } - - override fun replaceTypeRef(newTypeRef: FirTypeRef) {} - - @FirImplementationDetail - override fun replaceSource(newSource: KtSourceElement?) { - } - - override fun replaceContextReceiverArguments(newContextReceiverArguments: List) { - throw IllegalStateException() - } -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastImpl.kt deleted file mode 100644 index 728275f95f5..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastImpl.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.impl - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirExpressionRef -import org.jetbrains.kotlin.fir.expressions.* -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.fir.visitors.FirTransformer -import org.jetbrains.kotlin.fir.visitors.FirVisitor -import org.jetbrains.kotlin.types.SmartcastStability - -class FirWhenSubjectExpressionWithSmartcastImpl( - override var originalExpression: FirWhenSubjectExpression, - override val smartcastType: FirTypeRef, - override val typesFromSmartCast: Collection, - override val smartcastStability: SmartcastStability -) : FirWhenSubjectExpressionWithSmartcast() { - init { - assert(originalExpression.typeRef is FirResolvedTypeRef) - } - - override val source: KtSourceElement? get() = originalExpression.source - override val annotations: List get() = originalExpression.annotations - override val whenRef: FirExpressionRef get() = originalExpression.whenRef - override val originalType: FirTypeRef get() = originalExpression.typeRef - override val isStable: Boolean get() = smartcastStability == SmartcastStability.STABLE_VALUE - - override val typeRef: FirTypeRef get() = if (isStable) smartcastType else originalExpression.typeRef - - override fun replaceTypeRef(newTypeRef: FirTypeRef) {} - - override fun transformAnnotations(transformer: FirTransformer, data: D): FirWhenSubjectExpressionWithSmartcast { - throw IllegalStateException() - } - - override fun acceptChildren(visitor: FirVisitor, data: D) { - originalExpression.accept(visitor, data) - } - - override fun transformChildren(transformer: FirTransformer, data: D): FirWhenSubjectExpressionWithSmartcastImpl { - originalExpression = originalExpression.transform(transformer, data) - return this - } -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastToNullImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastToNullImpl.kt deleted file mode 100644 index d89e53e5d0b..00000000000 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenSubjectExpressionWithSmartcastToNullImpl.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.expressions.impl - -import org.jetbrains.kotlin.KtSourceElement -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirExpressionRef -import org.jetbrains.kotlin.fir.expressions.* -import org.jetbrains.kotlin.fir.types.ConeKotlinType -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.fir.visitors.FirTransformer -import org.jetbrains.kotlin.fir.visitors.FirVisitor -import org.jetbrains.kotlin.types.SmartcastStability - -class FirWhenSubjectExpressionWithSmartcastToNothingImpl( - override var originalExpression: FirWhenSubjectExpression, - override val smartcastType: FirTypeRef, - override val typesFromSmartCast: Collection, - override val smartcastStability: SmartcastStability, - override val smartcastTypeWithoutNullableNothing: FirTypeRef -) : FirWhenSubjectExpressionWithSmartcastToNothing() { - init { - assert(originalExpression.typeRef is FirResolvedTypeRef) - } - - override val source: KtSourceElement? get() = originalExpression.source - override val annotations: List get() = originalExpression.annotations - override val whenRef: FirExpressionRef get() = originalExpression.whenRef - override val originalType: FirTypeRef get() = originalExpression.typeRef - override val isStable: Boolean get() = smartcastStability == SmartcastStability.STABLE_VALUE - - override val typeRef: FirTypeRef get() = if (isStable) smartcastType else originalExpression.typeRef - - override fun replaceTypeRef(newTypeRef: FirTypeRef) {} - - override fun transformAnnotations(transformer: FirTransformer, data: D): FirWhenSubjectExpressionWithSmartcastToNothingImpl { - throw IllegalStateException() - } - - override fun acceptChildren(visitor: FirVisitor, data: D) { - originalExpression.accept(visitor, data) - } - - override fun transformChildren(transformer: FirTransformer, data: D): FirWhenSubjectExpressionWithSmartcastToNothingImpl { - originalExpression = originalExpression.transform(transformer, data) - return this - } -} diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirRenderer.kt index edc105630c7..a4df6829244 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/renderer/FirRenderer.kt @@ -906,8 +906,8 @@ class FirRenderer( visitQualifiedAccessExpression(thisReceiverExpression) } - override fun visitExpressionWithSmartcast(expressionWithSmartcast: FirExpressionWithSmartcast) { - visitQualifiedAccessExpression(expressionWithSmartcast) + override fun visitSmartCastExpression(smartCastExpression: FirSmartCastExpression) { + smartCastExpression.originalExpression.accept(this) } override fun visitVariableAssignment(variableAssignment: FirVariableAssignment) { diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt index f4242947981..f13845e28bd 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/FirTypeUtils.kt @@ -7,15 +7,10 @@ package org.jetbrains.kotlin.fir.types import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.expressions.FirConstExpression -import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.extensions.extensionService import org.jetbrains.kotlin.fir.extensions.typeAttributeExtensions import org.jetbrains.kotlin.fir.render -import org.jetbrains.kotlin.fir.renderer.ConeTypeRenderer -import org.jetbrains.kotlin.fir.renderer.ConeTypeRendererForDebugging import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.StandardClassIds @@ -60,9 +55,9 @@ val FirExpression.isNullLiteral: Boolean @OptIn(ExperimentalContracts::class) fun FirExpression.isStableSmartcast(): Boolean { contract { - returns(true) implies (this@isStableSmartcast is FirExpressionWithSmartcast) + returns(true) implies (this@isStableSmartcast is FirSmartCastExpression) } - return this is FirExpressionWithSmartcast && this.isStable + return this is FirSmartCastExpression && this.isStable } private val FirTypeRef.lookupTagBasedOrNull: ConeLookupTagBasedType? diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt index 11aa4938a36..712f16d1c08 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/BuilderConfigurator.kt @@ -310,6 +310,9 @@ object BuilderConfigurator : AbstractBuilderConfigurator(FirTree withCopy() } + builder(smartCastExpression) { + } + builder(tryExpression) { default("calleeReference", "FirStubReference") useTypes(stubReferenceType) diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt index 63f23b063bd..277f3d7cd12 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/FirTreeBuilder.kt @@ -120,10 +120,8 @@ object FirTreeBuilder : AbstractFirTreeBuilder() { val componentCall by element(Expression, functionCall) val callableReferenceAccess by element(Expression, qualifiedAccessExpression) val thisReceiverExpression by element(Expression, qualifiedAccessExpression) - val wrappedExpressionWithSmartcast by element(Expression) - val wrappedExpressionWithSmartcastToNothing by element(Expression, wrappedExpressionWithSmartcast) - val expressionWithSmartcast by element(Expression, qualifiedAccessExpression, wrappedExpressionWithSmartcast) - val expressionWithSmartcastToNothing by element(Expression, expressionWithSmartcast, wrappedExpressionWithSmartcastToNothing) + + val smartCastExpression by element(Expression, expression) val safeCallExpression by element(Expression, expression) val checkedSafeCallSubject by element(Expression, expression) val getClassCall by element(Expression, expression, call) @@ -142,8 +140,6 @@ object FirTreeBuilder : AbstractFirTreeBuilder() { val throwExpression by element(Expression, expression) val variableAssignment by element(Expression, qualifiedAccess) val whenSubjectExpression by element(Expression, expression) - val whenSubjectExpressionWithSmartcast by element(Expression, whenSubjectExpression, wrappedExpressionWithSmartcast) - val whenSubjectExpressionWithSmartcastToNothing by element(Expression, whenSubjectExpression, wrappedExpressionWithSmartcastToNothing) val wrappedDelegateExpression by element(Expression, wrappedExpression) diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt index 9b82a824785..792f8b5988a 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt @@ -189,12 +189,6 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() publicImplementation() } - noImpl(expressionWithSmartcast) - noImpl(expressionWithSmartcastToNothing) - - noImpl(whenSubjectExpressionWithSmartcast) - noImpl(whenSubjectExpressionWithSmartcastToNothing) - impl(getClassCall) { default("argument") { value = "argumentList.arguments.first()" @@ -360,6 +354,13 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() } } + impl(smartCastExpression) { + default("isStable") { + value = "smartcastStability == SmartcastStability.STABLE_VALUE" + withGetter = true + } + } + impl(resolvedNamedReference) { defaultNull("candidateSymbol", withGetter = true) } @@ -562,7 +563,8 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() "FirIntegerLiteralOperatorCallImpl", "FirContextReceiverImpl", "FirClassReferenceExpressionImpl", - "FirGetClassCallImpl" + "FirGetClassCallImpl", + "FirSmartCastExpressionImpl" ) configureFieldInAllImplementations( field = "typeRef", diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt index cc0f0ecf2ad..d825d546c00 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/NodeConfigurator.kt @@ -490,31 +490,16 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild +intField("componentIndex") } - wrappedExpressionWithSmartcast.configure { - withArg("E", expression) + smartCastExpression.configure { +typeRefField - +field("originalExpression", "E", packageName = null) + +field("originalExpression", expression).withTransform() +field("typesFromSmartCast", "Collection", null, customType = coneKotlinTypeType) - +field("originalType", typeRef) +field("smartcastType", typeRef) + +field("smartcastTypeWithoutNullableNothing", typeRef, nullable = true) +booleanField("isStable") +smartcastStability } - wrappedExpressionWithSmartcastToNothing.configure { - withArg("E", expression) - parentArg(wrappedExpressionWithSmartcast, "E", "E") - +field("smartcastTypeWithoutNullableNothing", typeRef) - } - - expressionWithSmartcast.configure { - parentArg(wrappedExpressionWithSmartcast, "E", qualifiedAccessExpression) - } - - expressionWithSmartcastToNothing.configure { - parentArg(wrappedExpressionWithSmartcastToNothing, "E", qualifiedAccessExpression) - } - safeCallExpression.configure { +field("receiver", expression).withTransform() // Special node that might be used as a reference to receiver of a safe call after null check @@ -581,14 +566,6 @@ object NodeConfigurator : AbstractFieldConfigurator(FirTreeBuild +field("whenRef", whenRefType) } - whenSubjectExpressionWithSmartcast.configure { - parentArg(wrappedExpressionWithSmartcast, "E", whenSubjectExpression) - } - - whenSubjectExpressionWithSmartcastToNothing.configure { - parentArg(wrappedExpressionWithSmartcastToNothing, "E", whenSubjectExpression) - } - wrappedExpression.configure { +field(expression).withReplace() } diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt index 049f9e1838c..196ca836bd5 100644 --- a/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt +++ b/compiler/frontend.common/src/org/jetbrains/kotlin/KtSourceElement.kt @@ -135,10 +135,14 @@ sealed class KtFakeSourceElementKind : KtSourceElementKind() { // where componentN calls will have the fake source elements refer to the corresponding KtDestructuringDeclarationEntry object DesugaredComponentFunctionCall : KtFakeSourceElementKind() - // when smart casts applied to the expression, its wrapped into FirExpressionWithSmartcast + // when smart casts applied to the expression, it is wrapped into FirSmartCastExpression // which type reference will have a fake source refer to a original source element of it object SmartCastedTypeRef : KtFakeSourceElementKind() + // when smart casts applied to the expression, it is wrapped into FirSmartCastExpression + // this kind used for such FirSmartCastExpressions itself + object SmartCastExpression : KtFakeSourceElementKind() + // for safe call expressions like a?.foo() the FirSafeCallExpression is generated // and it have a fake source object DesugaredSafeCallExpression : KtFakeSourceElementKind() diff --git a/compiler/testData/ir/irText/firProblems/JCTree.fir.ir.txt b/compiler/testData/ir/irText/firProblems/JCTree.fir.ir.txt deleted file mode 100644 index 8c4937bddd5..00000000000 --- a/compiler/testData/ir/irText/firProblems/JCTree.fir.ir.txt +++ /dev/null @@ -1,52 +0,0 @@ -FILE fqName: fileName:/JCTreeUser.kt - CLASS CLASS name:Owner modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Owner.Owner> - TYPE_PARAMETER name:T index:0 variance:out superTypes:[.JCTree] reified:false - CONSTRUCTOR visibility:public <> (tree:T of .Owner) returnType:.Owner.Owner> [primary] - VALUE_PARAMETER name:tree index:0 type:T of .Owner - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Owner modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:tree visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:tree type:T of .Owner visibility:private [final] - EXPRESSION_BODY - GET_VAR 'tree: T of .Owner declared in .Owner.' type=T of .Owner origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Owner.Owner>) returnType:T of .Owner - correspondingProperty: PROPERTY name:tree visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.Owner.Owner> - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): T of .Owner declared in .Owner' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:tree type:T of .Owner visibility:private [final]' type=T of .Owner origin=null - receiver: GET_VAR ': .Owner.Owner> declared in .Owner.' type=.Owner.Owner> origin=null - PROPERTY name:foo visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> ($this:.Owner.Owner>) returnType:kotlin.String - correspondingProperty: PROPERTY name:foo visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.Owner.Owner> - BLOCK_BODY - VAR name:tree type:.JCTree [var] - CALL 'public final fun (): T of .Owner declared in .Owner' type=T of .Owner origin=GET_PROPERTY - $this: GET_VAR ': .Owner.Owner> declared in .Owner.' type=.Owner.Owner> origin=null - WHEN type=kotlin.Unit origin=IF - BRANCH - if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.JCTree.JCTypeApply - GET_VAR 'var tree: .JCTree [var] declared in .Owner.' type=.JCTree origin=null - then: RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Owner' - TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:clazz type:@[FlexibleNullability] kotlin.String? visibility:public' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY - receiver: TYPE_OP type=.JCTree.JCTypeApply origin=IMPLICIT_CAST typeOperand=.JCTree.JCTypeApply - GET_VAR 'var tree: .JCTree [var] declared in .Owner.' type=.JCTree origin=null - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Owner' - CONST String type=kotlin.String value="" - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/JCTree.fir.kt.txt b/compiler/testData/ir/irText/firProblems/JCTree.fir.kt.txt deleted file mode 100644 index 72d8be5c19a..00000000000 --- a/compiler/testData/ir/irText/firProblems/JCTree.fir.kt.txt +++ /dev/null @@ -1,22 +0,0 @@ -class Owner { - constructor(tree: T) /* primary */ { - super/*Any*/() - /* () */ - - } - - val tree: T - field = tree - get - - val foo: String - get(): String { - var tree: JCTree = .() - when { - tree is JCTypeApply -> return tree /*as JCTypeApply */(super).#clazz /*!! String */ - } - return "" - } - -} - diff --git a/compiler/testData/ir/irText/firProblems/JCTree.ir.txt b/compiler/testData/ir/irText/firProblems/JCTree.ir.txt deleted file mode 100644 index 444db163542..00000000000 --- a/compiler/testData/ir/irText/firProblems/JCTree.ir.txt +++ /dev/null @@ -1,53 +0,0 @@ -FILE fqName: fileName:/JCTreeUser.kt - CLASS CLASS name:Owner modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Owner.Owner> - TYPE_PARAMETER name:T index:0 variance:out superTypes:[.JCTree] reified:false - CONSTRUCTOR visibility:public <> (tree:T of .Owner) returnType:.Owner.Owner> [primary] - VALUE_PARAMETER name:tree index:0 type:T of .Owner - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Owner modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:tree visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:tree type:T of .Owner visibility:private [final] - EXPRESSION_BODY - GET_VAR 'tree: T of .Owner declared in .Owner.' type=T of .Owner origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Owner.Owner>) returnType:T of .Owner - correspondingProperty: PROPERTY name:tree visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.Owner.Owner> - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): T of .Owner declared in .Owner' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:tree type:T of .Owner visibility:private [final]' type=T of .Owner origin=null - receiver: GET_VAR ': .Owner.Owner> declared in .Owner.' type=.Owner.Owner> origin=null - PROPERTY name:foo visibility:public modality:FINAL [val] - FUN name: visibility:public modality:FINAL <> ($this:.Owner.Owner>) returnType:kotlin.String - correspondingProperty: PROPERTY name:foo visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.Owner.Owner> - BLOCK_BODY - VAR name:tree type:.JCTree [var] - CALL 'public final fun (): T of .Owner declared in .Owner' type=T of .Owner origin=GET_PROPERTY - $this: GET_VAR ': .Owner.Owner> declared in .Owner.' type=.Owner.Owner> origin=null - WHEN type=kotlin.Unit origin=IF - BRANCH - if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.JCTree.JCTypeApply - GET_VAR 'var tree: .JCTree [var] declared in .Owner.' type=.JCTree origin=null - then: BLOCK type=kotlin.Unit origin=null - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Owner' - TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String - GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:clazz type:@[FlexibleNullability] kotlin.String? visibility:public' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY - receiver: TYPE_OP type=.JCTree.JCTypeApply origin=IMPLICIT_CAST typeOperand=.JCTree.JCTypeApply - GET_VAR 'var tree: .JCTree [var] declared in .Owner.' type=.JCTree origin=null - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Owner' - CONST String type=kotlin.String value="" - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/JCTree.kt b/compiler/testData/ir/irText/firProblems/JCTree.kt deleted file mode 100644 index 0345b729454..00000000000 --- a/compiler/testData/ir/irText/firProblems/JCTree.kt +++ /dev/null @@ -1,25 +0,0 @@ -// TARGET_BACKEND: JVM -// FILE: JCTree.java - -public class JCTree { - public abstract static class JCExpression extends JCTree { - - } - - public static class JCTypeApply extends JCExpression { - public String clazz = "OK"; - } -} - -// FILE: JCTreeUser.kt - -class Owner(val tree: T) { - val foo: String - get() { - var tree: JCTree = tree - if (tree is JCTree.JCTypeApply) { - return tree.clazz - } - return ""; - } -} \ No newline at end of file diff --git a/compiler/testData/ir/irText/firProblems/JCTree.kt.txt b/compiler/testData/ir/irText/firProblems/JCTree.kt.txt deleted file mode 100644 index b0d04fa87bf..00000000000 --- a/compiler/testData/ir/irText/firProblems/JCTree.kt.txt +++ /dev/null @@ -1,24 +0,0 @@ -class Owner { - constructor(tree: T) /* primary */ { - super/*Any*/() - /* () */ - - } - - val tree: T - field = tree - get - - val foo: String - get(): String { - var tree: JCTree = .() - when { - tree is JCTypeApply -> { // BLOCK - return tree /*as JCTypeApply */(super).#clazz /*!! String */ - } - } - return "" - } - -} - diff --git a/compiler/testData/ir/irText/firProblems/OutBox.fir.ir.txt b/compiler/testData/ir/irText/firProblems/OutBox.fir.ir.txt new file mode 100644 index 00000000000..e58676c0b31 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/OutBox.fir.ir.txt @@ -0,0 +1,52 @@ +FILE fqName: fileName:/Box.kt + CLASS CLASS name:Box modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Box.Box> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[.Foo] reified:false + CONSTRUCTOR visibility:public <> (foo:T of .Box) returnType:.Box.Box> [primary] + VALUE_PARAMETER name:foo index:0 type:T of .Box + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Box modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:foo visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:foo type:T of .Box visibility:private [final] + EXPRESSION_BODY + GET_VAR 'foo: T of .Box declared in .Box.' type=T of .Box origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Box.Box>) returnType:T of .Box + correspondingProperty: PROPERTY name:foo visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Box.Box> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .Box declared in .Box' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:foo type:T of .Box visibility:private [final]' type=T of .Box origin=null + receiver: GET_VAR ': .Box.Box> declared in .Box.' type=.Box.Box> origin=null + PROPERTY name:str visibility:public modality:FINAL [val] + FUN name: visibility:public modality:FINAL <> ($this:.Box.Box>) returnType:kotlin.String + correspondingProperty: PROPERTY name:str visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Box.Box> + BLOCK_BODY + VAR name:foo type:.Foo [var] + CALL 'public final fun (): T of .Box declared in .Box' type=T of .Box origin=GET_PROPERTY + $this: GET_VAR ': .Box.Box> declared in .Box.' type=.Box.Box> origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.Foo.Buz + GET_VAR 'var foo: .Foo [var] declared in .Box.' type=.Foo origin=null + then: RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Box' + TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String + GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:str type:@[FlexibleNullability] kotlin.String? visibility:public' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY + receiver: TYPE_OP type=.Foo.Buz origin=IMPLICIT_CAST typeOperand=.Foo.Buz + GET_VAR 'var foo: .Foo [var] declared in .Box.' type=.Foo origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Box' + CONST String type=kotlin.String value="" + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/OutBox.fir.kt.txt b/compiler/testData/ir/irText/firProblems/OutBox.fir.kt.txt new file mode 100644 index 00000000000..8c3a96b9921 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/OutBox.fir.kt.txt @@ -0,0 +1,21 @@ +class Box { + constructor(foo: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val foo: T + field = foo + get + + val str: String + get(): String { + var foo: Foo = .() + when { + foo is Buz -> return foo /*as Buz */(super).#str /*!! String */ + } + return "" + } + +} diff --git a/compiler/testData/ir/irText/firProblems/OutBox.ir.txt b/compiler/testData/ir/irText/firProblems/OutBox.ir.txt new file mode 100644 index 00000000000..34e7c708b80 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/OutBox.ir.txt @@ -0,0 +1,53 @@ +FILE fqName: fileName:/Box.kt + CLASS CLASS name:Box modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Box.Box> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[.Foo] reified:false + CONSTRUCTOR visibility:public <> (foo:T of .Box) returnType:.Box.Box> [primary] + VALUE_PARAMETER name:foo index:0 type:T of .Box + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Box modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:foo visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:foo type:T of .Box visibility:private [final] + EXPRESSION_BODY + GET_VAR 'foo: T of .Box declared in .Box.' type=T of .Box origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Box.Box>) returnType:T of .Box + correspondingProperty: PROPERTY name:foo visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Box.Box> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .Box declared in .Box' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:foo type:T of .Box visibility:private [final]' type=T of .Box origin=null + receiver: GET_VAR ': .Box.Box> declared in .Box.' type=.Box.Box> origin=null + PROPERTY name:str visibility:public modality:FINAL [val] + FUN name: visibility:public modality:FINAL <> ($this:.Box.Box>) returnType:kotlin.String + correspondingProperty: PROPERTY name:str visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Box.Box> + BLOCK_BODY + VAR name:foo type:.Foo [var] + CALL 'public final fun (): T of .Box declared in .Box' type=T of .Box origin=GET_PROPERTY + $this: GET_VAR ': .Box.Box> declared in .Box.' type=.Box.Box> origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.Foo.Buz + GET_VAR 'var foo: .Foo [var] declared in .Box.' type=.Foo origin=null + then: BLOCK type=kotlin.Unit origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Box' + TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String + GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:str type:@[FlexibleNullability] kotlin.String? visibility:public' type=@[FlexibleNullability] kotlin.String? origin=GET_PROPERTY + receiver: TYPE_OP type=.Foo.Buz origin=IMPLICIT_CAST typeOperand=.Foo.Buz + GET_VAR 'var foo: .Foo [var] declared in .Box.' type=.Foo origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Box' + CONST String type=kotlin.String value="" + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/OutBox.kt b/compiler/testData/ir/irText/firProblems/OutBox.kt new file mode 100644 index 00000000000..83bc29cfc6f --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/OutBox.kt @@ -0,0 +1,25 @@ +// TARGET_BACKEND: JVM +// FILE: Foo.java + +public class Foo { + public abstract static class Bar extends Foo { + + } + + public static class Buz extends Bar { + public String str = "OK"; + } +} + +// FILE: Box.kt + +class Box(val foo: T) { + val str: String + get() { + var foo: Foo = foo + if (foo is Foo.Buz) { + return foo.str + } + return ""; + } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/firProblems/OutBox.kt.txt b/compiler/testData/ir/irText/firProblems/OutBox.kt.txt new file mode 100644 index 00000000000..1cc3122e3ad --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/OutBox.kt.txt @@ -0,0 +1,24 @@ +class Box { + constructor(foo: T) /* primary */ { + super/*Any*/() + /* () */ + + } + + val foo: T + field = foo + get + + val str: String + get(): String { + var foo: Foo = .() + when { + foo is Buz -> { // BLOCK + return foo /*as Buz */(super).#str /*!! String */ + } + } + return "" + } + +} + diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java index ab129c45051..d06b873f144 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java @@ -2596,12 +2596,6 @@ public class IrTextTestGenerated extends AbstractIrTextTest { runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt"); } - @Test - @TestMetadata("JCTree.kt") - public void testJCTree() throws Exception { - runTest("compiler/testData/ir/irText/firProblems/JCTree.kt"); - } - @Test @TestMetadata("kt19251.kt") public void testKt19251() throws Exception { @@ -2638,6 +2632,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest { runTest("compiler/testData/ir/irText/firProblems/MultiList.kt"); } + @Test + @TestMetadata("OutBox.kt") + public void testOutBox() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/OutBox.kt"); + } + @Test @TestMetadata("putIfAbsent.kt") public void testPutIfAbsent() throws Exception { diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticsHandler.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticsHandler.kt index e67187e570f..3ef0e1aba64 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticsHandler.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticsHandler.kt @@ -54,6 +54,7 @@ class FirDiagnosticsHandler(testServices: TestServices) : FirAnalysisHandler(tes KtRealSourceElementKind, KtFakeSourceElementKind.DesugaredCompoundAssignment, KtFakeSourceElementKind.ReferenceInAtomicQualifiedAccess, + KtFakeSourceElementKind.SmartCastExpression ) } @@ -158,7 +159,7 @@ class FirDiagnosticsHandler(testServices: TestServices) : FirAnalysisHandler(tes ) ) } - if (element is FirExpressionWithSmartcast) { + if (element is FirSmartCastExpression) { element.originalExpression.acceptChildren(this) } else { element.acceptChildren(this) @@ -205,7 +206,7 @@ class FirDiagnosticsHandler(testServices: TestServices) : FirAnalysisHandler(tes diagnosedRangesToDiagnosticNames: Map> ): KtDiagnosticWithParameters1? = DebugInfoDiagnosticFactory1.EXPRESSION_TYPE.createDebugInfoDiagnostic(element, diagnosedRangesToDiagnosticNames) { - element.typeRef.renderAsString((element as? FirExpressionWithSmartcast)?.takeIf { it.isStable }?.originalType) + element.typeRef.renderAsString((element as? FirSmartCastExpression)?.takeIf { it.isStable }?.originalExpression?.typeRef) } private fun FirTypeRef.renderAsString(originalTypeRef: FirTypeRef?): String { diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt index d165b77451a..30bcdd600da 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt @@ -18,8 +18,8 @@ import org.jetbrains.kotlin.fir.declarations.FirFile import org.jetbrains.kotlin.fir.declarations.FirFunction import org.jetbrains.kotlin.fir.declarations.FirProperty import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirExpressionWithSmartcast import org.jetbrains.kotlin.fir.expressions.FirFunctionCall +import org.jetbrains.kotlin.fir.expressions.FirSmartCastExpression import org.jetbrains.kotlin.fir.references.FirNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.renderer.FirRenderer @@ -170,7 +170,7 @@ abstract class AbstractKtDiagnosticsTest : AbstractFirBaseDiagnosticsTest() { diagnosedRangesToDiagnosticNames: MutableMap> ): KtDiagnosticWithParameters1? = DebugInfoDiagnosticFactory1.EXPRESSION_TYPE.createDebugInfoDiagnostic(element, diagnosedRangesToDiagnosticNames) { - element.typeRef.renderAsString((element as? FirExpressionWithSmartcast)?.originalType) + element.typeRef.renderAsString((element as? FirSmartCastExpression)?.originalExpression?.typeRef) } private fun FirTypeRef.renderAsString(originalTypeRef: FirTypeRef?): String {