diff --git a/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt b/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt index bde75dce6f4..27442f80a37 100644 --- a/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt +++ b/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt @@ -521,7 +521,6 @@ class ExpressionsConverter( if (hasSubject) { subject.bind(this) } - var thereIsElse = false for (entry in whenEntries) { val branch = entry.firBlock branches += if (!entry.isElse) { @@ -533,15 +532,11 @@ class ExpressionsConverter( FirWhenBranchImpl(null, firCondition, branch) } } else { - thereIsElse = true FirWhenBranchImpl( null, FirElseIfTrueCondition(null), branch ) } } - if (!thereIsElse) { - branches += FirWhenBranchImpl(null, FirElseIfTrueCondition(null), FirEmptyExpressionBlock()) - } } } @@ -865,10 +860,12 @@ class ExpressionsConverter( return FirWhenExpressionImpl(null, null, null).apply { val trueBranch = convertLoopBody(thenBlock) branches += FirWhenBranchImpl(null, firCondition, trueBranch) - val elseBranch = convertLoopBody(elseBlock) - branches += FirWhenBranchImpl( - null, FirElseIfTrueCondition(null), elseBranch - ) + elseBlock?.let { + val elseBranch = convertLoopBody(it) + branches += FirWhenBranchImpl( + null, FirElseIfTrueCondition(null), elseBranch + ) + } } } diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index 427a257c10b..ba79373c1f3 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -963,10 +963,11 @@ class RawFirBuilder(session: FirSession, val stubMode: Boolean) : BaseFirBuilder val firCondition = condition.toFirExpression("If statement should have condition") val trueBranch = expression.then.toFirBlock() branches += FirWhenBranchImpl(condition, firCondition, trueBranch) - val elseBranch = expression.`else`.toFirBlock() - branches += FirWhenBranchImpl( - null, FirElseIfTrueCondition(null), elseBranch - ) + expression.`else`?.let { + branches += FirWhenBranchImpl( + null, FirElseIfTrueCondition(null), it.toFirBlock() + ) + } } } @@ -1027,9 +1028,9 @@ class RawFirBuilder(session: FirSession, val stubMode: Boolean) : BaseFirBuilder FirWhenBranchImpl(entry, FirElseIfTrueCondition(null), branch) } } - if (!thereIsElseBranch) { - branches += FirWhenBranchImpl(null, FirElseIfTrueCondition(null), FirEmptyExpressionBlock()) - } +// if (!thereIsElseBranch) { +// branches += FirWhenBranchImpl(null, FirElseIfTrueCondition(null), FirEmptyExpressionBlock()) +// } } } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/annotated.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/annotated.txt index eca3503b16f..f4ca57a9f3e 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/annotated.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/annotated.txt @@ -10,16 +10,12 @@ FILE: annotated.kt ==(@Ann() arg#, Int(0)) -> { @Ann() ^foo Int(1) } - else -> { - } } @Ann() when () { ==(arg#, Int(1)) -> { ^foo @Ann() Int(1) } - else -> { - } } ^foo Int(42) diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt index e07574e4583..8c1c3fd5e6a 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/lambda.txt @@ -43,8 +43,6 @@ FILE: lambda.kt ==(it#.x#, Int(0)) -> { ^foo Int(0) } - else -> { - } } ^@use it#.y# @@ -57,8 +55,6 @@ FILE: lambda.kt ==(it#.x#, Int(0)) -> { ^bar Int(0) } - else -> { - } } ^@lambda it#.y# diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt index ad30a1c7f53..caae01d4417 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/unary.txt @@ -29,8 +29,6 @@ FILE: unary.kt ==(x#, Int(0)).not#() -> { println#(String(000)) } - else -> { - } } } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/while.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/while.txt index 11f9ce8adce..03ba3dc93b7 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/while.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/while.txt @@ -14,16 +14,12 @@ FILE: while.kt <(k#, limit#) -> { break@@@[<(k#, limit#)] } - else -> { - } } when () { >(k#, limit#) -> { continue@@@[==(k#, Int(13))] } - else -> { - } } } 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 6b5880b321a..b295b663c54 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 @@ -351,10 +351,21 @@ class FirDataFlowAnalyzer(transformer: FirBodyResolveTransformer) : BodyResolveC } fun exitWhenExpression(whenExpression: FirWhenExpression) { - val node = graphBuilder.exitWhenExpression(whenExpression) - val previousFlows = node.alivePreviousNodes.map { it.flow } + val (whenExitNode, syntheticElseNode) = graphBuilder.exitWhenExpression(whenExpression) + if (syntheticElseNode != null) { + val previousConditionExitNode = syntheticElseNode.previousNodes.single() as WhenBranchConditionExitNode + syntheticElseNode.mergeIncomingFlow() + syntheticElseNode.flow = logicSystem.approveFactsInsideFlow( + variablesForWhenConditions.remove(previousConditionExitNode)!!, + EqFalse, + syntheticElseNode.flow, + shouldForkFlow = true, + shouldRemoveSynthetics = true + ) + } + val previousFlows = whenExitNode.alivePreviousNodes.map { it.flow } val flow = logicSystem.joinFlow(previousFlows) - node.flow = flow + whenExitNode.flow = flow // TODO // val subjectSymbol = whenExpression.subjectVariable?.symbol // if (subjectSymbol != null) { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt index 4b8eebc612a..8394f5d62e5 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt @@ -70,6 +70,11 @@ class WhenBranchConditionEnterNode(owner: ControlFlowGraph, override val fir: Fi class WhenBranchConditionExitNode(owner: ControlFlowGraph, override val fir: FirWhenBranch, level: Int) : CFGNode(owner, level), ExitNode class WhenBranchResultEnterNode(owner: ControlFlowGraph, override val fir: FirWhenBranch, level: Int) : CFGNode(owner, level) class WhenBranchResultExitNode(owner: ControlFlowGraph, override val fir: FirWhenBranch, level: Int) : CFGNode(owner, level) +class WhenSyntheticElseBranchNode(owner: ControlFlowGraph, override val fir: FirWhenExpression, level: Int) : CFGNode(owner, level) { + init { + assert(!fir.isExhaustive) + } +} // ----------------------------------- Loop ----------------------------------- 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 1d59c5d44ab..11e56f23f1a 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 @@ -220,15 +220,22 @@ class ControlFlowGraphBuilder { return node } - fun exitWhenExpression(whenExpression: FirWhenExpression): WhenExitNode { - levelCounter-- + fun exitWhenExpression(whenExpression: FirWhenExpression): Pair { + val whenExitNode = whenExitNodes.pop() // exit from last condition node still on stack // we should remove it - require(lastNodes.pop() is WhenBranchConditionExitNode) - val whenExitNode = whenExitNodes.pop() + val lastWhenConditionExit = lastNodes.pop() + assert(lastWhenConditionExit is WhenBranchConditionExitNode) + val syntheticElseBranchNode = if (!whenExpression.isExhaustive) { + createWhenSyntheticElseBranchNode(whenExpression).apply { + addEdge(lastWhenConditionExit, this) + addEdge(this, whenExitNode) + } + } else null whenExitNode.markAsDeadIfNecessary() lastNodes.push(whenExitNode) - return whenExitNode + levelCounter-- + return whenExitNode to syntheticElseBranchNode } // ----------------------------------- While Loop ----------------------------------- 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 46197236e26..82efee710a3 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 @@ -88,6 +88,9 @@ fun ControlFlowGraphBuilder.createWhenExitNode(fir: FirWhenExpression): WhenExit fun ControlFlowGraphBuilder.createWhenBranchResultExitNode(fir: FirWhenBranch): WhenBranchResultExitNode = WhenBranchResultExitNode(graph, fir, levelCounter) +fun ControlFlowGraphBuilder.createWhenSyntheticElseBranchNode(fir: FirWhenExpression): WhenSyntheticElseBranchNode = + WhenSyntheticElseBranchNode(graph, fir, levelCounter) + fun ControlFlowGraphBuilder.createWhenBranchResultEnterNode(fir: FirWhenBranch): WhenBranchResultEnterNode = WhenBranchResultEnterNode(graph, fir, levelCounter) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt index b974186cca5..10619e9e8a9 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt @@ -94,6 +94,7 @@ fun CFGNode<*>.render(): String = is WhenBranchConditionExitNode -> "Exit when branch condition" is WhenBranchResultEnterNode -> "Enter when branch result" is WhenBranchResultExitNode -> "Exit when branch result" + is WhenSyntheticElseBranchNode -> "Synthetic else branch" is WhenExitNode -> "Exit when" is LoopEnterNode -> "Enter ${fir.type()} loop" diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt index 6081adeb1c9..3fb063cc31c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirBodyResolveTransformer.kt @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.fir.types.impl.* import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult import org.jetbrains.kotlin.fir.visitors.FirTransformer import org.jetbrains.kotlin.fir.visitors.compose +import org.jetbrains.kotlin.fir.visitors.transformSingle import org.jetbrains.kotlin.ir.expressions.IrConstKind import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName @@ -90,6 +91,7 @@ open class FirBodyResolveTransformer( private val syntheticCallGenerator: FirSyntheticCallGenerator = FirSyntheticCallGenerator(this) private val dataFlowAnalyzer: FirDataFlowAnalyzer = FirDataFlowAnalyzer(this) + private val whenExhaustivenessTransformer = FirWhenExhaustivenessTransformer(this) override val AbstractFirBasedSymbol.phasedFir: D where D : FirDeclaration, D : FirSymbolOwner get() { @@ -528,29 +530,37 @@ open class FirBodyResolveTransformer( if (whenExpression.subjectVariable != null) { localScopes += FirLocalScope() } - whenExpression.transformSubject(this, noExpectedType) - if (whenExpression.isOneBranch()) { - whenExpression.transformBranches(this, noExpectedType) - whenExpression.resultType = whenExpression.branches.first().result.resultType - dataFlowAnalyzer.exitWhenExpression(whenExpression) - return@with whenExpression.compose() - } - whenExpression.transformBranches(this, null) - @Suppress("NAME_SHADOWING") - val whenExpression = syntheticCallGenerator.generateCalleeForWhenExpression(whenExpression) ?: run { - dataFlowAnalyzer.exitWhenExpression(whenExpression) - whenExpression.resultType = FirErrorTypeRefImpl(null, "") - return@with whenExpression.compose() - } + var whenExpression = whenExpression.transformSubject(this, noExpectedType) + if (whenExpression.isOneBranch()) { + whenExpression = whenExpression.transformBranches(this, noExpectedType) + whenExpression.resultType = whenExpression.branches.first().result.resultType + } else { + whenExpression = whenExpression.transformBranches(this, null) - val expectedTypeRef = data as FirTypeRef? - val result = callCompleter.completeCall(whenExpression, expectedTypeRef) - dataFlowAnalyzer.exitWhenExpression(result) - result.compose() + whenExpression = syntheticCallGenerator.generateCalleeForWhenExpression(whenExpression) ?: run { + dataFlowAnalyzer.exitWhenExpression(whenExpression) + whenExpression.resultType = FirErrorTypeRefImpl(null, "") + return@with whenExpression.compose() + } + + val expectedTypeRef = data as FirTypeRef? + whenExpression = callCompleter.completeCall(whenExpression, expectedTypeRef) + } + whenExpression = whenExpression.transformSingle(whenExhaustivenessTransformer, null) + dataFlowAnalyzer.exitWhenExpression(whenExpression) + whenExpression = whenExpression.replaceReturnTypeIfNotExhaustive() + whenExpression.compose() } } + private fun FirWhenExpression.replaceReturnTypeIfNotExhaustive(): FirWhenExpression { + if (!isExhaustive) { + resultType = resultType.resolvedTypeFromPrototype(session.builtinTypes.nullableAnyType.type) + } + return this + } + private fun FirWhenExpression.isOneBranch(): Boolean { if (branches.size == 1) return true if (branches.size > 2) return false diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirWhenExhaustivenessTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirWhenExhaustivenessTransformer.kt new file mode 100644 index 00000000000..1ef35a1f2d0 --- /dev/null +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirWhenExhaustivenessTransformer.kt @@ -0,0 +1,183 @@ +/* + * 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.resolve.transformers + +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.fir.FirElement +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.expressions.* +import org.jetbrains.kotlin.fir.expressions.impl.FirElseIfTrueCondition +import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents +import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider +import org.jetbrains.kotlin.fir.resolve.firSymbolProvider +import org.jetbrains.kotlin.fir.resolve.toSymbol +import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag +import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol +import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType +import org.jetbrains.kotlin.fir.types.ConeNullability +import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef +import org.jetbrains.kotlin.fir.visitors.* +import org.jetbrains.kotlin.name.ClassId + +class FirWhenExhaustivenessTransformer(private val bodyResolveComponents: BodyResolveComponents) : FirTransformer() { + override fun transformElement(element: E, data: Nothing?): CompositeTransformResult { + throw IllegalArgumentException("Should not be there") + } + + override fun transformWhenExpression(whenExpression: FirWhenExpression, data: Nothing?): CompositeTransformResult { + val resultExpression = processExhaustivenessCheck(whenExpression) ?: whenExpression + return resultExpression.compose() + } + + private fun processExhaustivenessCheck(whenExpression: FirWhenExpression): FirWhenExpression? { + if (whenExpression.branches.any { it.condition is FirElseIfTrueCondition }) { + whenExpression.replaceIsExhaustive(true) + return whenExpression + } + + val typeRef = (whenExpression.subjectVariable?.returnTypeRef + ?: (whenExpression.subject as? FirQualifiedAccessExpression)?.typeRef) as? FirResolvedTypeRef + ?: return null + + val lookupTag = (typeRef.type as? ConeLookupTagBasedType)?.lookupTag ?: return null + val nullable = typeRef.type.nullability == ConeNullability.NULLABLE + val isExhaustive = when { + ((lookupTag as? ConeClassLikeLookupTag)?.classId == bodyResolveComponents.session.builtinTypes.booleanType.id) -> { + checkBooleanExhaustiveness(whenExpression, nullable) + } + + else -> { + val klass = lookupTag.toSymbol(bodyResolveComponents.session)?.fir as? FirRegularClass ?: return null + when { + klass.classKind == ClassKind.ENUM_CLASS -> checkEnumExhaustiveness(whenExpression, klass, nullable) + klass.modality == Modality.SEALED -> checkSealedClassExhaustiveness(whenExpression, klass as FirSealedClass, nullable) + else -> return null + } + } + } + + return if (isExhaustive) { + whenExpression.replaceIsExhaustive(true) + whenExpression + } else { + null + } + } + + // ------------------------ Enum exhaustiveness ------------------------ + + private fun checkEnumExhaustiveness(whenExpression: FirWhenExpression, enum: FirRegularClass, nullable: Boolean): Boolean { + val data = EnumExhaustivenessData( + enum.collectEnumEntries().associateByTo(mutableMapOf(), { it.classId }, { false }), + !nullable + ) + for (branch in whenExpression.branches) { + branch.condition.accept(EnumExhaustivenessVisitor, data) + } + return data.containsNull && data.visitedEntries.values.all { it } + } + + private class EnumExhaustivenessData(val visitedEntries: MutableMap, var containsNull: Boolean) + + private object EnumExhaustivenessVisitor : FirVisitor() { + override fun visitElement(element: FirElement, data: EnumExhaustivenessData) {} + + override fun visitOperatorCall(operatorCall: FirOperatorCall, data: EnumExhaustivenessData) { + if (operatorCall.operation == FirOperation.EQ) { + when (val argument = operatorCall.arguments[1]) { + is FirConstExpression<*> -> { + if (argument.value == null) { + data.containsNull = true + } + } + is FirResolvedQualifier -> { + val classId = argument.classId ?: return + data.visitedEntries.replace(classId, true) + } + } + } + } + } + + // ------------------------ Sealed class exhaustiveness ------------------------ + + private fun checkSealedClassExhaustiveness(whenExpression: FirWhenExpression, sealedClass: FirSealedClass, nullable: Boolean): Boolean { + if (sealedClass.inheritors.isEmpty()) return true + val data = SealedExhaustivenessData( + sealedClass.session.firSymbolProvider, + sealedClass.inheritors.associateByTo(mutableMapOf(), { it }, { false }), + !nullable + ) + for (branch in whenExpression.branches) { + branch.condition.accept(SealedExhaustivenessVisitor, data) + } + return data.containsNull && data.visitedInheritors.values.all { it } + } + + private class SealedExhaustivenessData( + val symbolProvider: FirSymbolProvider, + val visitedInheritors: MutableMap, + var containsNull: Boolean + ) + + private object SealedExhaustivenessVisitor : FirDefaultVisitor() { + override fun visitElement(element: FirElement, data: SealedExhaustivenessData) {} + + override fun visitTypeOperatorCall(typeOperatorCall: FirTypeOperatorCall, data: SealedExhaustivenessData) { + if (typeOperatorCall.operation == FirOperation.IS) { + typeOperatorCall.conversionTypeRef.accept(this, data) + } + } + + override fun visitOperatorCall(operatorCall: FirOperatorCall, data: SealedExhaustivenessData) { + if (operatorCall.operation == FirOperation.EQ) { + val argument = operatorCall.arguments[1] + if (argument is FirConstExpression<*> && argument.value == null) { + data.containsNull = true + } + } + } + + override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef, data: SealedExhaustivenessData) { + val lookupTag = (resolvedTypeRef.type as? ConeLookupTagBasedType)?.lookupTag ?: return + val klass = (data.symbolProvider.getSymbolByLookupTag(lookupTag) as? FirClassSymbol)?.fir ?: return + data.visitedInheritors.replace(klass.symbol.classId, true) + } + } + + // ------------------------ Boolean exhaustiveness ------------------------ + + private fun checkBooleanExhaustiveness(whenExpression: FirWhenExpression, nullable: Boolean): Boolean { + val flags = BooleanExhaustivenessFlags(!nullable) + for (branch in whenExpression.branches) { + branch.condition.accept(BooleanExhaustivenessVisitor, flags) + } + return flags.containsTrue && flags.containsFalse && flags.containsNull + } + + private class BooleanExhaustivenessFlags(var containsNull: Boolean) { + var containsTrue = false + var containsFalse = false + } + + private object BooleanExhaustivenessVisitor : FirVisitor() { + override fun visitElement(element: FirElement, data: BooleanExhaustivenessFlags) {} + + override fun visitOperatorCall(operatorCall: FirOperatorCall, data: BooleanExhaustivenessFlags) { + if (operatorCall.operation == FirOperation.EQ) { + val argument = operatorCall.arguments[1] + if (argument is FirConstExpression<*>) { + when (argument.value) { + true -> data.containsTrue = true + false -> data.containsFalse = true + null -> data.containsNull = true + } + } + } + } + } +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot index 2ad5ee5b8f1..c481d1beff8 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot @@ -26,31 +26,20 @@ digraph binaryOperations_kt { } 10 [label="Exit when branch condition"]; } + 11 [label="Synthetic else branch"]; + 12 [label="Enter when branch result"]; subgraph cluster_5 { color=blue - 11 [label="Enter when branch condition else"]; - 12 [label="Exit when branch condition"]; - } - 13 [label="Enter when branch result"]; - subgraph cluster_6 { - color=blue - 14 [label="Enter block"]; + 13 [label="Enter block"]; + 14 [label="Const: Int(1)"]; 15 [label="Exit block"]; } 16 [label="Exit when branch result"]; - 17 [label="Enter when branch result"]; - subgraph cluster_7 { - color=blue - 18 [label="Enter block"]; - 19 [label="Const: Int(1)"]; - 20 [label="Exit block"]; - } - 21 [label="Exit when branch result"]; - 22 [label="Exit when"]; + 17 [label="Exit when"]; } - 23 [label="Exit block"]; + 18 [label="Exit block"]; } - 24 [label="Exit function test_1" style="filled" fillcolor=red]; + 19 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; @@ -63,270 +52,217 @@ digraph binaryOperations_kt { 7 -> {8}; 8 -> {9}; 9 -> {10}; - 10 -> {17 11}; - 11 -> {12}; + 10 -> {12 11}; + 11 -> {17}; 12 -> {13}; 13 -> {14}; 14 -> {15}; 15 -> {16}; - 16 -> {22}; + 16 -> {17}; 17 -> {18}; 18 -> {19}; - 19 -> {20}; + + subgraph cluster_6 { + color=red + 20 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_7 { + color=blue + 21 [label="Enter block"]; + subgraph cluster_8 { + color=blue + 22 [label="Enter when"]; + subgraph cluster_9 { + color=blue + 23 [label="Enter when branch condition "]; + subgraph cluster_10 { + color=blue + 24 [label="Enter &&"]; + 25 [label="Access variable R|/b1|"]; + 26 [label="Exit left part of &&"]; + 27 [label="Enter right part of &&"]; + 28 [label="Access variable R|/b2|"]; + 29 [label="Exit &&"]; + } + 30 [label="Exit when branch condition"]; + } + 31 [label="Synthetic else branch"]; + 32 [label="Enter when branch result"]; + subgraph cluster_11 { + color=blue + 33 [label="Enter block"]; + 34 [label="Const: Int(1)"]; + 35 [label="Exit block"]; + } + 36 [label="Exit when branch result"]; + 37 [label="Exit when"]; + } + 38 [label="Exit block"]; + } + 39 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 20 -> {21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; - - subgraph cluster_8 { - color=red - 25 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_9 { - color=blue - 26 [label="Enter block"]; - subgraph cluster_10 { - color=blue - 27 [label="Enter when"]; - subgraph cluster_11 { - color=blue - 28 [label="Enter when branch condition "]; - subgraph cluster_12 { - color=blue - 29 [label="Enter &&"]; - 30 [label="Access variable R|/b1|"]; - 31 [label="Exit left part of &&"]; - 32 [label="Enter right part of &&"]; - 33 [label="Access variable R|/b2|"]; - 34 [label="Exit &&"]; - } - 35 [label="Exit when branch condition"]; - } - subgraph cluster_13 { - color=blue - 36 [label="Enter when branch condition else"]; - 37 [label="Exit when branch condition"]; - } - 38 [label="Enter when branch result"]; - subgraph cluster_14 { - color=blue - 39 [label="Enter block"]; - 40 [label="Exit block"]; - } - 41 [label="Exit when branch result"]; - 42 [label="Enter when branch result"]; - subgraph cluster_15 { - color=blue - 43 [label="Enter block"]; - 44 [label="Const: Int(1)"]; - 45 [label="Exit block"]; - } - 46 [label="Exit when branch result"]; - 47 [label="Exit when"]; - } - 48 [label="Exit block"]; - } - 49 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 24 -> {25}; 25 -> {26}; - 26 -> {27}; + 26 -> {29 27}; 27 -> {28}; 28 -> {29}; 29 -> {30}; - 30 -> {31}; - 31 -> {34 32}; + 30 -> {32 31}; + 31 -> {37}; 32 -> {33}; 33 -> {34}; 34 -> {35}; - 35 -> {42 36}; + 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; - 39 -> {40}; + + subgraph cluster_12 { + color=red + 40 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_13 { + color=blue + 41 [label="Enter block"]; + subgraph cluster_14 { + color=blue + 42 [label="Enter when"]; + subgraph cluster_15 { + color=blue + 43 [label="Enter when branch condition "]; + subgraph cluster_16 { + color=blue + 44 [label="Enter ||"]; + subgraph cluster_17 { + color=blue + 45 [label="Enter &&"]; + 46 [label="Access variable R|/b1|"]; + 47 [label="Exit left part of &&"]; + 48 [label="Enter right part of &&"]; + 49 [label="Access variable R|/b2|"]; + 50 [label="Exit &&"]; + } + 51 [label="Exit left part of ||"]; + 52 [label="Enter right part of ||"]; + 53 [label="Access variable R|/b3|"]; + 54 [label="Exit ||"]; + } + 55 [label="Exit when branch condition"]; + } + 56 [label="Synthetic else branch"]; + 57 [label="Enter when branch result"]; + subgraph cluster_18 { + color=blue + 58 [label="Enter block"]; + 59 [label="Const: Int(1)"]; + 60 [label="Exit block"]; + } + 61 [label="Exit when branch result"]; + 62 [label="Exit when"]; + } + 63 [label="Exit block"]; + } + 64 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 40 -> {41}; - 41 -> {47}; + 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {48}; + 47 -> {50 48}; 48 -> {49}; - - subgraph cluster_16 { - color=red - 50 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_17 { - color=blue - 51 [label="Enter block"]; - subgraph cluster_18 { - color=blue - 52 [label="Enter when"]; - subgraph cluster_19 { - color=blue - 53 [label="Enter when branch condition "]; - subgraph cluster_20 { - color=blue - 54 [label="Enter ||"]; - subgraph cluster_21 { - color=blue - 55 [label="Enter &&"]; - 56 [label="Access variable R|/b1|"]; - 57 [label="Exit left part of &&"]; - 58 [label="Enter right part of &&"]; - 59 [label="Access variable R|/b2|"]; - 60 [label="Exit &&"]; - } - 61 [label="Exit left part of ||"]; - 62 [label="Enter right part of ||"]; - 63 [label="Access variable R|/b3|"]; - 64 [label="Exit ||"]; - } - 65 [label="Exit when branch condition"]; - } - subgraph cluster_22 { - color=blue - 66 [label="Enter when branch condition else"]; - 67 [label="Exit when branch condition"]; - } - 68 [label="Enter when branch result"]; - subgraph cluster_23 { - color=blue - 69 [label="Enter block"]; - 70 [label="Exit block"]; - } - 71 [label="Exit when branch result"]; - 72 [label="Enter when branch result"]; - subgraph cluster_24 { - color=blue - 73 [label="Enter block"]; - 74 [label="Const: Int(1)"]; - 75 [label="Exit block"]; - } - 76 [label="Exit when branch result"]; - 77 [label="Exit when"]; - } - 78 [label="Exit block"]; - } - 79 [label="Exit function test_3" style="filled" fillcolor=red]; - } - + 49 -> {50}; 50 -> {51}; - 51 -> {52}; + 51 -> {54 52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {56}; - 56 -> {57}; - 57 -> {60 58}; + 55 -> {57 56}; + 56 -> {62}; + 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {64 62}; + 61 -> {62}; 62 -> {63}; 63 -> {64}; - 64 -> {65}; - 65 -> {72 66}; + + subgraph cluster_19 { + color=red + 65 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_20 { + color=blue + 66 [label="Enter block"]; + subgraph cluster_21 { + color=blue + 67 [label="Enter when"]; + subgraph cluster_22 { + color=blue + 68 [label="Enter when branch condition "]; + subgraph cluster_23 { + color=blue + 69 [label="Enter ||"]; + 70 [label="Access variable R|/b1|"]; + 71 [label="Exit left part of ||"]; + 72 [label="Enter right part of ||"]; + subgraph cluster_24 { + color=blue + 73 [label="Enter &&"]; + 74 [label="Access variable R|/b2|"]; + 75 [label="Exit left part of &&"]; + 76 [label="Enter right part of &&"]; + 77 [label="Access variable R|/b3|"]; + 78 [label="Exit &&"]; + } + 79 [label="Exit ||"]; + } + 80 [label="Exit when branch condition"]; + } + 81 [label="Synthetic else branch"]; + 82 [label="Enter when branch result"]; + subgraph cluster_25 { + color=blue + 83 [label="Enter block"]; + 84 [label="Const: Int(1)"]; + 85 [label="Exit block"]; + } + 86 [label="Exit when branch result"]; + 87 [label="Exit when"]; + } + 88 [label="Exit block"]; + } + 89 [label="Exit function test_4" style="filled" fillcolor=red]; + } + + 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; 69 -> {70}; 70 -> {71}; - 71 -> {77}; + 71 -> {79 72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {76}; + 75 -> {78 76}; 76 -> {77}; 77 -> {78}; 78 -> {79}; - - subgraph cluster_25 { - color=red - 80 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_26 { - color=blue - 81 [label="Enter block"]; - subgraph cluster_27 { - color=blue - 82 [label="Enter when"]; - subgraph cluster_28 { - color=blue - 83 [label="Enter when branch condition "]; - subgraph cluster_29 { - color=blue - 84 [label="Enter ||"]; - 85 [label="Access variable R|/b1|"]; - 86 [label="Exit left part of ||"]; - 87 [label="Enter right part of ||"]; - subgraph cluster_30 { - color=blue - 88 [label="Enter &&"]; - 89 [label="Access variable R|/b2|"]; - 90 [label="Exit left part of &&"]; - 91 [label="Enter right part of &&"]; - 92 [label="Access variable R|/b3|"]; - 93 [label="Exit &&"]; - } - 94 [label="Exit ||"]; - } - 95 [label="Exit when branch condition"]; - } - subgraph cluster_31 { - color=blue - 96 [label="Enter when branch condition else"]; - 97 [label="Exit when branch condition"]; - } - 98 [label="Enter when branch result"]; - subgraph cluster_32 { - color=blue - 99 [label="Enter block"]; - 100 [label="Exit block"]; - } - 101 [label="Exit when branch result"]; - 102 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 103 [label="Enter block"]; - 104 [label="Const: Int(1)"]; - 105 [label="Exit block"]; - } - 106 [label="Exit when branch result"]; - 107 [label="Exit when"]; - } - 108 [label="Exit block"]; - } - 109 [label="Exit function test_4" style="filled" fillcolor=red]; - } - - 80 -> {81}; - 81 -> {82}; + 79 -> {80}; + 80 -> {82 81}; + 81 -> {87}; 82 -> {83}; 83 -> {84}; 84 -> {85}; 85 -> {86}; - 86 -> {94 87}; + 86 -> {87}; 87 -> {88}; 88 -> {89}; - 89 -> {90}; - 90 -> {93 91}; - 91 -> {92}; - 92 -> {93}; - 93 -> {94}; - 94 -> {95}; - 95 -> {102 96}; - 96 -> {97}; - 97 -> {98}; - 98 -> {99}; - 99 -> {100}; - 100 -> {101}; - 101 -> {107}; - 102 -> {103}; - 103 -> {104}; - 104 -> {105}; - 105 -> {106}; - 106 -> {107}; - 107 -> {108}; - 108 -> {109}; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.txt b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.txt index ecb1fffd8cc..180f171f7a4 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.txt @@ -4,8 +4,6 @@ FILE: binaryOperations.kt R|/b1| || R|/b2| -> { Int(1) } - else -> { - } } } @@ -14,8 +12,6 @@ FILE: binaryOperations.kt R|/b1| && R|/b2| -> { Int(1) } - else -> { - } } } @@ -24,8 +20,6 @@ FILE: binaryOperations.kt R|/b1| && R|/b2| || R|/b3| -> { Int(1) } - else -> { - } } } @@ -34,8 +28,6 @@ FILE: binaryOperations.kt R|/b1| || R|/b2| && R|/b3| -> { Int(1) } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot index 6a56ab5b16b..97a2617ffb2 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot @@ -26,31 +26,20 @@ digraph booleanOperatorsWithConsts_kt { } 10 [label="Exit when branch condition"]; } + 11 [label="Synthetic else branch"]; + 12 [label="Enter when branch result"]; subgraph cluster_5 { color=blue - 11 [label="Enter when branch condition else"]; - 12 [label="Exit when branch condition"]; - } - 13 [label="Enter when branch result"]; - subgraph cluster_6 { - color=blue - 14 [label="Enter block"]; + 13 [label="Enter block"]; + 14 [label="Const: Int(1)"]; 15 [label="Exit block"]; } 16 [label="Exit when branch result"]; - 17 [label="Enter when branch result"]; - subgraph cluster_7 { - color=blue - 18 [label="Enter block"]; - 19 [label="Const: Int(1)"]; - 20 [label="Exit block"]; - } - 21 [label="Exit when branch result"]; - 22 [label="Exit when"]; + 17 [label="Exit when"]; } - 23 [label="Exit block"]; + 18 [label="Exit block"]; } - 24 [label="Exit function test_1" style="filled" fillcolor=red]; + 19 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; @@ -63,212 +52,225 @@ digraph booleanOperatorsWithConsts_kt { 7 -> {8}; 8 -> {9}; 9 -> {10}; - 10 -> {17 11}; - 11 -> {12}; + 10 -> {12 11}; + 11 -> {17}; 12 -> {13}; 13 -> {14}; 14 -> {15}; 15 -> {16}; - 16 -> {22}; + 16 -> {17}; 17 -> {18}; 18 -> {19}; - 19 -> {20}; + + subgraph cluster_6 { + color=red + 20 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_7 { + color=blue + 21 [label="Enter block"]; + subgraph cluster_8 { + color=blue + 22 [label="Enter when"]; + subgraph cluster_9 { + color=blue + 23 [label="Enter when branch condition "]; + subgraph cluster_10 { + color=blue + 24 [label="Enter ||"]; + 25 [label="Const: Boolean(false)"]; + 26 [label="Exit left part of ||"]; + 27 [label="Enter right part of ||"]; + 28 [label="Access variable R|/b|"]; + 29 [label="Stub" style="filled" fillcolor=gray]; + 30 [label="Exit ||"]; + } + 31 [label="Exit when branch condition"]; + } + 32 [label="Synthetic else branch"]; + 33 [label="Enter when branch result"]; + subgraph cluster_11 { + color=blue + 34 [label="Enter block"]; + 35 [label="Const: Int(1)"]; + 36 [label="Exit block"]; + } + 37 [label="Exit when branch result"]; + 38 [label="Exit when"]; + } + 39 [label="Exit block"]; + } + 40 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 20 -> {21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; - - subgraph cluster_8 { - color=red - 25 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_9 { - color=blue - 26 [label="Enter block"]; - subgraph cluster_10 { - color=blue - 27 [label="Enter when"]; - subgraph cluster_11 { - color=blue - 28 [label="Enter when branch condition "]; - subgraph cluster_12 { - color=blue - 29 [label="Enter ||"]; - 30 [label="Const: Boolean(false)"]; - 31 [label="Exit left part of ||"]; - 32 [label="Enter right part of ||"]; - 33 [label="Access variable R|/b|"]; - 34 [label="Stub" style="filled" fillcolor=gray]; - 35 [label="Exit ||"]; - } - 36 [label="Exit when branch condition"]; - } - subgraph cluster_13 { - color=blue - 37 [label="Enter when branch condition else"]; - 38 [label="Exit when branch condition"]; - } - 39 [label="Enter when branch result"]; - subgraph cluster_14 { - color=blue - 40 [label="Enter block"]; - 41 [label="Exit block"]; - } - 42 [label="Exit when branch result"]; - 43 [label="Enter when branch result"]; - subgraph cluster_15 { - color=blue - 44 [label="Enter block"]; - 45 [label="Const: Int(1)"]; - 46 [label="Exit block"]; - } - 47 [label="Exit when branch result"]; - 48 [label="Exit when"]; - } - 49 [label="Exit block"]; - } - 50 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 24 -> {25}; 25 -> {26}; 26 -> {27}; + 26 -> {29} [style=dotted]; 27 -> {28}; - 28 -> {29}; - 29 -> {30}; + 28 -> {30}; + 29 -> {30} [style=dotted]; 30 -> {31}; - 31 -> {32}; - 31 -> {34} [style=dotted]; - 32 -> {33}; - 33 -> {35}; - 34 -> {35} [style=dotted]; + 31 -> {33 32}; + 32 -> {38}; + 33 -> {34}; + 34 -> {35}; 35 -> {36}; - 36 -> {43 37}; + 36 -> {37}; 37 -> {38}; 38 -> {39}; 39 -> {40}; - 40 -> {41}; + + subgraph cluster_12 { + color=red + 41 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_13 { + color=blue + 42 [label="Enter block"]; + subgraph cluster_14 { + color=blue + 43 [label="Enter when"]; + subgraph cluster_15 { + color=blue + 44 [label="Enter when branch condition "]; + subgraph cluster_16 { + color=blue + 45 [label="Enter ||"]; + 46 [label="Access variable R|/b|"]; + 47 [label="Exit left part of ||"]; + 48 [label="Enter right part of ||"]; + 49 [label="Const: Boolean(true)"]; + 50 [label="Exit ||"]; + } + 51 [label="Exit when branch condition"]; + } + 52 [label="Synthetic else branch"]; + 53 [label="Enter when branch result"]; + subgraph cluster_17 { + color=blue + 54 [label="Enter block"]; + 55 [label="Const: Int(1)"]; + 56 [label="Exit block"]; + } + 57 [label="Exit when branch result"]; + 58 [label="Exit when"]; + } + 59 [label="Exit block"]; + } + 60 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 41 -> {42}; - 42 -> {48}; + 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {48}; + 47 -> {50 48}; 48 -> {49}; 49 -> {50}; - - subgraph cluster_16 { - color=red - 51 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_17 { - color=blue - 52 [label="Enter block"]; - subgraph cluster_18 { - color=blue - 53 [label="Enter when"]; - subgraph cluster_19 { - color=blue - 54 [label="Enter when branch condition "]; - subgraph cluster_20 { - color=blue - 55 [label="Enter ||"]; - 56 [label="Access variable R|/b|"]; - 57 [label="Exit left part of ||"]; - 58 [label="Enter right part of ||"]; - 59 [label="Const: Boolean(true)"]; - 60 [label="Exit ||"]; - } - 61 [label="Exit when branch condition"]; - } - subgraph cluster_21 { - color=blue - 62 [label="Enter when branch condition else"]; - 63 [label="Exit when branch condition"]; - } - 64 [label="Enter when branch result"]; - subgraph cluster_22 { - color=blue - 65 [label="Enter block"]; - 66 [label="Exit block"]; - } - 67 [label="Exit when branch result"]; - 68 [label="Enter when branch result"]; - subgraph cluster_23 { - color=blue - 69 [label="Enter block"]; - 70 [label="Const: Int(1)"]; - 71 [label="Exit block"]; - } - 72 [label="Exit when branch result"]; - 73 [label="Exit when"]; - } - 74 [label="Exit block"]; - } - 75 [label="Exit function test_3" style="filled" fillcolor=red]; - } - - 51 -> {52}; - 52 -> {53}; + 50 -> {51}; + 51 -> {53 52}; + 52 -> {58}; 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; - 57 -> {60 58}; + 57 -> {58}; 58 -> {59}; 59 -> {60}; - 60 -> {61}; - 61 -> {68 62}; + + subgraph cluster_18 { + color=red + 61 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_19 { + color=blue + 62 [label="Enter block"]; + subgraph cluster_20 { + color=blue + 63 [label="Enter when"]; + subgraph cluster_21 { + color=blue + 64 [label="Enter when branch condition "]; + subgraph cluster_22 { + color=blue + 65 [label="Enter ||"]; + 66 [label="Const: Boolean(true)"]; + 67 [label="Exit left part of ||"]; + 68 [label="Stub" style="filled" fillcolor=gray]; + 69 [label="Enter right part of ||" style="filled" fillcolor=gray]; + 70 [label="Access variable R|/b|" style="filled" fillcolor=gray]; + 71 [label="Exit ||"]; + } + 72 [label="Exit when branch condition"]; + } + 73 [label="Synthetic else branch"]; + 74 [label="Enter when branch result"]; + subgraph cluster_23 { + color=blue + 75 [label="Enter block"]; + 76 [label="Const: Int(1)"]; + 77 [label="Exit block"]; + } + 78 [label="Exit when branch result"]; + 79 [label="Exit when"]; + } + 80 [label="Exit block"]; + } + 81 [label="Exit function test_4" style="filled" fillcolor=red]; + } + + 61 -> {62}; 62 -> {63}; 63 -> {64}; 64 -> {65}; 65 -> {66}; 66 -> {67}; - 67 -> {73}; - 68 -> {69}; - 69 -> {70}; - 70 -> {71}; + 67 -> {71}; + 67 -> {68} [style=dotted]; + 68 -> {69} [style=dotted]; + 69 -> {70} [style=dotted]; + 70 -> {71} [style=dotted]; 71 -> {72}; - 72 -> {73}; - 73 -> {74}; + 72 -> {74 73}; + 73 -> {79}; 74 -> {75}; + 75 -> {76}; + 76 -> {77}; + 77 -> {78}; + 78 -> {79}; + 79 -> {80}; + 80 -> {81}; subgraph cluster_24 { color=red - 76 [label="Enter function test_4" style="filled" fillcolor=red]; + 82 [label="Enter function test_5" style="filled" fillcolor=red]; subgraph cluster_25 { color=blue - 77 [label="Enter block"]; + 83 [label="Enter block"]; subgraph cluster_26 { color=blue - 78 [label="Enter when"]; + 84 [label="Enter when"]; subgraph cluster_27 { color=blue - 79 [label="Enter when branch condition "]; + 85 [label="Enter when branch condition "]; subgraph cluster_28 { color=blue - 80 [label="Enter ||"]; - 81 [label="Const: Boolean(true)"]; - 82 [label="Exit left part of ||"]; - 83 [label="Stub" style="filled" fillcolor=gray]; - 84 [label="Enter right part of ||" style="filled" fillcolor=gray]; - 85 [label="Access variable R|/b|" style="filled" fillcolor=gray]; - 86 [label="Exit ||"]; + 86 [label="Enter &&"]; + 87 [label="Access variable R|/b|"]; + 88 [label="Exit left part of &&"]; + 89 [label="Enter right part of &&"]; + 90 [label="Const: Boolean(false)"]; + 91 [label="Exit &&"]; } - 87 [label="Exit when branch condition"]; + 92 [label="Exit when branch condition"]; } - subgraph cluster_29 { - color=blue - 88 [label="Enter when branch condition else"]; - 89 [label="Exit when branch condition"]; - } - 90 [label="Enter when branch result"]; - subgraph cluster_30 { - color=blue - 91 [label="Enter block"]; - 92 [label="Exit block"]; - } - 93 [label="Exit when branch result"]; + 93 [label="Synthetic else branch"]; 94 [label="Enter when branch result"]; - subgraph cluster_31 { + subgraph cluster_29 { color=blue 95 [label="Enter block"]; 96 [label="Const: Int(1)"]; @@ -279,27 +281,20 @@ digraph booleanOperatorsWithConsts_kt { } 100 [label="Exit block"]; } - 101 [label="Exit function test_4" style="filled" fillcolor=red]; + 101 [label="Exit function test_5" style="filled" fillcolor=red]; } - 76 -> {77}; - 77 -> {78}; - 78 -> {79}; - 79 -> {80}; - 80 -> {81}; - 81 -> {82}; - 82 -> {86}; - 82 -> {83} [style=dotted]; - 83 -> {84} [style=dotted]; - 84 -> {85} [style=dotted]; - 85 -> {86} [style=dotted]; + 82 -> {83}; + 83 -> {84}; + 84 -> {85}; + 85 -> {86}; 86 -> {87}; - 87 -> {94 88}; - 88 -> {89}; + 87 -> {88}; + 88 -> {91 89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; - 92 -> {93}; + 92 -> {94 93}; 93 -> {99}; 94 -> {95}; 95 -> {96}; @@ -309,54 +304,44 @@ digraph booleanOperatorsWithConsts_kt { 99 -> {100}; 100 -> {101}; - subgraph cluster_32 { + subgraph cluster_30 { color=red - 102 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_33 { + 102 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_31 { color=blue 103 [label="Enter block"]; - subgraph cluster_34 { + subgraph cluster_32 { color=blue 104 [label="Enter when"]; - subgraph cluster_35 { + subgraph cluster_33 { color=blue 105 [label="Enter when branch condition "]; - subgraph cluster_36 { + subgraph cluster_34 { color=blue 106 [label="Enter &&"]; - 107 [label="Access variable R|/b|"]; + 107 [label="Const: Boolean(false)"]; 108 [label="Exit left part of &&"]; - 109 [label="Enter right part of &&"]; - 110 [label="Const: Boolean(false)"]; - 111 [label="Exit &&"]; + 109 [label="Stub" style="filled" fillcolor=gray]; + 110 [label="Enter right part of &&" style="filled" fillcolor=gray]; + 111 [label="Access variable R|/b|" style="filled" fillcolor=gray]; + 112 [label="Exit &&"]; } - 112 [label="Exit when branch condition"]; - } - subgraph cluster_37 { - color=blue - 113 [label="Enter when branch condition else"]; - 114 [label="Exit when branch condition"]; + 113 [label="Exit when branch condition"]; } + 114 [label="Synthetic else branch"]; 115 [label="Enter when branch result"]; - subgraph cluster_38 { + subgraph cluster_35 { color=blue 116 [label="Enter block"]; - 117 [label="Exit block"]; + 117 [label="Const: Int(1)"]; + 118 [label="Exit block"]; } - 118 [label="Exit when branch result"]; - 119 [label="Enter when branch result"]; - subgraph cluster_39 { - color=blue - 120 [label="Enter block"]; - 121 [label="Const: Int(1)"]; - 122 [label="Exit block"]; - } - 123 [label="Exit when branch result"]; - 124 [label="Exit when"]; + 119 [label="Exit when branch result"]; + 120 [label="Exit when"]; } - 125 [label="Exit block"]; + 121 [label="Exit block"]; } - 126 [label="Exit function test_5" style="filled" fillcolor=red]; + 122 [label="Exit function test_6" style="filled" fillcolor=red]; } 102 -> {103}; @@ -365,254 +350,141 @@ digraph booleanOperatorsWithConsts_kt { 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {111 109}; - 109 -> {110}; - 110 -> {111}; - 111 -> {112}; - 112 -> {119 113}; - 113 -> {114}; - 114 -> {115}; + 108 -> {112}; + 108 -> {109} [style=dotted]; + 109 -> {110} [style=dotted]; + 110 -> {111} [style=dotted]; + 111 -> {112} [style=dotted]; + 112 -> {113}; + 113 -> {115 114}; + 114 -> {120}; 115 -> {116}; 116 -> {117}; 117 -> {118}; - 118 -> {124}; + 118 -> {119}; 119 -> {120}; 120 -> {121}; 121 -> {122}; - 122 -> {123}; + + subgraph cluster_36 { + color=red + 123 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_37 { + color=blue + 124 [label="Enter block"]; + subgraph cluster_38 { + color=blue + 125 [label="Enter when"]; + subgraph cluster_39 { + color=blue + 126 [label="Enter when branch condition "]; + subgraph cluster_40 { + color=blue + 127 [label="Enter &&"]; + 128 [label="Access variable R|/b|"]; + 129 [label="Exit left part of &&"]; + 130 [label="Enter right part of &&"]; + 131 [label="Const: Boolean(true)"]; + 132 [label="Exit &&"]; + } + 133 [label="Exit when branch condition"]; + } + 134 [label="Synthetic else branch"]; + 135 [label="Enter when branch result"]; + subgraph cluster_41 { + color=blue + 136 [label="Enter block"]; + 137 [label="Const: Int(1)"]; + 138 [label="Exit block"]; + } + 139 [label="Exit when branch result"]; + 140 [label="Exit when"]; + } + 141 [label="Exit block"]; + } + 142 [label="Exit function test_7" style="filled" fillcolor=red]; + } + 123 -> {124}; 124 -> {125}; 125 -> {126}; - - subgraph cluster_40 { - color=red - 127 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_41 { - color=blue - 128 [label="Enter block"]; - subgraph cluster_42 { - color=blue - 129 [label="Enter when"]; - subgraph cluster_43 { - color=blue - 130 [label="Enter when branch condition "]; - subgraph cluster_44 { - color=blue - 131 [label="Enter &&"]; - 132 [label="Const: Boolean(false)"]; - 133 [label="Exit left part of &&"]; - 134 [label="Stub" style="filled" fillcolor=gray]; - 135 [label="Enter right part of &&" style="filled" fillcolor=gray]; - 136 [label="Access variable R|/b|" style="filled" fillcolor=gray]; - 137 [label="Exit &&"]; - } - 138 [label="Exit when branch condition"]; - } - subgraph cluster_45 { - color=blue - 139 [label="Enter when branch condition else"]; - 140 [label="Exit when branch condition"]; - } - 141 [label="Enter when branch result"]; - subgraph cluster_46 { - color=blue - 142 [label="Enter block"]; - 143 [label="Exit block"]; - } - 144 [label="Exit when branch result"]; - 145 [label="Enter when branch result"]; - subgraph cluster_47 { - color=blue - 146 [label="Enter block"]; - 147 [label="Const: Int(1)"]; - 148 [label="Exit block"]; - } - 149 [label="Exit when branch result"]; - 150 [label="Exit when"]; - } - 151 [label="Exit block"]; - } - 152 [label="Exit function test_6" style="filled" fillcolor=red]; - } - + 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {130}; + 129 -> {132 130}; 130 -> {131}; 131 -> {132}; 132 -> {133}; - 133 -> {137}; - 133 -> {134} [style=dotted]; - 134 -> {135} [style=dotted]; - 135 -> {136} [style=dotted]; - 136 -> {137} [style=dotted]; + 133 -> {135 134}; + 134 -> {140}; + 135 -> {136}; + 136 -> {137}; 137 -> {138}; - 138 -> {145 139}; + 138 -> {139}; 139 -> {140}; 140 -> {141}; 141 -> {142}; - 142 -> {143}; + + subgraph cluster_42 { + color=red + 143 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_43 { + color=blue + 144 [label="Enter block"]; + subgraph cluster_44 { + color=blue + 145 [label="Enter when"]; + subgraph cluster_45 { + color=blue + 146 [label="Enter when branch condition "]; + subgraph cluster_46 { + color=blue + 147 [label="Enter &&"]; + 148 [label="Const: Boolean(true)"]; + 149 [label="Exit left part of &&"]; + 150 [label="Enter right part of &&"]; + 151 [label="Access variable R|/b|"]; + 152 [label="Stub" style="filled" fillcolor=gray]; + 153 [label="Exit &&"]; + } + 154 [label="Exit when branch condition"]; + } + 155 [label="Synthetic else branch"]; + 156 [label="Enter when branch result"]; + subgraph cluster_47 { + color=blue + 157 [label="Enter block"]; + 158 [label="Const: Int(1)"]; + 159 [label="Exit block"]; + } + 160 [label="Exit when branch result"]; + 161 [label="Exit when"]; + } + 162 [label="Exit block"]; + } + 163 [label="Exit function test_8" style="filled" fillcolor=red]; + } + 143 -> {144}; - 144 -> {150}; + 144 -> {145}; 145 -> {146}; 146 -> {147}; 147 -> {148}; 148 -> {149}; 149 -> {150}; + 149 -> {152} [style=dotted]; 150 -> {151}; - 151 -> {152}; - - subgraph cluster_48 { - color=red - 153 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_49 { - color=blue - 154 [label="Enter block"]; - subgraph cluster_50 { - color=blue - 155 [label="Enter when"]; - subgraph cluster_51 { - color=blue - 156 [label="Enter when branch condition "]; - subgraph cluster_52 { - color=blue - 157 [label="Enter &&"]; - 158 [label="Access variable R|/b|"]; - 159 [label="Exit left part of &&"]; - 160 [label="Enter right part of &&"]; - 161 [label="Const: Boolean(true)"]; - 162 [label="Exit &&"]; - } - 163 [label="Exit when branch condition"]; - } - subgraph cluster_53 { - color=blue - 164 [label="Enter when branch condition else"]; - 165 [label="Exit when branch condition"]; - } - 166 [label="Enter when branch result"]; - subgraph cluster_54 { - color=blue - 167 [label="Enter block"]; - 168 [label="Exit block"]; - } - 169 [label="Exit when branch result"]; - 170 [label="Enter when branch result"]; - subgraph cluster_55 { - color=blue - 171 [label="Enter block"]; - 172 [label="Const: Int(1)"]; - 173 [label="Exit block"]; - } - 174 [label="Exit when branch result"]; - 175 [label="Exit when"]; - } - 176 [label="Exit block"]; - } - 177 [label="Exit function test_7" style="filled" fillcolor=red]; - } - + 151 -> {153}; + 152 -> {153} [style=dotted]; 153 -> {154}; - 154 -> {155}; - 155 -> {156}; + 154 -> {156 155}; + 155 -> {161}; 156 -> {157}; 157 -> {158}; 158 -> {159}; - 159 -> {162 160}; + 159 -> {160}; 160 -> {161}; 161 -> {162}; 162 -> {163}; - 163 -> {170 164}; - 164 -> {165}; - 165 -> {166}; - 166 -> {167}; - 167 -> {168}; - 168 -> {169}; - 169 -> {175}; - 170 -> {171}; - 171 -> {172}; - 172 -> {173}; - 173 -> {174}; - 174 -> {175}; - 175 -> {176}; - 176 -> {177}; - - subgraph cluster_56 { - color=red - 178 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_57 { - color=blue - 179 [label="Enter block"]; - subgraph cluster_58 { - color=blue - 180 [label="Enter when"]; - subgraph cluster_59 { - color=blue - 181 [label="Enter when branch condition "]; - subgraph cluster_60 { - color=blue - 182 [label="Enter &&"]; - 183 [label="Const: Boolean(true)"]; - 184 [label="Exit left part of &&"]; - 185 [label="Enter right part of &&"]; - 186 [label="Access variable R|/b|"]; - 187 [label="Stub" style="filled" fillcolor=gray]; - 188 [label="Exit &&"]; - } - 189 [label="Exit when branch condition"]; - } - subgraph cluster_61 { - color=blue - 190 [label="Enter when branch condition else"]; - 191 [label="Exit when branch condition"]; - } - 192 [label="Enter when branch result"]; - subgraph cluster_62 { - color=blue - 193 [label="Enter block"]; - 194 [label="Exit block"]; - } - 195 [label="Exit when branch result"]; - 196 [label="Enter when branch result"]; - subgraph cluster_63 { - color=blue - 197 [label="Enter block"]; - 198 [label="Const: Int(1)"]; - 199 [label="Exit block"]; - } - 200 [label="Exit when branch result"]; - 201 [label="Exit when"]; - } - 202 [label="Exit block"]; - } - 203 [label="Exit function test_8" style="filled" fillcolor=red]; - } - - 178 -> {179}; - 179 -> {180}; - 180 -> {181}; - 181 -> {182}; - 182 -> {183}; - 183 -> {184}; - 184 -> {185}; - 184 -> {187} [style=dotted]; - 185 -> {186}; - 186 -> {188}; - 187 -> {188} [style=dotted]; - 188 -> {189}; - 189 -> {196 190}; - 190 -> {191}; - 191 -> {192}; - 192 -> {193}; - 193 -> {194}; - 194 -> {195}; - 195 -> {201}; - 196 -> {197}; - 197 -> {198}; - 198 -> {199}; - 199 -> {200}; - 200 -> {201}; - 201 -> {202}; - 202 -> {203}; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.txt b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.txt index cbde24debd4..176c8294695 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.txt @@ -4,8 +4,6 @@ FILE: booleanOperatorsWithConsts.kt R|/b| || Boolean(false) -> { Int(1) } - else -> { - } } } @@ -14,8 +12,6 @@ FILE: booleanOperatorsWithConsts.kt Boolean(false) || R|/b| -> { Int(1) } - else -> { - } } } @@ -24,8 +20,6 @@ FILE: booleanOperatorsWithConsts.kt R|/b| || Boolean(true) -> { Int(1) } - else -> { - } } } @@ -34,8 +28,6 @@ FILE: booleanOperatorsWithConsts.kt Boolean(true) || R|/b| -> { Int(1) } - else -> { - } } } @@ -44,8 +36,6 @@ FILE: booleanOperatorsWithConsts.kt R|/b| && Boolean(false) -> { Int(1) } - else -> { - } } } @@ -54,8 +44,6 @@ FILE: booleanOperatorsWithConsts.kt Boolean(false) && R|/b| -> { Int(1) } - else -> { - } } } @@ -64,8 +52,6 @@ FILE: booleanOperatorsWithConsts.kt R|/b| && Boolean(true) -> { Int(1) } - else -> { - } } } @@ -74,8 +60,6 @@ FILE: booleanOperatorsWithConsts.kt Boolean(true) && R|/b| -> { Int(1) } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.dot b/compiler/fir/resolve/testData/resolve/cfg/complex.dot index 9ad87b0e41e..4840c6024e4 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.dot @@ -325,42 +325,31 @@ digraph complex_kt { 111 [label="Type operator: element is T"]; 112 [label="Exit when branch condition"]; } + 113 [label="Synthetic else branch"]; + 114 [label="Enter when branch result"]; subgraph cluster_33 { color=blue - 113 [label="Enter when branch condition else"]; - 114 [label="Exit when branch condition"]; + 115 [label="Enter block"]; + 116 [label="Access variable R|/element|"]; + 117 [label="Jump: ^firstIsInstanceOrNull R|/element|"]; + 118 [label="Stub" style="filled" fillcolor=gray]; + 119 [label="Exit block" style="filled" fillcolor=gray]; } - 115 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 116 [label="Enter block"]; - 117 [label="Exit block"]; - } - 118 [label="Exit when branch result"]; - 119 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 120 [label="Enter block"]; - 121 [label="Access variable R|/element|"]; - 122 [label="Jump: ^firstIsInstanceOrNull R|/element|"]; - 123 [label="Stub" style="filled" fillcolor=gray]; - 124 [label="Exit block" style="filled" fillcolor=gray]; - } - 125 [label="Exit when branch result" style="filled" fillcolor=gray]; - 126 [label="Exit when"]; + 120 [label="Exit when branch result" style="filled" fillcolor=gray]; + 121 [label="Exit when"]; } - 127 [label="Exit block"]; + 122 [label="Exit block"]; } - 128 [label="Exit loop block"]; + 123 [label="Exit loop block"]; } - 129 [label="Exit whileloop"]; + 124 [label="Exit whileloop"]; } - 130 [label="Const: Null(null)"]; - 131 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; - 132 [label="Stub" style="filled" fillcolor=gray]; - 133 [label="Exit block" style="filled" fillcolor=gray]; + 125 [label="Const: Null(null)"]; + 126 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; + 127 [label="Stub" style="filled" fillcolor=gray]; + 128 [label="Exit block" style="filled" fillcolor=gray]; } - 134 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; + 129 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; } 91 -> {92}; @@ -374,7 +363,7 @@ digraph complex_kt { 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {129 103}; + 102 -> {124 103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; @@ -384,29 +373,24 @@ digraph complex_kt { 109 -> {110}; 110 -> {111}; 111 -> {112}; - 112 -> {119 113}; - 113 -> {114}; + 112 -> {114 113}; + 113 -> {121}; 114 -> {115}; 115 -> {116}; 116 -> {117}; - 117 -> {118}; - 118 -> {126}; - 119 -> {120}; - 120 -> {121}; + 117 -> {129}; + 117 -> {118} [style=dotted]; + 118 -> {119} [style=dotted]; + 119 -> {120} [style=dotted]; + 120 -> {121} [style=dotted]; 121 -> {122}; - 122 -> {134}; - 122 -> {123} [style=dotted]; - 123 -> {124} [style=dotted]; - 124 -> {125} [style=dotted]; - 125 -> {126} [style=dotted]; - 126 -> {127}; - 127 -> {128}; - 128 -> {99}; - 129 -> {130}; - 130 -> {131}; - 131 -> {134}; - 131 -> {132} [style=dotted]; - 132 -> {133} [style=dotted]; - 133 -> {134} [style=dotted]; + 122 -> {123}; + 123 -> {99}; + 124 -> {125}; + 125 -> {126}; + 126 -> {129}; + 126 -> {127} [style=dotted]; + 127 -> {128} [style=dotted]; + 128 -> {129} [style=dotted]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.txt b/compiler/fir/resolve/testData/resolve/cfg/complex.txt index 58b445b03b9..808681c086b 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.txt @@ -47,8 +47,6 @@ FILE: complex.kt (R|/element| is R|T|) -> { ^firstIsInstanceOrNull R|/element| } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot index 24c8aafda6f..0c110ef4d38 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot @@ -307,38 +307,27 @@ digraph jumps_kt { 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 - 106 [label="Enter when branch condition else"]; - 107 [label="Exit when branch condition"]; + 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]; } - 108 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 109 [label="Enter block"]; - 110 [label="Exit block"]; - } - 111 [label="Exit when branch result"]; - 112 [label="Enter when branch result"]; - subgraph cluster_36 { - color=blue - 113 [label="Enter block"]; - 114 [label="Jump: continue@@@[R|/b|] "]; - 115 [label="Stub" style="filled" fillcolor=gray]; - 116 [label="Exit block" style="filled" fillcolor=gray]; - } - 117 [label="Exit when branch result" style="filled" fillcolor=gray]; - 118 [label="Exit when"]; + 112 [label="Exit when branch result" style="filled" fillcolor=gray]; + 113 [label="Exit when"]; } - 119 [label="Exit block"]; + 114 [label="Exit block"]; } - 120 [label="Exit loop block"]; + 115 [label="Exit loop block"]; } - 121 [label="Exit whileloop"]; + 116 [label="Exit whileloop"]; } - 122 [label="Exit block"]; + 117 [label="Exit block"]; } - 123 [label="Exit function test_5" style="filled" fillcolor=red]; + 118 [label="Exit function test_5" style="filled" fillcolor=red]; } 94 -> {95}; @@ -346,86 +335,81 @@ digraph jumps_kt { 96 -> {97}; 97 -> {98}; 98 -> {99}; - 99 -> {121 100}; + 99 -> {116 100}; 100 -> {101}; 101 -> {102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; - 105 -> {112 106}; - 106 -> {107}; + 105 -> {107 106}; + 106 -> {113}; 107 -> {108}; 108 -> {109}; - 109 -> {110}; - 110 -> {111}; - 111 -> {118}; - 112 -> {113}; + 109 -> {96}; + 109 -> {110} [style=dotted]; + 110 -> {111} [style=dotted]; + 111 -> {112} [style=dotted]; + 112 -> {113} [style=dotted]; 113 -> {114}; - 114 -> {96}; - 114 -> {115} [style=dotted]; - 115 -> {116} [style=dotted]; - 116 -> {117} [style=dotted]; - 117 -> {118} [style=dotted]; - 118 -> {119}; + 114 -> {115}; + 115 -> {97}; + 116 -> {117}; + 117 -> {118}; + + subgraph cluster_35 { + color=red + 119 [label="Enter function run" style="filled" fillcolor=red]; + subgraph cluster_36 { + color=blue + 120 [label="Enter block"]; + 121 [label="Function call: R|/block|.R|FakeOverride|()"]; + 122 [label="Exit block"]; + } + 123 [label="Exit function run" style="filled" fillcolor=red]; + } + 119 -> {120}; - 120 -> {97}; + 120 -> {121}; 121 -> {122}; 122 -> {123}; subgraph cluster_37 { color=red - 124 [label="Enter function run" style="filled" fillcolor=red]; + 124 [label="Enter function test_6" style="filled" fillcolor=red]; subgraph cluster_38 { color=blue 125 [label="Enter block"]; - 126 [label="Function call: R|/block|.R|FakeOverride|()"]; - 127 [label="Exit block"]; + subgraph cluster_39 { + color=blue + 126 [label="Enter function anonymousFunction"]; + subgraph cluster_40 { + color=blue + 127 [label="Enter block"]; + 128 [label="Jump: ^@run Unit"]; + 129 [label="Stub" style="filled" fillcolor=gray]; + 130 [label="Exit block" style="filled" fillcolor=gray]; + } + 131 [label="Exit function anonymousFunction"]; + } + 132 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + ^@run Unit +} +)"]; + 133 [label="Exit block"]; } - 128 [label="Exit function run" style="filled" fillcolor=red]; + 134 [label="Exit function test_6" style="filled" fillcolor=red]; } 124 -> {125}; 125 -> {126}; 126 -> {127}; 127 -> {128}; - - subgraph cluster_39 { - color=red - 129 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_40 { - color=blue - 130 [label="Enter block"]; - subgraph cluster_41 { - color=blue - 131 [label="Enter function anonymousFunction"]; - subgraph cluster_42 { - 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]; - } - 136 [label="Exit function anonymousFunction"]; - } - 137 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { - ^@run Unit -} -)"]; - 138 [label="Exit block"]; - } - 139 [label="Exit function test_6" style="filled" fillcolor=red]; - } - - 129 -> {130}; - 130 -> {131}; + 128 -> {131}; + 128 -> {129} [style=dotted]; + 129 -> {130} [style=dotted]; + 130 -> {131} [style=dotted]; 131 -> {132}; 132 -> {133}; - 133 -> {136}; - 133 -> {134} [style=dotted]; - 134 -> {135} [style=dotted]; - 135 -> {136} [style=dotted]; - 136 -> {137}; - 137 -> {138}; - 138 -> {139}; + 133 -> {134}; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/jumps.txt b/compiler/fir/resolve/testData/resolve/cfg/jumps.txt index 50ff789a987..95b10f67d0c 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/jumps.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/jumps.txt @@ -45,8 +45,6 @@ FILE: jumps.kt R|/b| -> { continue@@@[R|/b|] } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot index a3628a918b4..00a2340f70e 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot @@ -36,46 +36,35 @@ digraph lambdas_kt { 10 [label="Type operator: x is Int"]; 11 [label="Exit when branch condition"]; } + 12 [label="Synthetic else branch"]; + 13 [label="Enter when branch result"]; subgraph cluster_6 { color=blue - 12 [label="Enter when branch condition else"]; - 13 [label="Exit when branch condition"]; - } - 14 [label="Enter when branch result"]; - subgraph cluster_7 { - color=blue - 15 [label="Enter block"]; - 16 [label="Exit block"]; - } - 17 [label="Exit when branch result"]; - 18 [label="Enter when branch result"]; - subgraph cluster_8 { - color=blue - 19 [label="Enter block"]; - subgraph cluster_9 { + 14 [label="Enter block"]; + subgraph cluster_7 { color=blue - 20 [label="Enter function anonymousFunction"]; - subgraph cluster_10 { + 15 [label="Enter function anonymousFunction"]; + subgraph cluster_8 { color=blue - 21 [label="Enter block"]; - 22 [label="Access variable R|/x|"]; - 23 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 24 [label="Exit block"]; + 16 [label="Enter block"]; + 17 [label="Access variable R|/x|"]; + 18 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 19 [label="Exit block"]; } - 25 [label="Exit function anonymousFunction"]; + 20 [label="Exit function anonymousFunction"]; } - 26 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + 21 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { R|/x|.R|kotlin/Int.inc|() } )"]; - 27 [label="Exit block"]; + 22 [label="Exit block"]; } - 28 [label="Exit when branch result"]; - 29 [label="Exit when"]; + 23 [label="Exit when branch result"]; + 24 [label="Exit when"]; } - 30 [label="Exit block"]; + 25 [label="Exit block"]; } - 31 [label="Exit function test_1" style="filled" fillcolor=red]; + 26 [label="Exit function test_1" style="filled" fillcolor=red]; } 5 -> {6}; @@ -84,13 +73,13 @@ digraph lambdas_kt { 8 -> {9}; 9 -> {10}; 10 -> {11}; - 11 -> {18 12}; - 12 -> {13}; + 11 -> {13 12}; + 12 -> {24}; 13 -> {14}; 14 -> {15}; 15 -> {16}; 16 -> {17}; - 17 -> {29}; + 17 -> {18}; 18 -> {19}; 19 -> {20}; 20 -> {21}; @@ -99,213 +88,192 @@ digraph lambdas_kt { 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {27}; + + subgraph cluster_9 { + color=red + 27 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_10 { + color=blue + 28 [label="Enter block"]; + subgraph cluster_11 { + color=blue + 29 [label="Enter when"]; + subgraph cluster_12 { + color=blue + 30 [label="Enter when branch condition "]; + 31 [label="Access variable R|/x|"]; + 32 [label="Type operator: x is Int"]; + 33 [label="Exit when branch condition"]; + } + 34 [label="Synthetic else branch"]; + 35 [label="Enter when branch result"]; + subgraph cluster_13 { + color=blue + 36 [label="Enter block"]; + 37 [label="Variable declaration: lval lambda: R|kotlin/Function0|"]; + 38 [label="Exit block"]; + } + 39 [label="Exit when branch result"]; + 40 [label="Exit when"]; + } + 41 [label="Exit block"]; + } + 42 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 27 -> {28}; 28 -> {29}; 29 -> {30}; 30 -> {31}; - - subgraph cluster_11 { - color=red - 32 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_12 { - color=blue - 33 [label="Enter block"]; - subgraph cluster_13 { - color=blue - 34 [label="Enter when"]; - subgraph cluster_14 { - color=blue - 35 [label="Enter when branch condition "]; - 36 [label="Access variable R|/x|"]; - 37 [label="Type operator: x is Int"]; - 38 [label="Exit when branch condition"]; - } - subgraph cluster_15 { - color=blue - 39 [label="Enter when branch condition else"]; - 40 [label="Exit when branch condition"]; - } - 41 [label="Enter when branch result"]; - subgraph cluster_16 { - color=blue - 42 [label="Enter block"]; - 43 [label="Exit block"]; - } - 44 [label="Exit when branch result"]; - 45 [label="Enter when branch result"]; - subgraph cluster_17 { - color=blue - 46 [label="Enter block"]; - 47 [label="Variable declaration: lval lambda: R|kotlin/Function0|"]; - 48 [label="Exit block"]; - } - 49 [label="Exit when branch result"]; - 50 [label="Exit when"]; - } - 51 [label="Exit block"]; - } - 52 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 31 -> {32}; 32 -> {33}; - 33 -> {34}; - 34 -> {35}; + 33 -> {35 34}; + 34 -> {40}; 35 -> {36}; 36 -> {37}; 37 -> {38}; - 38 -> {45 39}; + 38 -> {39}; 39 -> {40}; 40 -> {41}; 41 -> {42}; - 42 -> {43}; + + subgraph cluster_14 { + color=red + 43 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_15 { + color=blue + 44 [label="Enter block"]; + 45 [label="Access variable R|/x|"]; + 46 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 47 [label="Exit block"]; + } + 48 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + } + 43 -> {44}; - 44 -> {50}; + 44 -> {45}; 45 -> {46}; 46 -> {47}; 47 -> {48}; - 48 -> {49}; + + subgraph cluster_16 { + color=red + 49 [label="Enter function getInt" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 50 [label="Enter block"]; + 51 [label="Function call: R|/block|.R|FakeOverride|()"]; + 52 [label="Const: Int(1)"]; + 53 [label="Jump: ^getInt Int(1)"]; + 54 [label="Stub" style="filled" fillcolor=gray]; + 55 [label="Exit block" style="filled" fillcolor=gray]; + } + 56 [label="Exit function getInt" style="filled" fillcolor=red]; + } + 49 -> {50}; 50 -> {51}; 51 -> {52}; + 52 -> {53}; + 53 -> {56}; + 53 -> {54} [style=dotted]; + 54 -> {55} [style=dotted]; + 55 -> {56} [style=dotted]; subgraph cluster_18 { color=red - 53 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 57 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_19 { color=blue - 54 [label="Enter block"]; - 55 [label="Access variable R|/x|"]; - 56 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 57 [label="Exit block"]; + 58 [label="Enter block"]; + subgraph cluster_20 { + color=blue + 59 [label="Enter function anonymousFunction"]; + subgraph cluster_21 { + color=blue + 60 [label="Enter block"]; + 61 [label="Const: Int(1)"]; + 62 [label="Jump: ^test_3 Int(1)"]; + 63 [label="Stub" style="filled" fillcolor=gray]; + 64 [label="Exit block" style="filled" fillcolor=gray]; + } + 65 [label="Exit function anonymousFunction" style="filled" fillcolor=gray]; + } + 66 [label="Function call: R|/getInt|( = getInt@fun (): R|kotlin/Unit| { + ^test_3 Int(1) +} +)" style="filled" fillcolor=gray]; + 67 [label="Jump: ^test_3 R|/getInt|( = getInt@fun (): R|kotlin/Unit| { + ^test_3 Int(1) +} +)" style="filled" fillcolor=gray]; + 68 [label="Stub" style="filled" fillcolor=gray]; + 69 [label="Exit block" style="filled" fillcolor=gray]; } - 58 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 70 [label="Exit function test_3" style="filled" fillcolor=red]; } - 53 -> {54}; - 54 -> {55}; - 55 -> {56}; - 56 -> {57}; 57 -> {58}; - - subgraph cluster_20 { - color=red - 59 [label="Enter function getInt" style="filled" fillcolor=red]; - subgraph cluster_21 { - color=blue - 60 [label="Enter block"]; - 61 [label="Function call: R|/block|.R|FakeOverride|()"]; - 62 [label="Const: Int(1)"]; - 63 [label="Jump: ^getInt Int(1)"]; - 64 [label="Stub" style="filled" fillcolor=gray]; - 65 [label="Exit block" style="filled" fillcolor=gray]; - } - 66 [label="Exit function getInt" style="filled" fillcolor=red]; - } - + 58 -> {59}; 59 -> {60}; 60 -> {61}; 61 -> {62}; - 62 -> {63}; - 63 -> {66}; + 62 -> {70}; + 62 -> {63} [style=dotted]; 63 -> {64} [style=dotted]; 64 -> {65} [style=dotted]; 65 -> {66} [style=dotted]; + 66 -> {67} [style=dotted]; + 67 -> {70 68} [style=dotted]; + 68 -> {69} [style=dotted]; + 69 -> {70} [style=dotted]; subgraph cluster_22 { color=red - 67 [label="Enter function test_3" style="filled" fillcolor=red]; + 71 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 68 [label="Enter block"]; + 72 [label="Enter block"]; subgraph cluster_24 { color=blue - 69 [label="Enter function anonymousFunction"]; + 73 [label="Enter function anonymousFunction"]; subgraph cluster_25 { color=blue - 70 [label="Enter block"]; - 71 [label="Const: Int(1)"]; - 72 [label="Jump: ^test_3 Int(1)"]; - 73 [label="Stub" style="filled" fillcolor=gray]; - 74 [label="Exit block" style="filled" fillcolor=gray]; + 74 [label="Enter block"]; + 75 [label="Const: Int(1)"]; + 76 [label="Jump: ^test_4 Int(1)"]; + 77 [label="Stub" style="filled" fillcolor=gray]; + 78 [label="Exit block" style="filled" fillcolor=gray]; } - 75 [label="Exit function anonymousFunction" style="filled" fillcolor=gray]; + 79 [label="Exit function anonymousFunction" style="filled" fillcolor=gray]; } - 76 [label="Function call: R|/getInt|( = getInt@fun (): R|kotlin/Unit| { - ^test_3 Int(1) + 80 [label="Function call: R|/getInt|(block = getInt@fun (): R|kotlin/Unit| { + ^test_4 Int(1) } )" style="filled" fillcolor=gray]; - 77 [label="Jump: ^test_3 R|/getInt|( = getInt@fun (): R|kotlin/Unit| { - ^test_3 Int(1) + 81 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun (): R|kotlin/Unit| { + ^test_4 Int(1) } )" style="filled" fillcolor=gray]; - 78 [label="Stub" style="filled" fillcolor=gray]; - 79 [label="Exit block" style="filled" fillcolor=gray]; + 82 [label="Stub" style="filled" fillcolor=gray]; + 83 [label="Exit block" style="filled" fillcolor=gray]; } - 80 [label="Exit function test_3" style="filled" fillcolor=red]; + 84 [label="Exit function test_4" style="filled" fillcolor=red]; } - 67 -> {68}; - 68 -> {69}; - 69 -> {70}; - 70 -> {71}; 71 -> {72}; - 72 -> {80}; - 72 -> {73} [style=dotted]; - 73 -> {74} [style=dotted]; - 74 -> {75} [style=dotted]; - 75 -> {76} [style=dotted]; + 72 -> {73}; + 73 -> {74}; + 74 -> {75}; + 75 -> {76}; + 76 -> {84}; 76 -> {77} [style=dotted]; - 77 -> {80 78} [style=dotted]; + 77 -> {78} [style=dotted]; 78 -> {79} [style=dotted]; 79 -> {80} [style=dotted]; - - subgraph cluster_26 { - color=red - 81 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_27 { - color=blue - 82 [label="Enter block"]; - subgraph cluster_28 { - color=blue - 83 [label="Enter function anonymousFunction"]; - subgraph cluster_29 { - color=blue - 84 [label="Enter block"]; - 85 [label="Const: Int(1)"]; - 86 [label="Jump: ^test_4 Int(1)"]; - 87 [label="Stub" style="filled" fillcolor=gray]; - 88 [label="Exit block" style="filled" fillcolor=gray]; - } - 89 [label="Exit function anonymousFunction" style="filled" fillcolor=gray]; - } - 90 [label="Function call: R|/getInt|(block = getInt@fun (): R|kotlin/Unit| { - ^test_4 Int(1) -} -)" style="filled" fillcolor=gray]; - 91 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun (): R|kotlin/Unit| { - ^test_4 Int(1) -} -)" style="filled" fillcolor=gray]; - 92 [label="Stub" style="filled" fillcolor=gray]; - 93 [label="Exit block" style="filled" fillcolor=gray]; - } - 94 [label="Exit function test_4" style="filled" fillcolor=red]; - } - - 81 -> {82}; - 82 -> {83}; - 83 -> {84}; - 84 -> {85}; - 85 -> {86}; - 86 -> {94}; - 86 -> {87} [style=dotted]; - 87 -> {88} [style=dotted]; - 88 -> {89} [style=dotted]; - 89 -> {90} [style=dotted]; - 90 -> {91} [style=dotted]; - 91 -> {94 92} [style=dotted]; - 92 -> {93} [style=dotted]; - 93 -> {94} [style=dotted]; + 80 -> {81} [style=dotted]; + 81 -> {84 82} [style=dotted]; + 82 -> {83} [style=dotted]; + 83 -> {84} [style=dotted]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/lambdas.txt b/compiler/fir/resolve/testData/resolve/cfg/lambdas.txt index ceadab5488b..65d0c31a73b 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/lambdas.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/lambdas.txt @@ -10,8 +10,6 @@ FILE: lambdas.kt } ) } - else -> { - } } } @@ -23,8 +21,6 @@ FILE: lambdas.kt } } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/cfg/loops.dot b/compiler/fir/resolve/testData/resolve/cfg/loops.dot index 6fb2f28e759..0721d14aefe 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/loops.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/loops.dot @@ -272,40 +272,29 @@ digraph loops_kt { 91 [label="Access variable R|/b|"]; 92 [label="Exit when branch condition"]; } + 93 [label="Synthetic else branch"]; + 94 [label="Enter when branch result"]; subgraph cluster_32 { color=blue - 93 [label="Enter when branch condition else"]; - 94 [label="Exit when branch condition"]; + 95 [label="Enter block"]; + 96 [label="Jump: break@@@[Boolean(true)] "]; + 97 [label="Stub" style="filled" fillcolor=gray]; + 98 [label="Exit block" style="filled" fillcolor=gray]; } - 95 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 96 [label="Enter block"]; - 97 [label="Exit block"]; - } - 98 [label="Exit when branch result"]; - 99 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 100 [label="Enter block"]; - 101 [label="Jump: break@@@[Boolean(true)] "]; - 102 [label="Stub" style="filled" fillcolor=gray]; - 103 [label="Exit block" style="filled" fillcolor=gray]; - } - 104 [label="Exit when branch result" style="filled" fillcolor=gray]; - 105 [label="Exit when"]; + 99 [label="Exit when branch result" style="filled" fillcolor=gray]; + 100 [label="Exit when"]; } - 106 [label="Exit block"]; + 101 [label="Exit block"]; } - 107 [label="Exit loop block"]; + 102 [label="Exit loop block"]; } - 108 [label="Stub" style="filled" fillcolor=gray]; - 109 [label="Exit whileloop"]; + 103 [label="Stub" style="filled" fillcolor=gray]; + 104 [label="Exit whileloop"]; } - 110 [label="Const: Int(1)"]; - 111 [label="Exit block"]; + 105 [label="Const: Int(1)"]; + 106 [label="Exit block"]; } - 112 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red]; + 107 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red]; } 81 -> {82}; @@ -314,288 +303,267 @@ digraph loops_kt { 84 -> {85}; 85 -> {86}; 86 -> {87}; - 86 -> {108} [style=dotted]; + 86 -> {103} [style=dotted]; 87 -> {88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; - 92 -> {99 93}; - 93 -> {94}; + 92 -> {94 93}; + 93 -> {100}; 94 -> {95}; 95 -> {96}; - 96 -> {97}; - 97 -> {98}; - 98 -> {105}; - 99 -> {100}; + 96 -> {104}; + 96 -> {97} [style=dotted]; + 97 -> {98} [style=dotted]; + 98 -> {99} [style=dotted]; + 99 -> {100} [style=dotted]; 100 -> {101}; - 101 -> {109}; - 101 -> {102} [style=dotted]; - 102 -> {103} [style=dotted]; + 101 -> {102}; + 102 -> {84}; 103 -> {104} [style=dotted]; - 104 -> {105} [style=dotted]; + 104 -> {105}; 105 -> {106}; 106 -> {107}; - 107 -> {84}; - 108 -> {109} [style=dotted]; + + subgraph cluster_33 { + color=red + 108 [label="Enter function testWhileFalse" style="filled" fillcolor=red]; + subgraph cluster_34 { + color=blue + 109 [label="Enter block"]; + subgraph cluster_35 { + color=blue + 110 [label="Enter while loop"]; + subgraph cluster_36 { + color=blue + 111 [label="Enter loop condition"]; + 112 [label="Const: Boolean(false)"]; + 113 [label="Exit loop condition"]; + } + 114 [label="Stub" style="filled" fillcolor=gray]; + subgraph cluster_37 { + color=blue + 115 [label="Enter loop block" style="filled" fillcolor=gray]; + subgraph cluster_38 { + color=blue + 116 [label="Enter block" style="filled" fillcolor=gray]; + 117 [label="Const: Int(1)" style="filled" fillcolor=gray]; + 118 [label="Exit block" style="filled" fillcolor=gray]; + } + 119 [label="Exit loop block" style="filled" fillcolor=gray]; + } + 120 [label="Exit whileloop"]; + } + 121 [label="Const: Int(1)"]; + 122 [label="Exit block"]; + } + 123 [label="Exit function testWhileFalse" style="filled" fillcolor=red]; + } + + 108 -> {109}; 109 -> {110}; 110 -> {111}; 111 -> {112}; + 112 -> {113}; + 113 -> {120}; + 113 -> {114} [style=dotted]; + 114 -> {115} [style=dotted]; + 115 -> {116} [style=dotted]; + 116 -> {117} [style=dotted]; + 117 -> {118} [style=dotted]; + 118 -> {119} [style=dotted]; + 119 -> {111} [style=dotted]; + 120 -> {121}; + 121 -> {122}; + 122 -> {123}; - subgraph cluster_35 { + subgraph cluster_39 { color=red - 113 [label="Enter function testWhileFalse" style="filled" fillcolor=red]; - subgraph cluster_36 { + 124 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red]; + subgraph cluster_40 { color=blue - 114 [label="Enter block"]; - subgraph cluster_37 { + 125 [label="Enter block"]; + subgraph cluster_41 { color=blue - 115 [label="Enter while loop"]; - subgraph cluster_38 { + 126 [label="Enter do-while loop"]; + subgraph cluster_42 { color=blue - 116 [label="Enter loop condition"]; - 117 [label="Const: Boolean(false)"]; - 118 [label="Exit loop condition"]; - } - 119 [label="Stub" style="filled" fillcolor=gray]; - subgraph cluster_39 { - color=blue - 120 [label="Enter loop block" style="filled" fillcolor=gray]; - subgraph cluster_40 { + 127 [label="Enter loop block"]; + subgraph cluster_43 { color=blue - 121 [label="Enter block" style="filled" fillcolor=gray]; - 122 [label="Const: Int(1)" style="filled" fillcolor=gray]; - 123 [label="Exit block" style="filled" fillcolor=gray]; + 128 [label="Enter block"]; + 129 [label="Const: Int(1)"]; + 130 [label="Exit block"]; } - 124 [label="Exit loop block" style="filled" fillcolor=gray]; + 131 [label="Exit loop block"]; } - 125 [label="Exit whileloop"]; + subgraph cluster_44 { + color=blue + 132 [label="Enter loop condition"]; + 133 [label="Const: Boolean(true)"]; + 134 [label="Exit loop condition"]; + } + 135 [label="Stub" style="filled" fillcolor=gray]; + 136 [label="Exit do-whileloop" style="filled" fillcolor=gray]; } - 126 [label="Const: Int(1)"]; - 127 [label="Exit block"]; + 137 [label="Const: Int(1)" style="filled" fillcolor=gray]; + 138 [label="Exit block" style="filled" fillcolor=gray]; } - 128 [label="Exit function testWhileFalse" style="filled" fillcolor=red]; + 139 [label="Exit function testDoWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray]; } - 113 -> {114}; - 114 -> {115}; - 115 -> {116}; - 116 -> {117}; - 117 -> {118}; - 118 -> {125}; - 118 -> {119} [style=dotted]; - 119 -> {120} [style=dotted]; - 120 -> {121} [style=dotted]; - 121 -> {122} [style=dotted]; - 122 -> {123} [style=dotted]; - 123 -> {124} [style=dotted]; - 124 -> {116} [style=dotted]; + 124 -> {125}; 125 -> {126}; 126 -> {127}; 127 -> {128}; - - subgraph cluster_41 { - color=red - 129 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red]; - subgraph cluster_42 { - color=blue - 130 [label="Enter block"]; - subgraph cluster_43 { - color=blue - 131 [label="Enter do-while loop"]; - subgraph cluster_44 { - color=blue - 132 [label="Enter loop block"]; - subgraph cluster_45 { - color=blue - 133 [label="Enter block"]; - 134 [label="Const: Int(1)"]; - 135 [label="Exit block"]; - } - 136 [label="Exit loop block"]; - } - subgraph cluster_46 { - color=blue - 137 [label="Enter loop condition"]; - 138 [label="Const: Boolean(true)"]; - 139 [label="Exit loop condition"]; - } - 140 [label="Stub" style="filled" fillcolor=gray]; - 141 [label="Exit do-whileloop" style="filled" fillcolor=gray]; - } - 142 [label="Const: Int(1)" style="filled" fillcolor=gray]; - 143 [label="Exit block" style="filled" fillcolor=gray]; - } - 144 [label="Exit function testDoWhileTrue" style="filled" fillcolor=red style="filled" fillcolor=gray]; - } - + 128 -> {129}; 129 -> {130}; 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; - 134 -> {135}; - 135 -> {136}; - 136 -> {137}; - 137 -> {138}; - 138 -> {139}; - 139 -> {132}; - 139 -> {140} [style=dotted]; - 140 -> {141} [style=dotted]; - 141 -> {142} [style=dotted]; - 142 -> {143} [style=dotted]; - 143 -> {144} [style=dotted]; + 134 -> {127}; + 134 -> {135} [style=dotted]; + 135 -> {136} [style=dotted]; + 136 -> {137} [style=dotted]; + 137 -> {138} [style=dotted]; + 138 -> {139} [style=dotted]; - subgraph cluster_47 { + subgraph cluster_45 { color=red - 145 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; - subgraph cluster_48 { + 140 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; + subgraph cluster_46 { color=blue - 146 [label="Enter block"]; - subgraph cluster_49 { + 141 [label="Enter block"]; + subgraph cluster_47 { color=blue - 147 [label="Enter do-while loop"]; - subgraph cluster_50 { + 142 [label="Enter do-while loop"]; + subgraph cluster_48 { color=blue - 148 [label="Enter loop block"]; - subgraph cluster_51 { + 143 [label="Enter loop block"]; + subgraph cluster_49 { color=blue - 149 [label="Enter block"]; - subgraph cluster_52 { + 144 [label="Enter block"]; + subgraph cluster_50 { color=blue - 150 [label="Enter when"]; - subgraph cluster_53 { + 145 [label="Enter when"]; + subgraph cluster_51 { color=blue - 151 [label="Enter when branch condition "]; - 152 [label="Access variable R|/b|"]; - 153 [label="Exit when branch condition"]; + 146 [label="Enter when branch condition "]; + 147 [label="Access variable R|/b|"]; + 148 [label="Exit when branch condition"]; } - subgraph cluster_54 { + 149 [label="Synthetic else branch"]; + 150 [label="Enter when branch result"]; + subgraph cluster_52 { color=blue - 154 [label="Enter when branch condition else"]; - 155 [label="Exit when branch condition"]; + 151 [label="Enter block"]; + 152 [label="Jump: break@@@[Boolean(true)] "]; + 153 [label="Stub" style="filled" fillcolor=gray]; + 154 [label="Exit block" style="filled" fillcolor=gray]; } - 156 [label="Enter when branch result"]; - subgraph cluster_55 { - color=blue - 157 [label="Enter block"]; - 158 [label="Exit block"]; - } - 159 [label="Exit when branch result"]; - 160 [label="Enter when branch result"]; - subgraph cluster_56 { - color=blue - 161 [label="Enter block"]; - 162 [label="Jump: break@@@[Boolean(true)] "]; - 163 [label="Stub" style="filled" fillcolor=gray]; - 164 [label="Exit block" style="filled" fillcolor=gray]; - } - 165 [label="Exit when branch result" style="filled" fillcolor=gray]; - 166 [label="Exit when"]; + 155 [label="Exit when branch result" style="filled" fillcolor=gray]; + 156 [label="Exit when"]; } - 167 [label="Exit block"]; + 157 [label="Exit block"]; } - 168 [label="Exit loop block"]; + 158 [label="Exit loop block"]; } - subgraph cluster_57 { + subgraph cluster_53 { color=blue - 169 [label="Enter loop condition"]; - 170 [label="Const: Boolean(true)"]; - 171 [label="Exit loop condition"]; + 159 [label="Enter loop condition"]; + 160 [label="Const: Boolean(true)"]; + 161 [label="Exit loop condition"]; } - 172 [label="Stub" style="filled" fillcolor=gray]; - 173 [label="Exit do-whileloop"]; + 162 [label="Stub" style="filled" fillcolor=gray]; + 163 [label="Exit do-whileloop"]; } - 174 [label="Const: Int(1)"]; - 175 [label="Exit block"]; + 164 [label="Const: Int(1)"]; + 165 [label="Exit block"]; } - 176 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; + 166 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red]; } + 140 -> {141}; + 141 -> {142}; + 142 -> {143}; + 143 -> {144}; + 144 -> {145}; 145 -> {146}; 146 -> {147}; 147 -> {148}; - 148 -> {149}; - 149 -> {150}; + 148 -> {150 149}; + 149 -> {156}; 150 -> {151}; 151 -> {152}; - 152 -> {153}; - 153 -> {160 154}; - 154 -> {155}; - 155 -> {156}; + 152 -> {163}; + 152 -> {153} [style=dotted]; + 153 -> {154} [style=dotted]; + 154 -> {155} [style=dotted]; + 155 -> {156} [style=dotted]; 156 -> {157}; 157 -> {158}; 158 -> {159}; - 159 -> {166}; + 159 -> {160}; 160 -> {161}; - 161 -> {162}; - 162 -> {173}; + 161 -> {143}; + 161 -> {162} [style=dotted]; 162 -> {163} [style=dotted]; - 163 -> {164} [style=dotted]; - 164 -> {165} [style=dotted]; - 165 -> {166} [style=dotted]; - 166 -> {167}; + 163 -> {164}; + 164 -> {165}; + 165 -> {166}; + + subgraph cluster_54 { + color=red + 167 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red]; + subgraph cluster_55 { + color=blue + 168 [label="Enter block"]; + subgraph cluster_56 { + color=blue + 169 [label="Enter do-while loop"]; + subgraph cluster_57 { + color=blue + 170 [label="Enter loop block"]; + subgraph cluster_58 { + color=blue + 171 [label="Enter block"]; + 172 [label="Const: Int(1)"]; + 173 [label="Exit block"]; + } + 174 [label="Exit loop block"]; + } + subgraph cluster_59 { + color=blue + 175 [label="Enter loop condition"]; + 176 [label="Const: Boolean(false)"]; + 177 [label="Exit loop condition"]; + } + 178 [label="Exit do-whileloop"]; + } + 179 [label="Const: Int(1)"]; + 180 [label="Exit block"]; + } + 181 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red]; + } + 182 [label="Stub" style="filled" fillcolor=gray]; + 167 -> {168}; 168 -> {169}; 169 -> {170}; 170 -> {171}; - 171 -> {148}; - 171 -> {172} [style=dotted]; - 172 -> {173} [style=dotted]; + 171 -> {172}; + 172 -> {173}; 173 -> {174}; 174 -> {175}; 175 -> {176}; - - subgraph cluster_58 { - color=red - 177 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red]; - subgraph cluster_59 { - color=blue - 178 [label="Enter block"]; - subgraph cluster_60 { - color=blue - 179 [label="Enter do-while loop"]; - subgraph cluster_61 { - color=blue - 180 [label="Enter loop block"]; - subgraph cluster_62 { - color=blue - 181 [label="Enter block"]; - 182 [label="Const: Int(1)"]; - 183 [label="Exit block"]; - } - 184 [label="Exit loop block"]; - } - subgraph cluster_63 { - color=blue - 185 [label="Enter loop condition"]; - 186 [label="Const: Boolean(false)"]; - 187 [label="Exit loop condition"]; - } - 188 [label="Exit do-whileloop"]; - } - 189 [label="Const: Int(1)"]; - 190 [label="Exit block"]; - } - 191 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red]; - } - 192 [label="Stub" style="filled" fillcolor=gray]; - + 176 -> {177}; 177 -> {178}; + 177 -> {182} [style=dotted]; 178 -> {179}; 179 -> {180}; 180 -> {181}; - 181 -> {182}; - 182 -> {183}; - 183 -> {184}; - 184 -> {185}; - 185 -> {186}; - 186 -> {187}; - 187 -> {188}; - 187 -> {192} [style=dotted]; - 188 -> {189}; - 189 -> {190}; - 190 -> {191}; - 192 -> {180} [style=dotted]; + 182 -> {170} [style=dotted]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/loops.txt b/compiler/fir/resolve/testData/resolve/cfg/loops.txt index 728fbfcbe8f..bd89c08d468 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/loops.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/loops.txt @@ -36,8 +36,6 @@ FILE: loops.kt R|/b| -> { break@@@[Boolean(true)] } - else -> { - } } } @@ -64,8 +62,6 @@ FILE: loops.kt R|/b| -> { break@@@[Boolean(true)] } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot index 47fbe804d44..f2d3df72244 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot @@ -174,108 +174,86 @@ digraph tryCatch_kt { 54 [label="Access variable R|/b|"]; 55 [label="Exit when branch condition"]; } + 56 [label="Synthetic else branch"]; + 57 [label="Enter when branch result"]; subgraph cluster_27 { color=blue - 56 [label="Enter when branch condition else"]; - 57 [label="Exit when branch condition"]; + 58 [label="Enter block"]; + 59 [label="Jump: ^test_3 Unit"]; + 60 [label="Stub" style="filled" fillcolor=gray]; + 61 [label="Exit block" style="filled" fillcolor=gray]; } - 58 [label="Enter when branch result"]; - subgraph cluster_28 { - color=blue - 59 [label="Enter block"]; - 60 [label="Exit block"]; - } - 61 [label="Exit when branch result"]; - 62 [label="Enter when branch result"]; + 62 [label="Exit when branch result" style="filled" fillcolor=gray]; + 63 [label="Exit when"]; + } + 64 [label="Const: Int(1)"]; + 65 [label="Variable declaration: lval x: R|kotlin/Int|"]; + subgraph cluster_28 { + color=blue + 66 [label="Enter when"]; subgraph cluster_29 { color=blue - 63 [label="Enter block"]; - 64 [label="Jump: ^test_3 Unit"]; - 65 [label="Stub" style="filled" fillcolor=gray]; - 66 [label="Exit block" style="filled" fillcolor=gray]; + 67 [label="Enter when branch condition "]; + 68 [label="Access variable R|/b|"]; + 69 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 70 [label="Exit when branch condition"]; } - 67 [label="Exit when branch result" style="filled" fillcolor=gray]; - 68 [label="Exit when"]; + 71 [label="Synthetic else branch"]; + 72 [label="Enter when branch result"]; + subgraph cluster_30 { + color=blue + 73 [label="Enter block"]; + 74 [label="Jump: break@@@[Boolean(true)] "]; + 75 [label="Stub" style="filled" fillcolor=gray]; + 76 [label="Exit block" style="filled" fillcolor=gray]; + } + 77 [label="Exit when branch result" style="filled" fillcolor=gray]; + 78 [label="Exit when"]; } - 69 [label="Const: Int(1)"]; - 70 [label="Variable declaration: lval x: R|kotlin/Int|"]; - subgraph cluster_30 { - color=blue - 71 [label="Enter when"]; - subgraph cluster_31 { - color=blue - 72 [label="Enter when branch condition "]; - 73 [label="Access variable R|/b|"]; - 74 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 75 [label="Exit when branch condition"]; - } - subgraph cluster_32 { - color=blue - 76 [label="Enter when branch condition else"]; - 77 [label="Exit when branch condition"]; - } - 78 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 79 [label="Enter block"]; - 80 [label="Exit block"]; - } - 81 [label="Exit when branch result"]; - 82 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 83 [label="Enter block"]; - 84 [label="Jump: break@@@[Boolean(true)] "]; - 85 [label="Stub" style="filled" fillcolor=gray]; - 86 [label="Exit block" style="filled" fillcolor=gray]; - } - 87 [label="Exit when branch result" style="filled" fillcolor=gray]; - 88 [label="Exit when"]; - } - 89 [label="Exit block"]; + 79 [label="Exit block"]; } - 90 [label="Try main block exit"]; + 80 [label="Try main block exit"]; } - subgraph cluster_35 { + subgraph cluster_31 { color=blue - 91 [label="Catch enter"]; - subgraph cluster_36 { + 81 [label="Catch enter"]; + subgraph cluster_32 { color=blue - 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]; + 82 [label="Enter block"]; + 83 [label="Jump: break@@@[Boolean(true)] "]; + 84 [label="Stub" style="filled" fillcolor=gray]; + 85 [label="Exit block" style="filled" fillcolor=gray]; } - 96 [label="Catch exit" style="filled" fillcolor=gray]; + 86 [label="Catch exit" style="filled" fillcolor=gray]; } - subgraph cluster_37 { + subgraph cluster_33 { color=blue - 97 [label="Catch enter"]; - subgraph cluster_38 { + 87 [label="Catch enter"]; + subgraph cluster_34 { color=blue - 98 [label="Enter block"]; - 99 [label="Jump: continue@@@[Boolean(true)] "]; - 100 [label="Stub" style="filled" fillcolor=gray]; - 101 [label="Exit block" style="filled" fillcolor=gray]; + 88 [label="Enter block"]; + 89 [label="Jump: continue@@@[Boolean(true)] "]; + 90 [label="Stub" style="filled" fillcolor=gray]; + 91 [label="Exit block" style="filled" fillcolor=gray]; } - 102 [label="Catch exit" style="filled" fillcolor=gray]; + 92 [label="Catch exit" style="filled" fillcolor=gray]; } - 103 [label="Try expression exit"]; + 93 [label="Try expression exit"]; } - 104 [label="Const: Int(2)"]; - 105 [label="Variable declaration: lval y: R|kotlin/Int|"]; - 106 [label="Exit block"]; + 94 [label="Const: Int(2)"]; + 95 [label="Variable declaration: lval y: R|kotlin/Int|"]; + 96 [label="Exit block"]; } - 107 [label="Exit loop block"]; + 97 [label="Exit loop block"]; } - 108 [label="Stub" style="filled" fillcolor=gray]; - 109 [label="Exit whileloop"]; + 98 [label="Stub" style="filled" fillcolor=gray]; + 99 [label="Exit whileloop"]; } - 110 [label="Const: Int(3)"]; - 111 [label="Variable declaration: lval z: R|kotlin/Int|"]; - 112 [label="Exit block"]; + 100 [label="Const: Int(3)"]; + 101 [label="Variable declaration: lval z: R|kotlin/Int|"]; + 102 [label="Exit block"]; } - 113 [label="Exit function test_3" style="filled" fillcolor=red]; + 103 [label="Exit function test_3" style="filled" fillcolor=red]; } 41 -> {42}; @@ -284,76 +262,66 @@ digraph tryCatch_kt { 44 -> {45}; 45 -> {46}; 46 -> {47}; - 46 -> {108} [style=dotted]; + 46 -> {98} [style=dotted]; 47 -> {48}; 48 -> {49}; 49 -> {50}; - 50 -> {113 97 91 51}; + 50 -> {103 87 81 51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {62 56}; - 56 -> {57}; + 55 -> {57 56}; + 56 -> {63}; 57 -> {58}; 58 -> {59}; - 59 -> {60}; - 60 -> {61}; - 61 -> {68}; - 62 -> {63}; + 59 -> {103}; + 59 -> {60} [style=dotted]; + 60 -> {61} [style=dotted]; + 61 -> {62} [style=dotted]; + 62 -> {63} [style=dotted]; 63 -> {64}; - 64 -> {113}; - 64 -> {65} [style=dotted]; - 65 -> {66} [style=dotted]; - 66 -> {67} [style=dotted]; - 67 -> {68} [style=dotted]; + 64 -> {65}; + 65 -> {66}; + 66 -> {67}; + 67 -> {68}; 68 -> {69}; 69 -> {70}; - 70 -> {71}; - 71 -> {72}; + 70 -> {72 71}; + 71 -> {78}; 72 -> {73}; 73 -> {74}; - 74 -> {75}; - 75 -> {82 76}; - 76 -> {77}; - 77 -> {78}; + 74 -> {99}; + 74 -> {75} [style=dotted]; + 75 -> {76} [style=dotted]; + 76 -> {77} [style=dotted]; + 77 -> {78} [style=dotted]; 78 -> {79}; 79 -> {80}; - 80 -> {81}; - 81 -> {88}; + 80 -> {93}; + 81 -> {103 82}; 82 -> {83}; - 83 -> {84}; - 84 -> {109}; + 83 -> {99}; + 83 -> {84} [style=dotted]; 84 -> {85} [style=dotted]; 85 -> {86} [style=dotted]; - 86 -> {87} [style=dotted]; - 87 -> {88} [style=dotted]; + 86 -> {93} [style=dotted]; + 87 -> {103 88}; 88 -> {89}; - 89 -> {90}; - 90 -> {103}; - 91 -> {113 92}; - 92 -> {93}; - 93 -> {109}; - 93 -> {94} [style=dotted]; - 94 -> {95} [style=dotted]; - 95 -> {96} [style=dotted]; - 96 -> {103} [style=dotted]; - 97 -> {113 98}; - 98 -> {99}; - 99 -> {43}; - 99 -> {100} [style=dotted]; - 100 -> {101} [style=dotted]; - 101 -> {102} [style=dotted]; - 102 -> {103} [style=dotted]; - 103 -> {104}; - 104 -> {105}; - 105 -> {106}; - 106 -> {107}; - 107 -> {44}; - 108 -> {109} [style=dotted]; - 109 -> {110}; - 110 -> {111}; - 111 -> {112}; - 112 -> {113}; + 89 -> {43}; + 89 -> {90} [style=dotted]; + 90 -> {91} [style=dotted]; + 91 -> {92} [style=dotted]; + 92 -> {93} [style=dotted]; + 93 -> {94}; + 94 -> {95}; + 95 -> {96}; + 96 -> {97}; + 97 -> {44}; + 98 -> {99} [style=dotted]; + 99 -> {100}; + 100 -> {101}; + 101 -> {102}; + 102 -> {103}; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.txt b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.txt index c0d35202922..e372bbf6542 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.txt @@ -27,8 +27,6 @@ FILE: tryCatch.kt R|/b| -> { ^test_3 Unit } - else -> { - } } lval x: R|kotlin/Int| = Int(1) @@ -36,8 +34,6 @@ FILE: tryCatch.kt R|/b|.R|kotlin/Boolean.not|() -> { break@@@[Boolean(true)] } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/cfg/when.dot b/compiler/fir/resolve/testData/resolve/cfg/when.dot index c7e7270a230..45bf18ab9e3 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/when.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/when.dot @@ -161,32 +161,21 @@ digraph when_kt { } 61 [label="Exit when branch condition"]; } + 62 [label="Synthetic else branch"]; + 63 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 62 [label="Enter when branch condition else"]; - 63 [label="Exit when branch condition"]; + 64 [label="Enter block"]; + 65 [label="Access variable R|/x|"]; + 66 [label="Type operator: x is A"]; + 67 [label="Exit block"]; } - 64 [label="Enter when branch result"]; - subgraph cluster_17 { - color=blue - 65 [label="Enter block"]; - 66 [label="Exit block"]; - } - 67 [label="Exit when branch result"]; - 68 [label="Enter when branch result"]; - subgraph cluster_18 { - color=blue - 69 [label="Enter block"]; - 70 [label="Access variable R|/x|"]; - 71 [label="Type operator: x is A"]; - 72 [label="Exit block"]; - } - 73 [label="Exit when branch result"]; - 74 [label="Exit when"]; + 68 [label="Exit when branch result"]; + 69 [label="Exit when"]; } - 75 [label="Exit block"]; + 70 [label="Exit block"]; } - 76 [label="Exit function test_2" style="filled" fillcolor=red]; + 71 [label="Exit function test_2" style="filled" fillcolor=red]; } 49 -> {50}; @@ -201,20 +190,15 @@ digraph when_kt { 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {68 62}; - 62 -> {63}; + 61 -> {63 62}; + 62 -> {69}; 63 -> {64}; 64 -> {65}; 65 -> {66}; 66 -> {67}; - 67 -> {74}; + 67 -> {68}; 68 -> {69}; 69 -> {70}; 70 -> {71}; - 71 -> {72}; - 72 -> {73}; - 73 -> {74}; - 74 -> {75}; - 75 -> {76}; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/when.txt b/compiler/fir/resolve/testData/resolve/cfg/when.txt index 47a9c7deb71..52d5cf10911 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/when.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/when.txt @@ -25,8 +25,6 @@ FILE: when.kt (R|/x| is R|A|) && (R|/x| is R|B|) -> { (R|/x| is R|A|) } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/exhaustiveness_boolean.kt b/compiler/fir/resolve/testData/resolve/exhaustiveness_boolean.kt new file mode 100644 index 00000000000..1c7013b0ba0 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/exhaustiveness_boolean.kt @@ -0,0 +1,25 @@ +fun test_1(b: Boolean) { + val x = when (b) { + true -> 1 + } + val y = when (b) { + true -> 1 + false -> 2 + } + val z = when (b) { + true -> 1 + else -> 2 + } +} + +fun test_2(b: Boolean?) { + val x = when (b) { + true -> 1 + false -> 2 + } + val y = when (b) { + true -> 1 + false -> 2 + null -> 3 + } +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/exhaustiveness_boolean.txt b/compiler/fir/resolve/testData/resolve/exhaustiveness_boolean.txt new file mode 100644 index 00000000000..cb3b2d9b52b --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/exhaustiveness_boolean.txt @@ -0,0 +1,50 @@ +FILE: exhaustiveness_boolean.kt + public final fun test_1(b: R|kotlin/Boolean|): R|kotlin/Unit| { + lval x: R|kotlin/Any?| = when (R|/b|) { + ==($subj$, Boolean(true)) -> { + Int(1) + } + } + + lval y: R|kotlin/Int| = when (R|/b|) { + ==($subj$, Boolean(true)) -> { + Int(1) + } + ==($subj$, Boolean(false)) -> { + Int(2) + } + } + + lval z: R|kotlin/Int| = when (R|/b|) { + ==($subj$, Boolean(true)) -> { + Int(1) + } + else -> { + Int(2) + } + } + + } + public final fun test_2(b: R|kotlin/Boolean?|): R|kotlin/Unit| { + lval x: R|kotlin/Any?| = when (R|/b|) { + ==($subj$, Boolean(true)) -> { + Int(1) + } + ==($subj$, Boolean(false)) -> { + Int(2) + } + } + + lval y: R|kotlin/Int| = when (R|/b|) { + ==($subj$, Boolean(true)) -> { + Int(1) + } + ==($subj$, Boolean(false)) -> { + Int(2) + } + ==($subj$, Null(null)) -> { + Int(3) + } + } + + } diff --git a/compiler/fir/resolve/testData/resolve/exhaustiveness_enum.kt b/compiler/fir/resolve/testData/resolve/exhaustiveness_enum.kt new file mode 100644 index 00000000000..953cf3446a0 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/exhaustiveness_enum.kt @@ -0,0 +1,49 @@ +enum class Enum { + A, B, C +} + +fun test_1(e: Enum) { + val a = when (e) { + Enum.A -> 1 + Enum.B -> 2 + } + + val b = when (e) { + Enum.A -> 1 + Enum.B -> 2 + is String -> 3 + } + + val c = when (e) { + Enum.A -> 1 + Enum.B -> 2 + Enum.C -> 3 + } + + val d = when (e) { + Enum.A -> 1 + else -> 2 + } +} + +fun test_2(e: Enum?) { + val a = when (e) { + Enum.A -> 1 + Enum.B -> 2 + Enum.C -> 3 + } + + val a = when (e) { + Enum.A -> 1 + Enum.B -> 2 + Enum.C -> 3 + null -> 4 + } + + val a = when (e) { + Enum.A -> 1 + Enum.B -> 2 + Enum.C -> 3 + else -> 4 + } +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/exhaustiveness_enum.txt b/compiler/fir/resolve/testData/resolve/exhaustiveness_enum.txt new file mode 100644 index 00000000000..2a1c00da6c1 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/exhaustiveness_enum.txt @@ -0,0 +1,116 @@ +FILE: exhaustiveness_enum.kt + public final enum class Enum : R|kotlin/Enum| { + private constructor(): R|Enum| { + super() + } + + public final enum entry A : R|kotlin/Any| { + public constructor(): R|Enum.A| { + super() + } + + } + + public final enum entry B : R|kotlin/Any| { + public constructor(): R|Enum.B| { + super() + } + + } + + public final enum entry C : R|kotlin/Any| { + public constructor(): R|Enum.C| { + super() + } + + } + + } + public final fun test_1(e: R|Enum|): R|kotlin/Unit| { + lval a: R|kotlin/Any?| = when (R|/e|) { + ==($subj$, Q|Enum.A|) -> { + Int(1) + } + ==($subj$, Q|Enum.B|) -> { + Int(2) + } + } + + lval b: R|kotlin/Any?| = when (R|/e|) { + ==($subj$, Q|Enum.A|) -> { + Int(1) + } + ==($subj$, Q|Enum.B|) -> { + Int(2) + } + ($subj$ is R|kotlin/String|) -> { + Int(3) + } + } + + lval c: R|kotlin/Int| = when (R|/e|) { + ==($subj$, Q|Enum.A|) -> { + Int(1) + } + ==($subj$, Q|Enum.B|) -> { + Int(2) + } + ==($subj$, Q|Enum.C|) -> { + Int(3) + } + } + + lval d: R|kotlin/Int| = when (R|/e|) { + ==($subj$, Q|Enum.A|) -> { + Int(1) + } + else -> { + Int(2) + } + } + + } + public final fun test_2(e: R|Enum?|): R|kotlin/Unit| { + lval a: R|kotlin/Any?| = when (R|/e|) { + ==($subj$, Q|Enum.A|) -> { + Int(1) + } + ==($subj$, Q|Enum.B|) -> { + Int(2) + } + ==($subj$, Q|Enum.C|) -> { + Int(3) + } + } + + lval a: R|kotlin/Int| = when (R|/e|) { + ==($subj$, Q|Enum.A|) -> { + Int(1) + } + ==($subj$, Q|Enum.B|) -> { + Int(2) + } + ==($subj$, Q|Enum.C|) -> { + Int(3) + } + ==($subj$, Null(null)) -> { + Int(4) + } + } + + lval a: R|kotlin/Int| = when (R|/e|) { + ==($subj$, Q|Enum.A|) -> { + Int(1) + } + ==($subj$, Q|Enum.B|) -> { + Int(2) + } + ==($subj$, Q|Enum.C|) -> { + Int(3) + } + else -> { + Int(4) + } + } + + } diff --git a/compiler/fir/resolve/testData/resolve/exhaustiveness_sealedClass.kt b/compiler/fir/resolve/testData/resolve/exhaustiveness_sealedClass.kt new file mode 100644 index 00000000000..b903f63da44 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/exhaustiveness_sealedClass.kt @@ -0,0 +1,53 @@ +sealed class Base { + class A : Base() { + class B : Base() + } +} + +class C : Base() + +fun test_1(e: Base) { + val a = when (e) { + is Base.A -> 1 + is Base.A.B -> 2 + } + + val b = when (e) { + is Base.A -> 1 + is Base.A.B -> 2 + is String -> 3 + } + + val c = when (e) { + is Base.A -> 1 + is Base.A.B -> 2 + is C -> 3 + } + + val d = when (e) { + is Base.A -> 1 + else -> 2 + } +} + +fun test_2(e: Base?) { + val a = when (e) { + is Base.A -> 1 + is Base.A.B -> 2 + is C -> 3 + } + + val a = when (e) { + is Base.A -> 1 + is Base.A.B -> 2 + is C -> 3 + null -> 4 + } + + val a = when (e) { + is Base.A -> 1 + is Base.A.B -> 2 + is C -> 3 + else -> 4 + } +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/exhaustiveness_sealedClass.txt b/compiler/fir/resolve/testData/resolve/exhaustiveness_sealedClass.txt new file mode 100644 index 00000000000..b075fd05446 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/exhaustiveness_sealedClass.txt @@ -0,0 +1,115 @@ +FILE: exhaustiveness_sealedClass.kt + public sealed class Base : R|kotlin/Any| { + private constructor(): R|Base| { + super() + } + + public final class A : R|Base| { + public constructor(): R|Base.A| { + super() + } + + public final class B : R|Base| { + public constructor(): R|Base.A.B| { + super() + } + + } + + } + + } + public final class C : R|Base| { + public constructor(): R|C| { + super() + } + + } + public final fun test_1(e: R|Base|): R|kotlin/Unit| { + lval a: R|kotlin/Any?| = when (R|/e|) { + ($subj$ is R|Base.A|) -> { + Int(1) + } + ($subj$ is R|Base.A.B|) -> { + Int(2) + } + } + + lval b: R|kotlin/Any?| = when (R|/e|) { + ($subj$ is R|Base.A|) -> { + Int(1) + } + ($subj$ is R|Base.A.B|) -> { + Int(2) + } + ($subj$ is R|kotlin/String|) -> { + Int(3) + } + } + + lval c: R|kotlin/Int| = when (R|/e|) { + ($subj$ is R|Base.A|) -> { + Int(1) + } + ($subj$ is R|Base.A.B|) -> { + Int(2) + } + ($subj$ is R|C|) -> { + Int(3) + } + } + + lval d: R|kotlin/Int| = when (R|/e|) { + ($subj$ is R|Base.A|) -> { + Int(1) + } + else -> { + Int(2) + } + } + + } + public final fun test_2(e: R|Base?|): R|kotlin/Unit| { + lval a: R|kotlin/Any?| = when (R|/e|) { + ($subj$ is R|Base.A|) -> { + Int(1) + } + ($subj$ is R|Base.A.B|) -> { + Int(2) + } + ($subj$ is R|C|) -> { + Int(3) + } + } + + lval a: R|kotlin/Int| = when (R|/e|) { + ($subj$ is R|Base.A|) -> { + Int(1) + } + ($subj$ is R|Base.A.B|) -> { + Int(2) + } + ($subj$ is R|C|) -> { + Int(3) + } + ==($subj$, Null(null)) -> { + Int(4) + } + } + + lval a: R|kotlin/Int| = when (R|/e|) { + ($subj$ is R|Base.A|) -> { + Int(1) + } + ($subj$ is R|Base.A.B|) -> { + Int(2) + } + ($subj$ is R|C|) -> { + Int(3) + } + else -> { + Int(4) + } + } + + } diff --git a/compiler/fir/resolve/testData/resolve/fib.txt b/compiler/fir/resolve/testData/resolve/fib.txt index 91a5581c3ef..f7f6bd103a1 100644 --- a/compiler/fir/resolve/testData/resolve/fib.txt +++ b/compiler/fir/resolve/testData/resolve/fib.txt @@ -4,8 +4,6 @@ FILE: fib.kt <(R|/n|, Int(2)) -> { ^fibIterative Int(1) } - else -> { - } } lvar current: R|kotlin/Int| = Int(1) diff --git a/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt b/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt index d6a6879a704..5c3c2d941ad 100644 --- a/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt +++ b/compiler/fir/resolve/testData/resolve/recursiveCallOnWhenWithSealedClass.txt @@ -27,7 +27,7 @@ FILE: recursiveCallOnWhenWithSealedClass.kt } - public final fun unwrap(): R|kotlin/Any?| { + public final fun unwrap(): R|T| { ^unwrap when (this@R|/Maybe|) { ($subj$ is R|Maybe.Nope|) -> { throw R|java/lang/Exception.Exception|(String()) @@ -35,8 +35,6 @@ FILE: recursiveCallOnWhenWithSealedClass.kt ($subj$ is R|Maybe.Yeah|) -> { this@R|/Maybe.Yeah|.R|/Maybe.Yeah.meat| } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot index 32349a37f0d..5bf8cf37680 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot @@ -60,36 +60,25 @@ digraph booleanOperators_kt { } 20 [label="Exit when branch condition"]; } + 21 [label="Synthetic else branch"]; + 22 [label="Enter when branch result"]; subgraph cluster_9 { color=blue - 21 [label="Enter when branch condition else"]; - 22 [label="Exit when branch condition"]; + 23 [label="Enter block"]; + 24 [label="Access variable R|/x|"]; + 25 [label="Function call: R|/x|.R|/A.foo|()"]; + 26 [label="Access variable R|/x|"]; + 27 [label="Function call: R|/x|.R|/B.bar|()"]; + 28 [label="Access variable R|/x|"]; + 29 [label="Function call: R|/x|.R|/C.baz|()"]; + 30 [label="Exit block"]; } - 23 [label="Enter when branch result"]; - subgraph cluster_10 { - color=blue - 24 [label="Enter block"]; - 25 [label="Exit block"]; - } - 26 [label="Exit when branch result"]; - 27 [label="Enter when branch result"]; - subgraph cluster_11 { - color=blue - 28 [label="Enter block"]; - 29 [label="Access variable R|/x|"]; - 30 [label="Function call: R|/x|.R|/A.foo|()"]; - 31 [label="Access variable R|/x|"]; - 32 [label="Function call: R|/x|.R|/B.bar|()"]; - 33 [label="Access variable R|/x|"]; - 34 [label="Function call: R|/x|.R|/C.baz|()"]; - 35 [label="Exit block"]; - } - 36 [label="Exit when branch result"]; - 37 [label="Exit when"]; + 31 [label="Exit when branch result"]; + 32 [label="Exit when"]; } - 38 [label="Exit block"]; + 33 [label="Exit block"]; } - 39 [label="Exit function test_1" style="filled" fillcolor=red]; + 34 [label="Exit function test_1" style="filled" fillcolor=red]; } 8 -> {9}; @@ -104,13 +93,13 @@ digraph booleanOperators_kt { 17 -> {18}; 18 -> {19}; 19 -> {20}; - 20 -> {27 21}; - 21 -> {22}; + 20 -> {22 21}; + 21 -> {32}; 22 -> {23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {37}; + 26 -> {27}; 27 -> {28}; 28 -> {29}; 29 -> {30}; @@ -118,91 +107,114 @@ digraph booleanOperators_kt { 31 -> {32}; 32 -> {33}; 33 -> {34}; - 34 -> {35}; + + subgraph cluster_10 { + color=red + 35 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_11 { + color=blue + 36 [label="Enter block"]; + subgraph cluster_12 { + color=blue + 37 [label="Enter when"]; + subgraph cluster_13 { + color=blue + 38 [label="Enter when branch condition "]; + subgraph cluster_14 { + color=blue + 39 [label="Enter ||"]; + 40 [label="Access variable R|/x|"]; + 41 [label="Type operator: x is B"]; + 42 [label="Exit left part of ||"]; + 43 [label="Enter right part of ||"]; + 44 [label="Access variable R|/x|"]; + 45 [label="Type operator: x is C"]; + 46 [label="Exit ||"]; + } + 47 [label="Exit when branch condition"]; + } + 48 [label="Synthetic else branch"]; + 49 [label="Enter when branch result"]; + subgraph cluster_15 { + color=blue + 50 [label="Enter block"]; + 51 [label="Access variable R|/x|"]; + 52 [label="Function call: R|/x|.R|/A.foo|()"]; + 53 [label="Access variable R|/x|"]; + 54 [label="Function call: R|/x|.#()"]; + 55 [label="Access variable R|/x|"]; + 56 [label="Function call: R|/x|.#()"]; + 57 [label="Exit block"]; + } + 58 [label="Exit when branch result"]; + 59 [label="Exit when"]; + } + 60 [label="Exit block"]; + } + 61 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; - - subgraph cluster_12 { - color=red - 40 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_13 { - color=blue - 41 [label="Enter block"]; - subgraph cluster_14 { - color=blue - 42 [label="Enter when"]; - subgraph cluster_15 { - color=blue - 43 [label="Enter when branch condition "]; - subgraph cluster_16 { - color=blue - 44 [label="Enter ||"]; - 45 [label="Access variable R|/x|"]; - 46 [label="Type operator: x is B"]; - 47 [label="Exit left part of ||"]; - 48 [label="Enter right part of ||"]; - 49 [label="Access variable R|/x|"]; - 50 [label="Type operator: x is C"]; - 51 [label="Exit ||"]; - } - 52 [label="Exit when branch condition"]; - } - subgraph cluster_17 { - color=blue - 53 [label="Enter when branch condition else"]; - 54 [label="Exit when branch condition"]; - } - 55 [label="Enter when branch result"]; - subgraph cluster_18 { - color=blue - 56 [label="Enter block"]; - 57 [label="Exit block"]; - } - 58 [label="Exit when branch result"]; - 59 [label="Enter when branch result"]; - subgraph cluster_19 { - color=blue - 60 [label="Enter block"]; - 61 [label="Access variable R|/x|"]; - 62 [label="Function call: R|/x|.R|/A.foo|()"]; - 63 [label="Access variable R|/x|"]; - 64 [label="Function call: R|/x|.#()"]; - 65 [label="Access variable R|/x|"]; - 66 [label="Function call: R|/x|.#()"]; - 67 [label="Exit block"]; - } - 68 [label="Exit when branch result"]; - 69 [label="Exit when"]; - } - 70 [label="Exit block"]; - } - 71 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 39 -> {40}; 40 -> {41}; 41 -> {42}; - 42 -> {43}; + 42 -> {46 43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; - 47 -> {51 48}; - 48 -> {49}; + 47 -> {49 48}; + 48 -> {59}; 49 -> {50}; 50 -> {51}; 51 -> {52}; - 52 -> {59 53}; + 52 -> {53}; 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; 57 -> {58}; - 58 -> {69}; + 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {62}; + + subgraph cluster_16 { + color=red + 62 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_17 { + color=blue + 63 [label="Enter block"]; + subgraph cluster_18 { + color=blue + 64 [label="Enter when"]; + subgraph cluster_19 { + color=blue + 65 [label="Enter when branch condition "]; + 66 [label="Access variable R|/x|"]; + 67 [label="Type operator: x !is A"]; + 68 [label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; + 69 [label="Exit when branch condition"]; + } + 70 [label="Synthetic else branch"]; + 71 [label="Enter when branch result"]; + subgraph cluster_20 { + color=blue + 72 [label="Enter block"]; + 73 [label="Access variable R|/x|"]; + 74 [label="Function call: R|/x|.R|/A.foo|()"]; + 75 [label="Exit block"]; + } + 76 [label="Exit when branch result"]; + 77 [label="Exit when"]; + } + 78 [label="Exit block"]; + } + 79 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 62 -> {63}; 63 -> {64}; 64 -> {65}; @@ -210,54 +222,9 @@ digraph booleanOperators_kt { 66 -> {67}; 67 -> {68}; 68 -> {69}; - 69 -> {70}; - 70 -> {71}; - - subgraph cluster_20 { - color=red - 72 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_21 { - color=blue - 73 [label="Enter block"]; - subgraph cluster_22 { - color=blue - 74 [label="Enter when"]; - subgraph cluster_23 { - color=blue - 75 [label="Enter when branch condition "]; - 76 [label="Access variable R|/x|"]; - 77 [label="Type operator: x !is A"]; - 78 [label="Function call: (R|/x| !is R|A|).R|kotlin/Boolean.not|()"]; - 79 [label="Exit when branch condition"]; - } - subgraph cluster_24 { - color=blue - 80 [label="Enter when branch condition else"]; - 81 [label="Exit when branch condition"]; - } - 82 [label="Enter when branch result"]; - subgraph cluster_25 { - color=blue - 83 [label="Enter block"]; - 84 [label="Exit block"]; - } - 85 [label="Exit when branch result"]; - 86 [label="Enter when branch result"]; - subgraph cluster_26 { - color=blue - 87 [label="Enter block"]; - 88 [label="Access variable R|/x|"]; - 89 [label="Function call: R|/x|.R|/A.foo|()"]; - 90 [label="Exit block"]; - } - 91 [label="Exit when branch result"]; - 92 [label="Exit when"]; - } - 93 [label="Exit block"]; - } - 94 [label="Exit function test_3" style="filled" fillcolor=red]; - } - + 69 -> {71 70}; + 70 -> {77}; + 71 -> {72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; @@ -265,183 +232,205 @@ digraph booleanOperators_kt { 76 -> {77}; 77 -> {78}; 78 -> {79}; - 79 -> {86 80}; + + subgraph cluster_21 { + color=red + 80 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_22 { + color=blue + 81 [label="Enter block"]; + subgraph cluster_23 { + color=blue + 82 [label="Enter when"]; + subgraph cluster_24 { + color=blue + 83 [label="Enter when branch condition "]; + subgraph cluster_25 { + color=blue + 84 [label="Enter ||"]; + 85 [label="Access variable R|/x|"]; + 86 [label="Type operator: x !is String"]; + 87 [label="Exit left part of ||"]; + 88 [label="Enter right part of ||"]; + 89 [label="Access variable R|/x|"]; + 90 [label="Access variable R|kotlin/String.length|"]; + 91 [label="Const: Int(0)"]; + 92 [label="Operator =="]; + 93 [label="Exit ||"]; + } + 94 [label="Exit when branch condition"]; + } + 95 [label="Synthetic else branch"]; + 96 [label="Enter when branch result"]; + subgraph cluster_26 { + color=blue + 97 [label="Enter block"]; + 98 [label="Access variable R|/x|"]; + 99 [label="Access variable #"]; + 100 [label="Exit block"]; + } + 101 [label="Exit when branch result"]; + 102 [label="Exit when"]; + } + 103 [label="Access variable R|/x|"]; + 104 [label="Access variable #"]; + 105 [label="Exit block"]; + } + 106 [label="Exit function test_4" style="filled" fillcolor=red]; + } + 80 -> {81}; 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; - 85 -> {92}; + 85 -> {86}; 86 -> {87}; - 87 -> {88}; + 87 -> {93 88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; 92 -> {93}; 93 -> {94}; - - subgraph cluster_27 { - color=red - 95 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_28 { - color=blue - 96 [label="Enter block"]; - subgraph cluster_29 { - color=blue - 97 [label="Enter when"]; - subgraph cluster_30 { - color=blue - 98 [label="Enter when branch condition "]; - subgraph cluster_31 { - color=blue - 99 [label="Enter ||"]; - 100 [label="Access variable R|/x|"]; - 101 [label="Type operator: x !is String"]; - 102 [label="Exit left part of ||"]; - 103 [label="Enter right part of ||"]; - 104 [label="Access variable R|/x|"]; - 105 [label="Access variable R|kotlin/String.length|"]; - 106 [label="Const: Int(0)"]; - 107 [label="Operator =="]; - 108 [label="Exit ||"]; - } - 109 [label="Exit when branch condition"]; - } - subgraph cluster_32 { - color=blue - 110 [label="Enter when branch condition else"]; - 111 [label="Exit when branch condition"]; - } - 112 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 113 [label="Enter block"]; - 114 [label="Exit block"]; - } - 115 [label="Exit when branch result"]; - 116 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 117 [label="Enter block"]; - 118 [label="Access variable R|/x|"]; - 119 [label="Access variable #"]; - 120 [label="Exit block"]; - } - 121 [label="Exit when branch result"]; - 122 [label="Exit when"]; - } - 123 [label="Access variable R|/x|"]; - 124 [label="Access variable #"]; - 125 [label="Exit block"]; - } - 126 [label="Exit function test_4" style="filled" fillcolor=red]; - } - - 95 -> {96}; + 94 -> {96 95}; + 95 -> {102}; 96 -> {97}; 97 -> {98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {108 103}; + 102 -> {103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; - 106 -> {107}; + + subgraph cluster_27 { + color=red + 107 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_28 { + color=blue + 108 [label="Enter block"]; + subgraph cluster_29 { + color=blue + 109 [label="Enter when"]; + subgraph cluster_30 { + color=blue + 110 [label="Enter when branch condition "]; + subgraph cluster_31 { + color=blue + 111 [label="Enter ||"]; + 112 [label="Access variable R|/x|"]; + 113 [label="Const: Null(null)"]; + 114 [label="Operator !="]; + 115 [label="Exit left part of ||"]; + 116 [label="Enter right part of ||"]; + 117 [label="Const: Boolean(false)"]; + 118 [label="Exit ||"]; + } + 119 [label="Exit when branch condition"]; + } + 120 [label="Synthetic else branch"]; + 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|.#()"]; + 125 [label="Exit block"]; + } + 126 [label="Exit when branch result"]; + 127 [label="Exit when"]; + } + 128 [label="Exit block"]; + } + 129 [label="Exit function test_5" style="filled" fillcolor=red]; + } + 107 -> {108}; 108 -> {109}; - 109 -> {116 110}; + 109 -> {110}; 110 -> {111}; 111 -> {112}; 112 -> {113}; 113 -> {114}; 114 -> {115}; - 115 -> {122}; + 115 -> {118 116}; 116 -> {117}; 117 -> {118}; 118 -> {119}; - 119 -> {120}; - 120 -> {121}; + 119 -> {121 120}; + 120 -> {127}; 121 -> {122}; 122 -> {123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; - - subgraph cluster_35 { - color=red - 127 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_36 { - color=blue - 128 [label="Enter block"]; - subgraph cluster_37 { - color=blue - 129 [label="Enter when"]; - subgraph cluster_38 { - color=blue - 130 [label="Enter when branch condition "]; - subgraph cluster_39 { - color=blue - 131 [label="Enter ||"]; - 132 [label="Access variable R|/x|"]; - 133 [label="Const: Null(null)"]; - 134 [label="Operator !="]; - 135 [label="Exit left part of ||"]; - 136 [label="Enter right part of ||"]; - 137 [label="Const: Boolean(false)"]; - 138 [label="Exit ||"]; - } - 139 [label="Exit when branch condition"]; - } - subgraph cluster_40 { - color=blue - 140 [label="Enter when branch condition else"]; - 141 [label="Exit when branch condition"]; - } - 142 [label="Enter when branch result"]; - subgraph cluster_41 { - color=blue - 143 [label="Enter block"]; - 144 [label="Exit block"]; - } - 145 [label="Exit when branch result"]; - 146 [label="Enter when branch result"]; - subgraph cluster_42 { - color=blue - 147 [label="Enter block"]; - 148 [label="Access variable R|/x|"]; - 149 [label="Function call: R|/x|.#()"]; - 150 [label="Exit block"]; - } - 151 [label="Exit when branch result"]; - 152 [label="Exit when"]; - } - 153 [label="Exit block"]; - } - 154 [label="Exit function test_5" style="filled" fillcolor=red]; - } - + 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {130}; + + subgraph cluster_33 { + color=red + 130 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_34 { + color=blue + 131 [label="Enter block"]; + subgraph cluster_35 { + color=blue + 132 [label="Enter when"]; + subgraph cluster_36 { + color=blue + 133 [label="Enter when branch condition "]; + subgraph cluster_37 { + color=blue + 134 [label="Enter ||"]; + 135 [label="Const: Boolean(false)"]; + 136 [label="Exit left part of ||"]; + 137 [label="Enter right part of ||"]; + 138 [label="Access variable R|/x|"]; + 139 [label="Const: Null(null)"]; + 140 [label="Operator !="]; + 141 [label="Stub" style="filled" fillcolor=gray]; + 142 [label="Exit ||"]; + } + 143 [label="Exit when branch condition"]; + } + 144 [label="Synthetic else branch"]; + 145 [label="Enter when branch result"]; + subgraph cluster_38 { + color=blue + 146 [label="Enter block"]; + 147 [label="Access variable R|/x|"]; + 148 [label="Function call: R|/x|.#()"]; + 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]; + } + 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; 134 -> {135}; - 135 -> {138 136}; + 135 -> {136}; 136 -> {137}; + 136 -> {141} [style=dotted]; 137 -> {138}; 138 -> {139}; - 139 -> {146 140}; - 140 -> {141}; - 141 -> {142}; + 139 -> {140}; + 140 -> {142}; + 141 -> {142} [style=dotted]; 142 -> {143}; - 143 -> {144}; - 144 -> {145}; - 145 -> {152}; + 143 -> {145 144}; + 144 -> {151}; + 145 -> {146}; 146 -> {147}; 147 -> {148}; 148 -> {149}; @@ -449,171 +438,70 @@ digraph booleanOperators_kt { 150 -> {151}; 151 -> {152}; 152 -> {153}; - 153 -> {154}; - subgraph cluster_43 { + subgraph cluster_39 { color=red - 155 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_44 { + 154 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_40 { color=blue - 156 [label="Enter block"]; - subgraph cluster_45 { + 155 [label="Enter block"]; + subgraph cluster_41 { color=blue - 157 [label="Enter when"]; - subgraph cluster_46 { + 156 [label="Enter when"]; + subgraph cluster_42 { color=blue - 158 [label="Enter when branch condition "]; - subgraph cluster_47 { + 157 [label="Enter when branch condition "]; + subgraph cluster_43 { color=blue - 159 [label="Enter ||"]; - 160 [label="Const: Boolean(false)"]; - 161 [label="Exit left part of ||"]; - 162 [label="Enter right part of ||"]; + 158 [label="Enter &&"]; + 159 [label="Access variable R|/x|"]; + 160 [label="Type operator: x is A"]; + 161 [label="Exit left part of &&"]; + 162 [label="Enter right part of &&"]; 163 [label="Access variable R|/x|"]; - 164 [label="Const: Null(null)"]; - 165 [label="Operator !="]; - 166 [label="Stub" style="filled" fillcolor=gray]; - 167 [label="Exit ||"]; + 164 [label="Function call: R|/x|.R|/A.bool|()"]; + 165 [label="Exit &&"]; } - 168 [label="Exit when branch condition"]; + 166 [label="Exit when branch condition"]; } - subgraph cluster_48 { + 167 [label="Synthetic else branch"]; + 168 [label="Enter when branch result"]; + subgraph cluster_44 { color=blue - 169 [label="Enter when branch condition else"]; - 170 [label="Exit when branch condition"]; + 169 [label="Enter block"]; + 170 [label="Access variable R|/x|"]; + 171 [label="Function call: R|/x|.R|/A.foo|()"]; + 172 [label="Exit block"]; } - 171 [label="Enter when branch result"]; - subgraph cluster_49 { - color=blue - 172 [label="Enter block"]; - 173 [label="Exit block"]; - } - 174 [label="Exit when branch result"]; - 175 [label="Enter when branch result"]; - subgraph cluster_50 { - color=blue - 176 [label="Enter block"]; - 177 [label="Access variable R|/x|"]; - 178 [label="Function call: R|/x|.#()"]; - 179 [label="Exit block"]; - } - 180 [label="Exit when branch result"]; - 181 [label="Exit when"]; + 173 [label="Exit when branch result"]; + 174 [label="Exit when"]; } - 182 [label="Exit block"]; + 175 [label="Exit block"]; } - 183 [label="Exit function test_6" style="filled" fillcolor=red]; + 176 [label="Exit function test_7" style="filled" fillcolor=red]; } + 154 -> {155}; 155 -> {156}; 156 -> {157}; 157 -> {158}; 158 -> {159}; 159 -> {160}; 160 -> {161}; - 161 -> {162}; - 161 -> {166} [style=dotted]; + 161 -> {165 162}; 162 -> {163}; 163 -> {164}; 164 -> {165}; - 165 -> {167}; - 166 -> {167} [style=dotted]; - 167 -> {168}; - 168 -> {175 169}; + 165 -> {166}; + 166 -> {168 167}; + 167 -> {174}; + 168 -> {169}; 169 -> {170}; 170 -> {171}; 171 -> {172}; 172 -> {173}; 173 -> {174}; - 174 -> {181}; + 174 -> {175}; 175 -> {176}; - 176 -> {177}; - 177 -> {178}; - 178 -> {179}; - 179 -> {180}; - 180 -> {181}; - 181 -> {182}; - 182 -> {183}; - - subgraph cluster_51 { - color=red - 184 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_52 { - color=blue - 185 [label="Enter block"]; - subgraph cluster_53 { - color=blue - 186 [label="Enter when"]; - subgraph cluster_54 { - color=blue - 187 [label="Enter when branch condition "]; - subgraph cluster_55 { - color=blue - 188 [label="Enter &&"]; - 189 [label="Access variable R|/x|"]; - 190 [label="Type operator: x is A"]; - 191 [label="Exit left part of &&"]; - 192 [label="Enter right part of &&"]; - 193 [label="Access variable R|/x|"]; - 194 [label="Function call: R|/x|.R|/A.bool|()"]; - 195 [label="Exit &&"]; - } - 196 [label="Exit when branch condition"]; - } - subgraph cluster_56 { - color=blue - 197 [label="Enter when branch condition else"]; - 198 [label="Exit when branch condition"]; - } - 199 [label="Enter when branch result"]; - subgraph cluster_57 { - color=blue - 200 [label="Enter block"]; - 201 [label="Exit block"]; - } - 202 [label="Exit when branch result"]; - 203 [label="Enter when branch result"]; - subgraph cluster_58 { - color=blue - 204 [label="Enter block"]; - 205 [label="Access variable R|/x|"]; - 206 [label="Function call: R|/x|.R|/A.foo|()"]; - 207 [label="Exit block"]; - } - 208 [label="Exit when branch result"]; - 209 [label="Exit when"]; - } - 210 [label="Exit block"]; - } - 211 [label="Exit function test_7" style="filled" fillcolor=red]; - } - - 184 -> {185}; - 185 -> {186}; - 186 -> {187}; - 187 -> {188}; - 188 -> {189}; - 189 -> {190}; - 190 -> {191}; - 191 -> {195 192}; - 192 -> {193}; - 193 -> {194}; - 194 -> {195}; - 195 -> {196}; - 196 -> {203 197}; - 197 -> {198}; - 198 -> {199}; - 199 -> {200}; - 200 -> {201}; - 201 -> {202}; - 202 -> {209}; - 203 -> {204}; - 204 -> {205}; - 205 -> {206}; - 206 -> {207}; - 207 -> {208}; - 208 -> {209}; - 209 -> {210}; - 210 -> {211}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.txt b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.txt index 5dc3d00480f..d84f5618cef 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.txt @@ -20,8 +20,6 @@ FILE: booleanOperators.kt R|/x|.R|/B.bar|() R|/x|.R|/C.baz|() } - else -> { - } } } @@ -32,8 +30,6 @@ FILE: booleanOperators.kt R|/x|.#() R|/x|.#() } - else -> { - } } } @@ -42,8 +38,6 @@ FILE: booleanOperators.kt (R|/x| !is R|A|).R|kotlin/Boolean.not|() -> { R|/x|.R|/A.foo|() } - else -> { - } } } @@ -52,8 +46,6 @@ FILE: booleanOperators.kt (R|/x| !is R|kotlin/String|) || ==(R|/x|.R|kotlin/String.length|, Int(0)) -> { R|/x|.# } - else -> { - } } R|/x|.# @@ -63,8 +55,6 @@ FILE: booleanOperators.kt !=(R|/x|, Null(null)) || Boolean(false) -> { R|/x|.#() } - else -> { - } } } @@ -73,8 +63,6 @@ FILE: booleanOperators.kt Boolean(false) || !=(R|/x|, Null(null)) -> { R|/x|.#() } - else -> { - } } } @@ -83,8 +71,6 @@ FILE: booleanOperators.kt (R|/x| is R|A|) && R|/x|.R|/A.bool|() -> { R|/x|.R|/A.foo|() } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot index 20b9ed93087..8e9140aa3b8 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot @@ -37,34 +37,23 @@ digraph boundSmartcasts_kt { 11 [label="Type operator: x is A"]; 12 [label="Exit when branch condition"]; } + 13 [label="Synthetic else branch"]; + 14 [label="Enter when branch result"]; subgraph cluster_6 { color=blue - 13 [label="Enter when branch condition else"]; - 14 [label="Exit when branch condition"]; + 15 [label="Enter block"]; + 16 [label="Access variable R|/x|"]; + 17 [label="Function call: R|/x|.R|/A.foo|()"]; + 18 [label="Access variable R|/y|"]; + 19 [label="Function call: R|/y|.R|/A.foo|()"]; + 20 [label="Exit block"]; } - 15 [label="Enter when branch result"]; - subgraph cluster_7 { - color=blue - 16 [label="Enter block"]; - 17 [label="Exit block"]; - } - 18 [label="Exit when branch result"]; - 19 [label="Enter when branch result"]; - subgraph cluster_8 { - color=blue - 20 [label="Enter block"]; - 21 [label="Access variable R|/x|"]; - 22 [label="Function call: R|/x|.R|/A.foo|()"]; - 23 [label="Access variable R|/y|"]; - 24 [label="Function call: R|/y|.R|/A.foo|()"]; - 25 [label="Exit block"]; - } - 26 [label="Exit when branch result"]; - 27 [label="Exit when"]; + 21 [label="Exit when branch result"]; + 22 [label="Exit when"]; } - 28 [label="Exit block"]; + 23 [label="Exit block"]; } - 29 [label="Exit function test_1" style="filled" fillcolor=red]; + 24 [label="Exit function test_1" style="filled" fillcolor=red]; } 4 -> {5}; @@ -75,88 +64,136 @@ digraph boundSmartcasts_kt { 9 -> {10}; 10 -> {11}; 11 -> {12}; - 12 -> {19 13}; - 13 -> {14}; + 12 -> {14 13}; + 13 -> {22}; 14 -> {15}; 15 -> {16}; 16 -> {17}; 17 -> {18}; - 18 -> {27}; + 18 -> {19}; 19 -> {20}; 20 -> {21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; - 24 -> {25}; + + subgraph cluster_7 { + color=red + 25 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_8 { + color=blue + 26 [label="Enter block"]; + 27 [label="Access variable R|/x|"]; + 28 [label="Variable declaration: lval y: R|kotlin/Any|"]; + subgraph cluster_9 { + color=blue + 29 [label="Enter when"]; + subgraph cluster_10 { + color=blue + 30 [label="Enter when branch condition "]; + 31 [label="Access variable R|/y|"]; + 32 [label="Type operator: y is A"]; + 33 [label="Exit when branch condition"]; + } + 34 [label="Synthetic else branch"]; + 35 [label="Enter when branch result"]; + subgraph cluster_11 { + color=blue + 36 [label="Enter block"]; + 37 [label="Access variable R|/x|"]; + 38 [label="Function call: R|/x|.R|/A.foo|()"]; + 39 [label="Access variable R|/y|"]; + 40 [label="Function call: R|/y|.R|/A.foo|()"]; + 41 [label="Exit block"]; + } + 42 [label="Exit when branch result"]; + 43 [label="Exit when"]; + } + 44 [label="Exit block"]; + } + 45 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 25 -> {26}; 26 -> {27}; 27 -> {28}; 28 -> {29}; - - subgraph cluster_9 { - color=red - 30 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_10 { - color=blue - 31 [label="Enter block"]; - 32 [label="Access variable R|/x|"]; - 33 [label="Variable declaration: lval y: R|kotlin/Any|"]; - subgraph cluster_11 { - color=blue - 34 [label="Enter when"]; - subgraph cluster_12 { - color=blue - 35 [label="Enter when branch condition "]; - 36 [label="Access variable R|/y|"]; - 37 [label="Type operator: y is A"]; - 38 [label="Exit when branch condition"]; - } - subgraph cluster_13 { - color=blue - 39 [label="Enter when branch condition else"]; - 40 [label="Exit when branch condition"]; - } - 41 [label="Enter when branch result"]; - subgraph cluster_14 { - color=blue - 42 [label="Enter block"]; - 43 [label="Exit block"]; - } - 44 [label="Exit when branch result"]; - 45 [label="Enter when branch result"]; - subgraph cluster_15 { - color=blue - 46 [label="Enter block"]; - 47 [label="Access variable R|/x|"]; - 48 [label="Function call: R|/x|.R|/A.foo|()"]; - 49 [label="Access variable R|/y|"]; - 50 [label="Function call: R|/y|.R|/A.foo|()"]; - 51 [label="Exit block"]; - } - 52 [label="Exit when branch result"]; - 53 [label="Exit when"]; - } - 54 [label="Exit block"]; - } - 55 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 29 -> {30}; 30 -> {31}; 31 -> {32}; 32 -> {33}; - 33 -> {34}; - 34 -> {35}; + 33 -> {35 34}; + 34 -> {43}; 35 -> {36}; 36 -> {37}; 37 -> {38}; - 38 -> {45 39}; + 38 -> {39}; 39 -> {40}; 40 -> {41}; 41 -> {42}; 42 -> {43}; 43 -> {44}; - 44 -> {53}; - 45 -> {46}; + 44 -> {45}; + + subgraph cluster_12 { + color=red + 46 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_13 { + color=blue + 47 [label="Enter block"]; + 48 [label="Access variable R|/x|"]; + 49 [label="Variable declaration: lvar z: R|kotlin/Any|"]; + subgraph cluster_14 { + color=blue + 50 [label="Enter when"]; + subgraph cluster_15 { + color=blue + 51 [label="Enter when branch condition "]; + 52 [label="Access variable R|/x|"]; + 53 [label="Type operator: x is A"]; + 54 [label="Exit when branch condition"]; + } + 55 [label="Synthetic else branch"]; + 56 [label="Enter when branch result"]; + subgraph cluster_16 { + color=blue + 57 [label="Enter block"]; + 58 [label="Access variable R|/z|"]; + 59 [label="Function call: R|/z|.R|/A.foo|()"]; + 60 [label="Exit block"]; + } + 61 [label="Exit when branch result"]; + 62 [label="Exit when"]; + } + 63 [label="Access variable R|/y|"]; + 64 [label="Assignmenet: R|/z|"]; + subgraph cluster_17 { + color=blue + 65 [label="Enter when"]; + subgraph cluster_18 { + color=blue + 66 [label="Enter when branch condition "]; + 67 [label="Access variable R|/y|"]; + 68 [label="Type operator: y is B"]; + 69 [label="Exit when branch condition"]; + } + 70 [label="Synthetic else branch"]; + 71 [label="Enter when branch result"]; + subgraph cluster_19 { + color=blue + 72 [label="Enter block"]; + 73 [label="Access variable R|/z|"]; + 74 [label="Function call: R|/z|.#()"]; + 75 [label="Exit block"]; + } + 76 [label="Exit when branch result"]; + 77 [label="Exit when"]; + } + 78 [label="Exit block"]; + } + 79 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 46 -> {47}; 47 -> {48}; 48 -> {49}; @@ -165,89 +202,8 @@ digraph boundSmartcasts_kt { 51 -> {52}; 52 -> {53}; 53 -> {54}; - 54 -> {55}; - - subgraph cluster_16 { - color=red - 56 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_17 { - color=blue - 57 [label="Enter block"]; - 58 [label="Access variable R|/x|"]; - 59 [label="Variable declaration: lvar z: R|kotlin/Any|"]; - subgraph cluster_18 { - color=blue - 60 [label="Enter when"]; - subgraph cluster_19 { - color=blue - 61 [label="Enter when branch condition "]; - 62 [label="Access variable R|/x|"]; - 63 [label="Type operator: x is A"]; - 64 [label="Exit when branch condition"]; - } - subgraph cluster_20 { - color=blue - 65 [label="Enter when branch condition else"]; - 66 [label="Exit when branch condition"]; - } - 67 [label="Enter when branch result"]; - subgraph cluster_21 { - color=blue - 68 [label="Enter block"]; - 69 [label="Exit block"]; - } - 70 [label="Exit when branch result"]; - 71 [label="Enter when branch result"]; - subgraph cluster_22 { - color=blue - 72 [label="Enter block"]; - 73 [label="Access variable R|/z|"]; - 74 [label="Function call: R|/z|.R|/A.foo|()"]; - 75 [label="Exit block"]; - } - 76 [label="Exit when branch result"]; - 77 [label="Exit when"]; - } - 78 [label="Access variable R|/y|"]; - 79 [label="Assignmenet: R|/z|"]; - subgraph cluster_23 { - color=blue - 80 [label="Enter when"]; - subgraph cluster_24 { - color=blue - 81 [label="Enter when branch condition "]; - 82 [label="Access variable R|/y|"]; - 83 [label="Type operator: y is B"]; - 84 [label="Exit when branch condition"]; - } - subgraph cluster_25 { - color=blue - 85 [label="Enter when branch condition else"]; - 86 [label="Exit when branch condition"]; - } - 87 [label="Enter when branch result"]; - subgraph cluster_26 { - color=blue - 88 [label="Enter block"]; - 89 [label="Exit block"]; - } - 90 [label="Exit when branch result"]; - 91 [label="Enter when branch result"]; - subgraph cluster_27 { - color=blue - 92 [label="Enter block"]; - 93 [label="Access variable R|/z|"]; - 94 [label="Function call: R|/z|.#()"]; - 95 [label="Exit block"]; - } - 96 [label="Exit when branch result"]; - 97 [label="Exit when"]; - } - 98 [label="Exit block"]; - } - 99 [label="Exit function test_3" style="filled" fillcolor=red]; - } - + 54 -> {56 55}; + 55 -> {62}; 56 -> {57}; 57 -> {58}; 58 -> {59}; @@ -256,12 +212,12 @@ digraph boundSmartcasts_kt { 61 -> {62}; 62 -> {63}; 63 -> {64}; - 64 -> {71 65}; + 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; - 69 -> {70}; + 69 -> {71 70}; 70 -> {77}; 71 -> {72}; 72 -> {73}; @@ -271,83 +227,72 @@ digraph boundSmartcasts_kt { 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"]; + 82 [label="Const: Int(1)"]; + 83 [label="Variable declaration: lvar x: R|kotlin/Any|"]; + 84 [label="Access variable R|/x|"]; + 85 [label="Type operator: x as Int"]; + 86 [label="Access variable R|/x|"]; + 87 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 88 [label="Access variable R|/y|"]; + 89 [label="Assignmenet: R|/x|"]; + 90 [label="Access variable R|/x|"]; + 91 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + subgraph cluster_22 { + color=blue + 92 [label="Enter when"]; + subgraph cluster_23 { + color=blue + 93 [label="Enter when branch condition "]; + 94 [label="Access variable R|/y|"]; + 95 [label="Type operator: y is A"]; + 96 [label="Exit when branch condition"]; + } + 97 [label="Synthetic else branch"]; + 98 [label="Enter when branch result"]; + subgraph cluster_24 { + color=blue + 99 [label="Enter block"]; + 100 [label="Access variable R|/x|"]; + 101 [label="Function call: R|/x|.#()"]; + 102 [label="Access variable R|/y|"]; + 103 [label="Function call: R|/y|.R|/A.foo|()"]; + 104 [label="Exit block"]; + } + 105 [label="Exit when branch result"]; + 106 [label="Exit when"]; + } + 107 [label="Exit block"]; + } + 108 [label="Exit function test_4" style="filled" fillcolor=red]; + } + 80 -> {81}; 81 -> {82}; 82 -> {83}; 83 -> {84}; - 84 -> {91 85}; + 84 -> {85}; 85 -> {86}; 86 -> {87}; 87 -> {88}; 88 -> {89}; 89 -> {90}; - 90 -> {97}; + 90 -> {91}; 91 -> {92}; 92 -> {93}; 93 -> {94}; 94 -> {95}; 95 -> {96}; - 96 -> {97}; - 97 -> {98}; + 96 -> {98 97}; + 97 -> {106}; 98 -> {99}; - - subgraph cluster_28 { - color=red - 100 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_29 { - color=blue - 101 [label="Enter block"]; - 102 [label="Const: Int(1)"]; - 103 [label="Variable declaration: lvar x: R|kotlin/Any|"]; - 104 [label="Access variable R|/x|"]; - 105 [label="Type operator: x as Int"]; - 106 [label="Access variable R|/x|"]; - 107 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 108 [label="Access variable R|/y|"]; - 109 [label="Assignmenet: R|/x|"]; - 110 [label="Access variable R|/x|"]; - 111 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - subgraph cluster_30 { - color=blue - 112 [label="Enter when"]; - subgraph cluster_31 { - color=blue - 113 [label="Enter when branch condition "]; - 114 [label="Access variable R|/y|"]; - 115 [label="Type operator: y is A"]; - 116 [label="Exit when branch condition"]; - } - subgraph cluster_32 { - color=blue - 117 [label="Enter when branch condition else"]; - 118 [label="Exit when branch condition"]; - } - 119 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 120 [label="Enter block"]; - 121 [label="Exit block"]; - } - 122 [label="Exit when branch result"]; - 123 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 124 [label="Enter block"]; - 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|/A.foo|()"]; - 129 [label="Exit block"]; - } - 130 [label="Exit when branch result"]; - 131 [label="Exit when"]; - } - 132 [label="Exit block"]; - } - 133 [label="Exit function test_4" style="filled" fillcolor=red]; - } - + 99 -> {100}; 100 -> {101}; 101 -> {102}; 102 -> {103}; @@ -356,30 +301,5 @@ digraph boundSmartcasts_kt { 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {109}; - 109 -> {110}; - 110 -> {111}; - 111 -> {112}; - 112 -> {113}; - 113 -> {114}; - 114 -> {115}; - 115 -> {116}; - 116 -> {123 117}; - 117 -> {118}; - 118 -> {119}; - 119 -> {120}; - 120 -> {121}; - 121 -> {122}; - 122 -> {131}; - 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/resolve/testData/resolve/smartcasts/boundSmartcasts.txt b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.txt index 5dc8eabc197..9ae34e8bdad 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.txt @@ -14,8 +14,6 @@ FILE: boundSmartcasts.kt R|/x|.R|/A.foo|() R|/y|.R|/A.foo|() } - else -> { - } } } @@ -26,8 +24,6 @@ FILE: boundSmartcasts.kt R|/x|.R|/A.foo|() R|/y|.R|/A.foo|() } - else -> { - } } } @@ -37,8 +33,6 @@ FILE: boundSmartcasts.kt (R|/x| is R|A|) -> { R|/z|.R|/A.foo|() } - else -> { - } } R|/z| = R|/y| @@ -46,8 +40,6 @@ FILE: boundSmartcasts.kt (R|/y| is R|B|) -> { R|/z|.#() } - else -> { - } } } @@ -62,8 +54,6 @@ FILE: boundSmartcasts.kt R|/x|.#() R|/y|.R|/A.foo|() } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot b/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot index ad2092dcf84..11e66f53ded 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot @@ -42,34 +42,23 @@ digraph casts_kt { 13 [label="Type operator: x as Boolean"]; 14 [label="Exit when branch condition"]; } + 15 [label="Synthetic else branch"]; + 16 [label="Enter when branch result"]; subgraph cluster_6 { color=blue - 15 [label="Enter when branch condition else"]; - 16 [label="Exit when branch condition"]; + 17 [label="Enter block"]; + 18 [label="Access variable R|/x|"]; + 19 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 20 [label="Exit block"]; } - 17 [label="Enter when branch result"]; - subgraph cluster_7 { - color=blue - 18 [label="Enter block"]; - 19 [label="Exit block"]; - } - 20 [label="Exit when branch result"]; - 21 [label="Enter when branch result"]; - subgraph cluster_8 { - color=blue - 22 [label="Enter block"]; - 23 [label="Access variable R|/x|"]; - 24 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 25 [label="Exit block"]; - } - 26 [label="Exit when branch result"]; - 27 [label="Exit when"]; + 21 [label="Exit when branch result"]; + 22 [label="Exit when"]; } - 28 [label="Access variable R|/x|"]; - 29 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 30 [label="Exit block"]; + 23 [label="Access variable R|/x|"]; + 24 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; + 25 [label="Exit block"]; } - 31 [label="Exit function test_2" style="filled" fillcolor=red]; + 26 [label="Exit function test_2" style="filled" fillcolor=red]; } 8 -> {9}; @@ -78,216 +67,183 @@ digraph casts_kt { 11 -> {12}; 12 -> {13}; 13 -> {14}; - 14 -> {21 15}; - 15 -> {16}; + 14 -> {16 15}; + 15 -> {22}; 16 -> {17}; 17 -> {18}; 18 -> {19}; 19 -> {20}; - 20 -> {27}; + 20 -> {21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {27}; + + subgraph cluster_7 { + color=red + 27 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_8 { + color=blue + 28 [label="Enter block"]; + subgraph cluster_9 { + color=blue + 29 [label="Enter when"]; + subgraph cluster_10 { + color=blue + 30 [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: x as Boolean"]; + 37 [label="Exit &&"]; + } + 38 [label="Exit when branch condition"]; + } + 39 [label="Synthetic else branch"]; + 40 [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"]; + } + 45 [label="Exit when branch result"]; + 46 [label="Exit when"]; + } + 47 [label="Access variable R|/x|"]; + 48 [label="Function call: R|/x|.#()"]; + subgraph cluster_13 { + color=blue + 49 [label="Enter when"]; + subgraph cluster_14 { + color=blue + 50 [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: x as Boolean"]; + 57 [label="Const: Boolean(true)"]; + 58 [label="Operator =="]; + 59 [label="Exit &&"]; + } + 60 [label="Exit when branch condition"]; + } + 61 [label="Synthetic else branch"]; + 62 [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="Exit when branch result"]; + 68 [label="Exit when"]; + } + 69 [label="Access variable R|/x|"]; + 70 [label="Function call: R|/x|.#()"]; + subgraph cluster_17 { + color=blue + 71 [label="Enter when"]; + subgraph cluster_18 { + color=blue + 72 [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: x as Boolean"]; + 79 [label="Exit ||"]; + } + 80 [label="Exit when branch condition"]; + } + 81 [label="Synthetic else branch"]; + 82 [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"]; + } + 87 [label="Exit when branch result"]; + 88 [label="Exit when"]; + } + 89 [label="Access variable R|/x|"]; + 90 [label="Function call: R|/x|.#()"]; + 91 [label="Exit block"]; + } + 92 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 27 -> {28}; 28 -> {29}; 29 -> {30}; 30 -> {31}; - - subgraph cluster_9 { - color=red - 32 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_10 { - color=blue - 33 [label="Enter block"]; - subgraph cluster_11 { - color=blue - 34 [label="Enter when"]; - subgraph cluster_12 { - color=blue - 35 [label="Enter when branch condition "]; - subgraph cluster_13 { - color=blue - 36 [label="Enter &&"]; - 37 [label="Access variable R|/b|"]; - 38 [label="Exit left part of &&"]; - 39 [label="Enter right part of &&"]; - 40 [label="Access variable R|/x|"]; - 41 [label="Type operator: x as Boolean"]; - 42 [label="Exit &&"]; - } - 43 [label="Exit when branch condition"]; - } - subgraph cluster_14 { - color=blue - 44 [label="Enter when branch condition else"]; - 45 [label="Exit when branch condition"]; - } - 46 [label="Enter when branch result"]; - subgraph cluster_15 { - color=blue - 47 [label="Enter block"]; - 48 [label="Exit block"]; - } - 49 [label="Exit when branch result"]; - 50 [label="Enter when branch result"]; - subgraph cluster_16 { - color=blue - 51 [label="Enter block"]; - 52 [label="Access variable R|/x|"]; - 53 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 54 [label="Exit block"]; - } - 55 [label="Exit when branch result"]; - 56 [label="Exit when"]; - } - 57 [label="Access variable R|/x|"]; - 58 [label="Function call: R|/x|.#()"]; - subgraph cluster_17 { - color=blue - 59 [label="Enter when"]; - subgraph cluster_18 { - color=blue - 60 [label="Enter when branch condition "]; - subgraph cluster_19 { - color=blue - 61 [label="Enter &&"]; - 62 [label="Access variable R|/b|"]; - 63 [label="Exit left part of &&"]; - 64 [label="Enter right part of &&"]; - 65 [label="Access variable R|/x|"]; - 66 [label="Type operator: x as Boolean"]; - 67 [label="Const: Boolean(true)"]; - 68 [label="Operator =="]; - 69 [label="Exit &&"]; - } - 70 [label="Exit when branch condition"]; - } - subgraph cluster_20 { - color=blue - 71 [label="Enter when branch condition else"]; - 72 [label="Exit when branch condition"]; - } - 73 [label="Enter when branch result"]; - subgraph cluster_21 { - color=blue - 74 [label="Enter block"]; - 75 [label="Exit block"]; - } - 76 [label="Exit when branch result"]; - 77 [label="Enter when branch result"]; - subgraph cluster_22 { - color=blue - 78 [label="Enter block"]; - 79 [label="Access variable R|/x|"]; - 80 [label="Function call: R|/x|.R|kotlin/Boolean.not|()"]; - 81 [label="Exit block"]; - } - 82 [label="Exit when branch result"]; - 83 [label="Exit when"]; - } - 84 [label="Access variable R|/x|"]; - 85 [label="Function call: R|/x|.#()"]; - subgraph cluster_23 { - color=blue - 86 [label="Enter when"]; - subgraph cluster_24 { - color=blue - 87 [label="Enter when branch condition "]; - subgraph cluster_25 { - color=blue - 88 [label="Enter ||"]; - 89 [label="Access variable R|/b|"]; - 90 [label="Exit left part of ||"]; - 91 [label="Enter right part of ||"]; - 92 [label="Access variable R|/x|"]; - 93 [label="Type operator: x as Boolean"]; - 94 [label="Exit ||"]; - } - 95 [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 result"]; - subgraph cluster_27 { - color=blue - 99 [label="Enter block"]; - 100 [label="Exit block"]; - } - 101 [label="Exit when branch result"]; - 102 [label="Enter when branch result"]; - subgraph cluster_28 { - color=blue - 103 [label="Enter block"]; - 104 [label="Access variable R|/x|"]; - 105 [label="Function call: R|/x|.#()"]; - 106 [label="Exit block"]; - } - 107 [label="Exit when branch result"]; - 108 [label="Exit when"]; - } - 109 [label="Access variable R|/x|"]; - 110 [label="Function call: R|/x|.#()"]; - 111 [label="Exit block"]; - } - 112 [label="Exit function test_3" style="filled" fillcolor=red]; - } - + 31 -> {32}; 32 -> {33}; - 33 -> {34}; + 33 -> {37 34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; 37 -> {38}; - 38 -> {42 39}; - 39 -> {40}; + 38 -> {40 39}; + 39 -> {46}; 40 -> {41}; 41 -> {42}; 42 -> {43}; - 43 -> {50 44}; + 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; 47 -> {48}; 48 -> {49}; - 49 -> {56}; + 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; - 53 -> {54}; + 53 -> {59 54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; - 60 -> {61}; - 61 -> {62}; + 60 -> {62 61}; + 61 -> {68}; 62 -> {63}; - 63 -> {69 64}; + 63 -> {64}; 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; 69 -> {70}; - 70 -> {77 71}; + 70 -> {71}; 71 -> {72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {76}; - 76 -> {83}; + 75 -> {79 76}; + 76 -> {77}; 77 -> {78}; 78 -> {79}; 79 -> {80}; - 80 -> {81}; - 81 -> {82}; + 80 -> {82 81}; + 81 -> {88}; 82 -> {83}; 83 -> {84}; 84 -> {85}; @@ -296,63 +252,75 @@ digraph casts_kt { 87 -> {88}; 88 -> {89}; 89 -> {90}; - 90 -> {94 91}; + 90 -> {91}; 91 -> {92}; - 92 -> {93}; - 93 -> {94}; - 94 -> {95}; - 95 -> {102 96}; - 96 -> {97}; - 97 -> {98}; - 98 -> {99}; - 99 -> {100}; - 100 -> {101}; - 101 -> {108}; - 102 -> {103}; - 103 -> {104}; - 104 -> {105}; - 105 -> {106}; - 106 -> {107}; - 107 -> {108}; - 108 -> {109}; - 109 -> {110}; - 110 -> {111}; - 111 -> {112}; - subgraph cluster_29 { + subgraph cluster_21 { color=red - 113 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_30 { + 93 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_22 { color=blue - 114 [label="Enter block"]; - subgraph cluster_31 { + 94 [label="Enter block"]; + subgraph cluster_23 { color=blue - 115 [label="Enter when"]; - subgraph cluster_32 { + 95 [label="Enter when"]; + subgraph cluster_24 { color=blue - 116 [label="Enter when branch condition "]; - 117 [label="Access variable R|/b|"]; - 118 [label="Type operator: b as? Boolean"]; - 119 [label="Const: Null(null)"]; - 120 [label="Operator !="]; - 121 [label="Exit when branch condition"]; + 96 [label="Enter when branch condition "]; + 97 [label="Access variable R|/b|"]; + 98 [label="Type operator: b as? Boolean"]; + 99 [label="Const: Null(null)"]; + 100 [label="Operator !="]; + 101 [label="Exit when branch condition"]; } - subgraph cluster_33 { + subgraph cluster_25 { color=blue - 122 [label="Enter when branch condition else"]; - 123 [label="Exit when branch condition"]; + 102 [label="Enter when branch condition else"]; + 103 [label="Exit when branch condition"]; } - 124 [label="Enter when branch result"]; - subgraph cluster_34 { + 104 [label="Synthetic else branch"]; + 105 [label="Enter when branch result"]; + subgraph cluster_26 { color=blue - 125 [label="Enter block"]; - 126 [label="Access variable R|/b|"]; - 127 [label="Function call: R|/b|.#()"]; - 128 [label="Exit block"]; + 106 [label="Enter block"]; + 107 [label="Access variable R|/b|"]; + 108 [label="Function call: R|/b|.#()"]; + 109 [label="Exit block"]; } - 129 [label="Exit when branch result"]; + 110 [label="Exit when branch result"]; + 111 [label="Enter when branch result"]; + subgraph cluster_27 { + color=blue + 112 [label="Enter block"]; + 113 [label="Access variable R|/b|"]; + 114 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 115 [label="Exit block"]; + } + 116 [label="Exit when branch result"]; + 117 [label="Exit when"]; + } + 118 [label="Access variable R|/b|"]; + 119 [label="Function call: R|/b|.#()"]; + subgraph cluster_28 { + color=blue + 120 [label="Enter when"]; + subgraph cluster_29 { + color=blue + 121 [label="Enter when branch condition "]; + 122 [label="Access variable R|/b|"]; + 123 [label="Type operator: b as? Boolean"]; + 124 [label="Const: Null(null)"]; + 125 [label="Operator =="]; + 126 [label="Exit when branch condition"]; + } + subgraph cluster_30 { + color=blue + 127 [label="Enter when branch condition else"]; + 128 [label="Exit when branch condition"]; + } + 129 [label="Synthetic else branch"]; 130 [label="Enter when branch result"]; - subgraph cluster_35 { + subgraph cluster_31 { color=blue 131 [label="Enter block"]; 132 [label="Access variable R|/b|"]; @@ -360,54 +328,44 @@ digraph casts_kt { 134 [label="Exit block"]; } 135 [label="Exit when branch result"]; - 136 [label="Exit when"]; + 136 [label="Enter when branch result"]; + subgraph cluster_32 { + color=blue + 137 [label="Enter block"]; + 138 [label="Access variable R|/b|"]; + 139 [label="Function call: R|/b|.#()"]; + 140 [label="Exit block"]; + } + 141 [label="Exit when branch result"]; + 142 [label="Exit when"]; } - 137 [label="Access variable R|/b|"]; - 138 [label="Function call: R|/b|.#()"]; - subgraph cluster_36 { - color=blue - 139 [label="Enter when"]; - subgraph cluster_37 { - color=blue - 140 [label="Enter when branch condition "]; - 141 [label="Access variable R|/b|"]; - 142 [label="Type operator: b as? Boolean"]; - 143 [label="Const: Null(null)"]; - 144 [label="Operator =="]; - 145 [label="Exit when branch condition"]; - } - subgraph cluster_38 { - color=blue - 146 [label="Enter when branch condition else"]; - 147 [label="Exit when branch condition"]; - } - 148 [label="Enter when branch result"]; - subgraph cluster_39 { - color=blue - 149 [label="Enter block"]; - 150 [label="Access variable R|/b|"]; - 151 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 152 [label="Exit block"]; - } - 153 [label="Exit when branch result"]; - 154 [label="Enter when branch result"]; - subgraph cluster_40 { - color=blue - 155 [label="Enter block"]; - 156 [label="Access variable R|/b|"]; - 157 [label="Function call: R|/b|.#()"]; - 158 [label="Exit block"]; - } - 159 [label="Exit when branch result"]; - 160 [label="Exit when"]; - } - 161 [label="Access variable R|/b|"]; - 162 [label="Function call: R|/b|.#()"]; - 163 [label="Exit block"]; + 143 [label="Access variable R|/b|"]; + 144 [label="Function call: R|/b|.#()"]; + 145 [label="Exit block"]; } - 164 [label="Exit function test_4" style="filled" fillcolor=red]; + 146 [label="Exit function test_4" style="filled" fillcolor=red]; } + 93 -> {94}; + 94 -> {95}; + 95 -> {96}; + 96 -> {97}; + 97 -> {98}; + 98 -> {99}; + 99 -> {100}; + 100 -> {101}; + 101 -> {111 102}; + 102 -> {103}; + 103 -> {105 104}; + 104 -> {117}; + 105 -> {106}; + 106 -> {107}; + 107 -> {108}; + 108 -> {109}; + 109 -> {110}; + 110 -> {117}; + 111 -> {112}; + 112 -> {113}; 113 -> {114}; 114 -> {115}; 115 -> {116}; @@ -416,21 +374,21 @@ digraph casts_kt { 118 -> {119}; 119 -> {120}; 120 -> {121}; - 121 -> {130 122}; + 121 -> {122}; 122 -> {123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; - 126 -> {127}; + 126 -> {136 127}; 127 -> {128}; - 128 -> {129}; - 129 -> {136}; + 128 -> {130 129}; + 129 -> {142}; 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; 134 -> {135}; - 135 -> {136}; + 135 -> {142}; 136 -> {137}; 137 -> {138}; 138 -> {139}; @@ -440,24 +398,6 @@ digraph casts_kt { 142 -> {143}; 143 -> {144}; 144 -> {145}; - 145 -> {154 146}; - 146 -> {147}; - 147 -> {148}; - 148 -> {149}; - 149 -> {150}; - 150 -> {151}; - 151 -> {152}; - 152 -> {153}; - 153 -> {160}; - 154 -> {155}; - 155 -> {156}; - 156 -> {157}; - 157 -> {158}; - 158 -> {159}; - 159 -> {160}; - 160 -> {161}; - 161 -> {162}; - 162 -> {163}; - 163 -> {164}; + 145 -> {146}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/casts.txt b/compiler/fir/resolve/testData/resolve/smartcasts/casts.txt index a4e1b38f408..ea270c03593 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/casts.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/casts.txt @@ -8,8 +8,6 @@ FILE: casts.kt (R|/x| as R|kotlin/Boolean|) -> { R|/x|.R|kotlin/Boolean.not|() } - else -> { - } } R|/x|.R|kotlin/Boolean.not|() @@ -19,8 +17,6 @@ FILE: casts.kt R|/b| && (R|/x| as R|kotlin/Boolean|) -> { R|/x|.R|kotlin/Boolean.not|() } - else -> { - } } R|/x|.#() @@ -28,8 +24,6 @@ FILE: casts.kt R|/b| && ==((R|/x| as R|kotlin/Boolean|), Boolean(true)) -> { R|/x|.R|kotlin/Boolean.not|() } - else -> { - } } R|/x|.#() @@ -37,8 +31,6 @@ FILE: casts.kt R|/b| || (R|/x| as R|kotlin/Boolean|) -> { R|/x|.#() } - else -> { - } } R|/x|.#() diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot index 3d0a1d12a6e..44be738ba9d 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot @@ -78,32 +78,21 @@ digraph elvis_kt { } 32 [label="Exit when branch condition"]; } + 33 [label="Synthetic else branch"]; + 34 [label="Enter when branch result"]; subgraph cluster_12 { color=blue - 33 [label="Enter when branch condition else"]; - 34 [label="Exit when branch condition"]; + 35 [label="Enter block"]; + 36 [label="Access variable R|/x|"]; + 37 [label="Function call: R|/x|.R|/A.foo|()"]; + 38 [label="Exit block"]; } - 35 [label="Enter when branch result"]; - subgraph cluster_13 { - color=blue - 36 [label="Enter block"]; - 37 [label="Exit block"]; - } - 38 [label="Exit when branch result"]; - 39 [label="Enter when branch result"]; - subgraph cluster_14 { - color=blue - 40 [label="Enter block"]; - 41 [label="Access variable R|/x|"]; - 42 [label="Function call: R|/x|.R|/A.foo|()"]; - 43 [label="Exit block"]; - } - 44 [label="Exit when branch result"]; - 45 [label="Exit when"]; + 39 [label="Exit when branch result"]; + 40 [label="Exit when"]; } - 46 [label="Exit block"]; + 41 [label="Exit block"]; } - 47 [label="Exit function test_1" style="filled" fillcolor=red]; + 42 [label="Exit function test_1" style="filled" fillcolor=red]; } 6 -> {7}; @@ -127,26 +116,180 @@ digraph elvis_kt { 24 -> {31}; 25 -> {26}; 26 -> {27}; - 27 -> {47}; + 27 -> {42}; 27 -> {28} [style=dotted]; 28 -> {29} [style=dotted]; 29 -> {30} [style=dotted]; 30 -> {31} [style=dotted]; 31 -> {32}; - 32 -> {39 33}; - 33 -> {34}; + 32 -> {34 33}; + 33 -> {40}; 34 -> {35}; 35 -> {36}; 36 -> {37}; 37 -> {38}; - 38 -> {45}; + 38 -> {39}; 39 -> {40}; 40 -> {41}; 41 -> {42}; - 42 -> {43}; + + subgraph cluster_13 { + color=red + 43 [label="Enter function test2" style="filled" fillcolor=red]; + subgraph cluster_14 { + color=blue + 44 [label="Enter block"]; + subgraph cluster_15 { + color=blue + 45 [label="Enter when"]; + subgraph cluster_16 { + color=blue + 46 [label="Enter when branch condition "]; + 47 [label="Access variable R|/b|"]; + 48 [label="Type operator: b !is String"]; + 49 [label="Exit when branch condition"]; + } + 50 [label="Synthetic else branch"]; + 51 [label="Enter when branch result"]; + subgraph cluster_17 { + 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]; + } + 57 [label="Exit when branch result" style="filled" fillcolor=gray]; + 58 [label="Exit when"]; + } + subgraph cluster_18 { + color=blue + 59 [label="Enter when"]; + subgraph cluster_19 { + color=blue + 60 [label="Enter when branch condition "]; + 61 [label="Access variable R|/a|"]; + 62 [label="Type operator: a !is String?"]; + 63 [label="Exit when branch condition"]; + } + 64 [label="Synthetic else branch"]; + 65 [label="Enter when branch result"]; + subgraph cluster_20 { + color=blue + 66 [label="Enter block"]; + 67 [label="Const: String()"]; + 68 [label="Jump: ^test2 String()"]; + 69 [label="Stub" style="filled" fillcolor=gray]; + 70 [label="Exit block" style="filled" fillcolor=gray]; + } + 71 [label="Exit when branch result" style="filled" fillcolor=gray]; + 72 [label="Exit when"]; + } + subgraph cluster_21 { + color=blue + 73 [label="Enter when"]; + 74 [label="Access variable R|/a|"]; + 75 [label="Variable declaration: lval : R|kotlin/String?|"]; + subgraph cluster_22 { + color=blue + 76 [label="Enter when branch condition "]; + 77 [label="Const: Null(null)"]; + 78 [label="Operator =="]; + 79 [label="Exit when branch condition"]; + } + subgraph cluster_23 { + color=blue + 80 [label="Enter when branch condition else"]; + 81 [label="Exit when branch condition"]; + } + 82 [label="Enter when branch result"]; + subgraph cluster_24 { + color=blue + 83 [label="Enter block"]; + 84 [label="Access variable R|/|"]; + 85 [label="Exit block"]; + } + 86 [label="Exit when branch result"]; + 87 [label="Enter when branch result"]; + subgraph cluster_25 { + color=blue + 88 [label="Enter block"]; + 89 [label="Access variable R|/b|"]; + 90 [label="Exit block"]; + } + 91 [label="Exit when branch result"]; + 92 [label="Exit when"]; + } + 93 [label="Jump: ^test2 when (lval : R|kotlin/String?| = R|/a|) { + ==($subj$, Null(null)) -> { + R|/b| + } + else -> { + R|/| + } +} +"]; + 94 [label="Stub" style="filled" fillcolor=gray]; + 95 [label="Exit block" style="filled" fillcolor=gray]; + } + 96 [label="Exit function test2" style="filled" fillcolor=red]; + } + 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; + 47 -> {48}; + 48 -> {49}; + 49 -> {51 50}; + 50 -> {58}; + 51 -> {52}; + 52 -> {53}; + 53 -> {54}; + 54 -> {96}; + 54 -> {55} [style=dotted]; + 55 -> {56} [style=dotted]; + 56 -> {57} [style=dotted]; + 57 -> {58} [style=dotted]; + 58 -> {59}; + 59 -> {60}; + 60 -> {61}; + 61 -> {62}; + 62 -> {63}; + 63 -> {65 64}; + 64 -> {72}; + 65 -> {66}; + 66 -> {67}; + 67 -> {68}; + 68 -> {96}; + 68 -> {69} [style=dotted]; + 69 -> {70} [style=dotted]; + 70 -> {71} [style=dotted]; + 71 -> {72} [style=dotted]; + 72 -> {73}; + 73 -> {74}; + 74 -> {75}; + 75 -> {76}; + 76 -> {77}; + 77 -> {78}; + 78 -> {79}; + 79 -> {87 80}; + 80 -> {81}; + 81 -> {82}; + 82 -> {83}; + 83 -> {84}; + 84 -> {85}; + 85 -> {86}; + 86 -> {92}; + 87 -> {88}; + 88 -> {89}; + 89 -> {90}; + 90 -> {91}; + 91 -> {92}; + 92 -> {93}; + 93 -> {96}; + 93 -> {94} [style=dotted]; + 94 -> {95} [style=dotted]; + 95 -> {96} [style=dotted]; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.kt b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.kt index fcc46a3ece9..b8a31666e1b 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.kt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.kt @@ -7,4 +7,10 @@ fun test_1(x: A?) { if (x?.b ?: return) { x.foo() } +} + +fun test2(a: Any?, b: Any?): String { + if (b !is String) return "" + if (a !is String?) return "" + return a ?: b } \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.txt b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.txt index 2a05ce6da56..4c54154713d 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.txt @@ -19,7 +19,28 @@ FILE: elvis.kt -> { R|/x|.R|/A.foo|() } + } + + } + public final fun test2(a: R|kotlin/Any?|, b: R|kotlin/Any?|): R|kotlin/String| { + when () { + (R|/b| !is R|kotlin/String|) -> { + ^test2 String() + } + } + + when () { + (R|/a| !is R|kotlin/String?|) -> { + ^test2 String() + } + } + + ^test2 when (lval : R|kotlin/String?| = R|/a|) { + ==($subj$, Null(null)) -> { + R|/b| + } else -> { + R|/| } } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot b/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot index 2b17968ee6c..3d1b4ffa4b4 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.dot @@ -43,41 +43,30 @@ digraph endlessLoops_kt { 14 [label="Access variable R|/b|"]; 15 [label="Exit when branch condition"]; } + 16 [label="Synthetic else branch"]; + 17 [label="Enter when branch result"]; subgraph cluster_9 { color=blue - 16 [label="Enter when branch condition else"]; - 17 [label="Exit when branch condition"]; + 18 [label="Enter block"]; + 19 [label="Jump: break@@@[Boolean(true)] "]; + 20 [label="Stub" style="filled" fillcolor=gray]; + 21 [label="Exit block" style="filled" fillcolor=gray]; } - 18 [label="Enter when branch result"]; - subgraph cluster_10 { - color=blue - 19 [label="Enter block"]; - 20 [label="Exit block"]; - } - 21 [label="Exit when branch result"]; - 22 [label="Enter when branch result"]; - subgraph cluster_11 { - color=blue - 23 [label="Enter block"]; - 24 [label="Jump: break@@@[Boolean(true)] "]; - 25 [label="Stub" style="filled" fillcolor=gray]; - 26 [label="Exit block" style="filled" fillcolor=gray]; - } - 27 [label="Exit when branch result" style="filled" fillcolor=gray]; - 28 [label="Exit when"]; + 22 [label="Exit when branch result" style="filled" fillcolor=gray]; + 23 [label="Exit when"]; } - 29 [label="Exit block"]; + 24 [label="Exit block"]; } - 30 [label="Exit loop block"]; + 25 [label="Exit loop block"]; } - 31 [label="Stub" style="filled" fillcolor=gray]; - 32 [label="Exit whileloop"]; + 26 [label="Stub" style="filled" fillcolor=gray]; + 27 [label="Exit whileloop"]; } - 33 [label="Access variable R|/x|"]; - 34 [label="Function call: R|/x|.R|/A.foo|()"]; - 35 [label="Exit block"]; + 28 [label="Access variable R|/x|"]; + 29 [label="Function call: R|/x|.R|/A.foo|()"]; + 30 [label="Exit block"]; } - 36 [label="Exit function test_1" style="filled" fillcolor=red]; + 31 [label="Exit function test_1" style="filled" fillcolor=red]; } 2 -> {3}; @@ -86,7 +75,7 @@ digraph endlessLoops_kt { 5 -> {6}; 6 -> {7}; 7 -> {8}; - 7 -> {31} [style=dotted]; + 7 -> {26} [style=dotted]; 8 -> {9}; 9 -> {10}; 10 -> {11}; @@ -94,444 +83,454 @@ digraph endlessLoops_kt { 12 -> {13}; 13 -> {14}; 14 -> {15}; - 15 -> {22 16}; - 16 -> {17}; + 15 -> {17 16}; + 16 -> {23}; 17 -> {18}; 18 -> {19}; - 19 -> {20}; - 20 -> {21}; - 21 -> {28}; - 22 -> {23}; + 19 -> {27}; + 19 -> {20} [style=dotted]; + 20 -> {21} [style=dotted]; + 21 -> {22} [style=dotted]; + 22 -> {23} [style=dotted]; 23 -> {24}; - 24 -> {32}; - 24 -> {25} [style=dotted]; - 25 -> {26} [style=dotted]; + 24 -> {25}; + 25 -> {5}; 26 -> {27} [style=dotted]; - 27 -> {28} [style=dotted]; + 27 -> {28}; 28 -> {29}; 29 -> {30}; - 30 -> {5}; - 31 -> {32} [style=dotted]; + 30 -> {31}; + + subgraph cluster_10 { + color=red + 32 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_11 { + color=blue + 33 [label="Enter block"]; + subgraph cluster_12 { + color=blue + 34 [label="Enter while loop"]; + subgraph cluster_13 { + color=blue + 35 [label="Enter loop condition"]; + 36 [label="Const: Boolean(true)"]; + 37 [label="Exit loop condition"]; + } + subgraph cluster_14 { + color=blue + 38 [label="Enter loop block"]; + subgraph cluster_15 { + color=blue + 39 [label="Enter block"]; + subgraph cluster_16 { + color=blue + 40 [label="Enter when"]; + subgraph cluster_17 { + color=blue + 41 [label="Enter when branch condition "]; + 42 [label="Access variable R|/b|"]; + 43 [label="Exit when branch condition"]; + } + 44 [label="Synthetic else branch"]; + 45 [label="Enter when branch result"]; + subgraph cluster_18 { + color=blue + 46 [label="Enter block"]; + 47 [label="Access variable R|/x|"]; + 48 [label="Type operator: x as A"]; + 49 [label="Jump: break@@@[Boolean(true)] "]; + 50 [label="Stub" style="filled" fillcolor=gray]; + 51 [label="Exit block" style="filled" fillcolor=gray]; + } + 52 [label="Exit when branch result" style="filled" fillcolor=gray]; + 53 [label="Exit when"]; + } + 54 [label="Exit block"]; + } + 55 [label="Exit loop block"]; + } + 56 [label="Stub" style="filled" fillcolor=gray]; + 57 [label="Exit whileloop"]; + } + 58 [label="Access variable R|/x|"]; + 59 [label="Function call: R|/x|.R|/A.foo|()"]; + 60 [label="Exit block"]; + } + 61 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 32 -> {33}; 33 -> {34}; 34 -> {35}; 35 -> {36}; - - subgraph cluster_12 { - color=red - 37 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_13 { - color=blue - 38 [label="Enter block"]; - subgraph cluster_14 { - color=blue - 39 [label="Enter while loop"]; - subgraph cluster_15 { - color=blue - 40 [label="Enter loop condition"]; - 41 [label="Const: Boolean(true)"]; - 42 [label="Exit loop condition"]; - } - subgraph cluster_16 { - color=blue - 43 [label="Enter loop block"]; - subgraph cluster_17 { - color=blue - 44 [label="Enter block"]; - subgraph cluster_18 { - color=blue - 45 [label="Enter when"]; - subgraph cluster_19 { - color=blue - 46 [label="Enter when branch condition "]; - 47 [label="Access variable R|/b|"]; - 48 [label="Exit when branch condition"]; - } - subgraph cluster_20 { - color=blue - 49 [label="Enter when branch condition else"]; - 50 [label="Exit when branch condition"]; - } - 51 [label="Enter when branch result"]; - subgraph cluster_21 { - color=blue - 52 [label="Enter block"]; - 53 [label="Exit block"]; - } - 54 [label="Exit when branch result"]; - 55 [label="Enter when branch result"]; - subgraph cluster_22 { - color=blue - 56 [label="Enter block"]; - 57 [label="Access variable R|/x|"]; - 58 [label="Type operator: x as A"]; - 59 [label="Jump: break@@@[Boolean(true)] "]; - 60 [label="Stub" style="filled" fillcolor=gray]; - 61 [label="Exit block" style="filled" fillcolor=gray]; - } - 62 [label="Exit when branch result" style="filled" fillcolor=gray]; - 63 [label="Exit when"]; - } - 64 [label="Exit block"]; - } - 65 [label="Exit loop block"]; - } - 66 [label="Stub" style="filled" fillcolor=gray]; - 67 [label="Exit whileloop"]; - } - 68 [label="Access variable R|/x|"]; - 69 [label="Function call: R|/x|.R|/A.foo|()"]; - 70 [label="Exit block"]; - } - 71 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 36 -> {37}; 37 -> {38}; + 37 -> {56} [style=dotted]; 38 -> {39}; 39 -> {40}; 40 -> {41}; 41 -> {42}; 42 -> {43}; - 42 -> {66} [style=dotted]; - 43 -> {44}; - 44 -> {45}; + 43 -> {45 44}; + 44 -> {53}; 45 -> {46}; 46 -> {47}; 47 -> {48}; - 48 -> {55 49}; - 49 -> {50}; - 50 -> {51}; - 51 -> {52}; - 52 -> {53}; + 48 -> {49}; + 49 -> {57}; + 49 -> {50} [style=dotted]; + 50 -> {51} [style=dotted]; + 51 -> {52} [style=dotted]; + 52 -> {53} [style=dotted]; 53 -> {54}; - 54 -> {63}; - 55 -> {56}; - 56 -> {57}; + 54 -> {55}; + 55 -> {35}; + 56 -> {57} [style=dotted]; 57 -> {58}; 58 -> {59}; - 59 -> {67}; - 59 -> {60} [style=dotted]; - 60 -> {61} [style=dotted]; - 61 -> {62} [style=dotted]; - 62 -> {63} [style=dotted]; + 59 -> {60}; + 60 -> {61}; + + subgraph cluster_19 { + color=red + 62 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_20 { + color=blue + 63 [label="Enter block"]; + subgraph cluster_21 { + color=blue + 64 [label="Enter while loop"]; + subgraph cluster_22 { + color=blue + 65 [label="Enter loop condition"]; + 66 [label="Const: Boolean(true)"]; + 67 [label="Exit loop condition"]; + } + subgraph cluster_23 { + color=blue + 68 [label="Enter loop block"]; + subgraph cluster_24 { + color=blue + 69 [label="Enter block"]; + 70 [label="Access variable R|/x|"]; + 71 [label="Type operator: x as A"]; + subgraph cluster_25 { + color=blue + 72 [label="Enter when"]; + subgraph cluster_26 { + color=blue + 73 [label="Enter when branch condition "]; + 74 [label="Access variable R|/b|"]; + 75 [label="Exit when branch condition"]; + } + 76 [label="Synthetic else branch"]; + 77 [label="Enter when branch result"]; + subgraph cluster_27 { + 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]; + } + 82 [label="Exit when branch result" style="filled" fillcolor=gray]; + 83 [label="Exit when"]; + } + subgraph cluster_28 { + color=blue + 84 [label="Enter when"]; + subgraph cluster_29 { + color=blue + 85 [label="Enter when branch condition "]; + 86 [label="Access variable R|/b|"]; + 87 [label="Exit when branch condition"]; + } + 88 [label="Synthetic else branch"]; + 89 [label="Enter when branch result"]; + subgraph cluster_30 { + 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]; + } + 94 [label="Exit when branch result" style="filled" fillcolor=gray]; + 95 [label="Exit when"]; + } + 96 [label="Exit block"]; + } + 97 [label="Exit loop block"]; + } + 98 [label="Stub" style="filled" fillcolor=gray]; + 99 [label="Exit whileloop"]; + } + 100 [label="Access variable R|/x|"]; + 101 [label="Function call: R|/x|.R|/A.foo|()"]; + 102 [label="Exit block"]; + } + 103 [label="Exit function test_3" style="filled" fillcolor=red]; + } + + 62 -> {63}; 63 -> {64}; 64 -> {65}; - 65 -> {40}; - 66 -> {67} [style=dotted]; + 65 -> {66}; + 66 -> {67}; 67 -> {68}; + 67 -> {98} [style=dotted]; 68 -> {69}; 69 -> {70}; 70 -> {71}; - - subgraph cluster_23 { - color=red - 72 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_24 { - color=blue - 73 [label="Enter block"]; - subgraph cluster_25 { - color=blue - 74 [label="Enter while loop"]; - subgraph cluster_26 { - color=blue - 75 [label="Enter loop condition"]; - 76 [label="Const: Boolean(true)"]; - 77 [label="Exit loop condition"]; - } - subgraph cluster_27 { - color=blue - 78 [label="Enter loop block"]; - subgraph cluster_28 { - color=blue - 79 [label="Enter block"]; - 80 [label="Access variable R|/x|"]; - 81 [label="Type operator: x as A"]; - subgraph cluster_29 { - color=blue - 82 [label="Enter when"]; - subgraph cluster_30 { - color=blue - 83 [label="Enter when branch condition "]; - 84 [label="Access variable R|/b|"]; - 85 [label="Exit when branch condition"]; - } - subgraph cluster_31 { - color=blue - 86 [label="Enter when branch condition else"]; - 87 [label="Exit when branch condition"]; - } - 88 [label="Enter when branch result"]; - subgraph cluster_32 { - color=blue - 89 [label="Enter block"]; - 90 [label="Exit block"]; - } - 91 [label="Exit when branch result"]; - 92 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 93 [label="Enter block"]; - 94 [label="Jump: break@@@[Boolean(true)] "]; - 95 [label="Stub" style="filled" fillcolor=gray]; - 96 [label="Exit block" style="filled" fillcolor=gray]; - } - 97 [label="Exit when branch result" style="filled" fillcolor=gray]; - 98 [label="Exit when"]; - } - subgraph cluster_34 { - color=blue - 99 [label="Enter when"]; - subgraph cluster_35 { - color=blue - 100 [label="Enter when branch condition "]; - 101 [label="Access variable R|/b|"]; - 102 [label="Exit when branch condition"]; - } - subgraph cluster_36 { - color=blue - 103 [label="Enter when branch condition else"]; - 104 [label="Exit when branch condition"]; - } - 105 [label="Enter when branch result"]; - subgraph cluster_37 { - color=blue - 106 [label="Enter block"]; - 107 [label="Exit block"]; - } - 108 [label="Exit when branch result"]; - 109 [label="Enter when branch result"]; - subgraph cluster_38 { - color=blue - 110 [label="Enter block"]; - 111 [label="Jump: break@@@[Boolean(true)] "]; - 112 [label="Stub" style="filled" fillcolor=gray]; - 113 [label="Exit block" style="filled" fillcolor=gray]; - } - 114 [label="Exit when branch result" style="filled" fillcolor=gray]; - 115 [label="Exit when"]; - } - 116 [label="Exit block"]; - } - 117 [label="Exit loop block"]; - } - 118 [label="Stub" style="filled" fillcolor=gray]; - 119 [label="Exit whileloop"]; - } - 120 [label="Access variable R|/x|"]; - 121 [label="Function call: R|/x|.R|/A.foo|()"]; - 122 [label="Exit block"]; - } - 123 [label="Exit function test_3" style="filled" fillcolor=red]; - } - + 71 -> {72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; - 75 -> {76}; - 76 -> {77}; + 75 -> {77 76}; + 76 -> {83}; 77 -> {78}; - 77 -> {118} [style=dotted]; 78 -> {79}; - 79 -> {80}; - 80 -> {81}; - 81 -> {82}; - 82 -> {83}; + 79 -> {99}; + 79 -> {80} [style=dotted]; + 80 -> {81} [style=dotted]; + 81 -> {82} [style=dotted]; + 82 -> {83} [style=dotted]; 83 -> {84}; 84 -> {85}; - 85 -> {92 86}; + 85 -> {86}; 86 -> {87}; - 87 -> {88}; - 88 -> {89}; + 87 -> {89 88}; + 88 -> {95}; 89 -> {90}; 90 -> {91}; - 91 -> {98}; - 92 -> {93}; - 93 -> {94}; - 94 -> {119}; + 91 -> {99}; + 91 -> {92} [style=dotted]; + 92 -> {93} [style=dotted]; + 93 -> {94} [style=dotted]; 94 -> {95} [style=dotted]; - 95 -> {96} [style=dotted]; - 96 -> {97} [style=dotted]; - 97 -> {98} [style=dotted]; - 98 -> {99}; + 95 -> {96}; + 96 -> {97}; + 97 -> {65}; + 98 -> {99} [style=dotted]; 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {109 103}; - 103 -> {104}; + 102 -> {103}; + + subgraph cluster_31 { + color=red + 104 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_32 { + color=blue + 105 [label="Enter block"]; + subgraph cluster_33 { + color=blue + 106 [label="Enter while loop"]; + subgraph cluster_34 { + color=blue + 107 [label="Enter loop condition"]; + 108 [label="Const: Boolean(true)"]; + 109 [label="Exit loop condition"]; + } + subgraph cluster_35 { + color=blue + 110 [label="Enter loop block"]; + subgraph cluster_36 { + color=blue + 111 [label="Enter block"]; + subgraph cluster_37 { + color=blue + 112 [label="Enter when"]; + subgraph cluster_38 { + color=blue + 113 [label="Enter when branch condition "]; + 114 [label="Access variable R|/b|"]; + 115 [label="Exit when branch condition"]; + } + 116 [label="Synthetic else branch"]; + 117 [label="Enter when branch result"]; + subgraph cluster_39 { + color=blue + 118 [label="Enter block"]; + 119 [label="Access variable R|/x|"]; + 120 [label="Type operator: x as A"]; + 121 [label="Jump: break@@@[Boolean(true)] "]; + 122 [label="Stub" style="filled" fillcolor=gray]; + 123 [label="Exit block" style="filled" fillcolor=gray]; + } + 124 [label="Exit when branch result" style="filled" fillcolor=gray]; + 125 [label="Exit when"]; + } + 126 [label="Jump: break@@@[Boolean(true)] "]; + 127 [label="Stub" style="filled" fillcolor=gray]; + 128 [label="Exit block" style="filled" fillcolor=gray]; + } + 129 [label="Exit loop block" style="filled" fillcolor=gray]; + } + 130 [label="Stub" style="filled" fillcolor=gray]; + 131 [label="Exit whileloop"]; + } + 132 [label="Access variable R|/x|"]; + 133 [label="Function call: R|/x|.#()"]; + 134 [label="Exit block"]; + } + 135 [label="Exit function test_4" style="filled" fillcolor=red]; + } + 104 -> {105}; 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {115}; + 108 -> {109}; 109 -> {110}; + 109 -> {130} [style=dotted]; 110 -> {111}; - 111 -> {119}; - 111 -> {112} [style=dotted]; - 112 -> {113} [style=dotted]; - 113 -> {114} [style=dotted]; - 114 -> {115} [style=dotted]; - 115 -> {116}; - 116 -> {117}; - 117 -> {75}; - 118 -> {119} [style=dotted]; + 111 -> {112}; + 112 -> {113}; + 113 -> {114}; + 114 -> {115}; + 115 -> {117 116}; + 116 -> {125}; + 117 -> {118}; + 118 -> {119}; 119 -> {120}; 120 -> {121}; - 121 -> {122}; - 122 -> {123}; - - subgraph cluster_39 { - color=red - 124 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_40 { - color=blue - 125 [label="Enter block"]; - subgraph cluster_41 { - color=blue - 126 [label="Enter while loop"]; - subgraph cluster_42 { - color=blue - 127 [label="Enter loop condition"]; - 128 [label="Const: Boolean(true)"]; - 129 [label="Exit loop condition"]; - } - subgraph cluster_43 { - color=blue - 130 [label="Enter loop block"]; - subgraph cluster_44 { - color=blue - 131 [label="Enter block"]; - subgraph cluster_45 { - color=blue - 132 [label="Enter when"]; - subgraph cluster_46 { - color=blue - 133 [label="Enter when branch condition "]; - 134 [label="Access variable R|/b|"]; - 135 [label="Exit when branch condition"]; - } - subgraph cluster_47 { - color=blue - 136 [label="Enter when branch condition else"]; - 137 [label="Exit when branch condition"]; - } - 138 [label="Enter when branch result"]; - subgraph cluster_48 { - color=blue - 139 [label="Enter block"]; - 140 [label="Exit block"]; - } - 141 [label="Exit when branch result"]; - 142 [label="Enter when branch result"]; - subgraph cluster_49 { - color=blue - 143 [label="Enter block"]; - 144 [label="Access variable R|/x|"]; - 145 [label="Type operator: x as A"]; - 146 [label="Jump: break@@@[Boolean(true)] "]; - 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="Jump: break@@@[Boolean(true)] "]; - 152 [label="Stub" style="filled" fillcolor=gray]; - 153 [label="Exit block" style="filled" fillcolor=gray]; - } - 154 [label="Exit loop block" style="filled" fillcolor=gray]; - } - 155 [label="Stub" style="filled" fillcolor=gray]; - 156 [label="Exit whileloop"]; - } - 157 [label="Access variable R|/x|"]; - 158 [label="Function call: R|/x|.#()"]; - 159 [label="Exit block"]; - } - 160 [label="Exit function test_4" style="filled" fillcolor=red]; - } - - 124 -> {125}; + 121 -> {131}; + 121 -> {122} [style=dotted]; + 122 -> {123} [style=dotted]; + 123 -> {124} [style=dotted]; + 124 -> {125} [style=dotted]; 125 -> {126}; - 126 -> {127}; - 127 -> {128}; - 128 -> {129}; - 129 -> {130}; - 129 -> {155} [style=dotted]; - 130 -> {131}; + 126 -> {131}; + 126 -> {127} [style=dotted]; + 127 -> {128} [style=dotted]; + 128 -> {129} [style=dotted]; + 129 -> {107} [style=dotted]; + 130 -> {131} [style=dotted]; 131 -> {132}; 132 -> {133}; 133 -> {134}; 134 -> {135}; - 135 -> {142 136}; + + subgraph cluster_40 { + color=red + 136 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_41 { + color=blue + 137 [label="Enter block"]; + subgraph cluster_42 { + color=blue + 138 [label="Enter do-while loop"]; + subgraph cluster_43 { + color=blue + 139 [label="Enter loop block"]; + subgraph cluster_44 { + color=blue + 140 [label="Enter block"]; + subgraph cluster_45 { + color=blue + 141 [label="Enter when"]; + subgraph cluster_46 { + color=blue + 142 [label="Enter when branch condition "]; + 143 [label="Access variable R|/b|"]; + 144 [label="Exit when branch condition"]; + } + 145 [label="Synthetic else branch"]; + 146 [label="Enter when branch result"]; + subgraph cluster_47 { + color=blue + 147 [label="Enter block"]; + 148 [label="Access variable R|/x|"]; + 149 [label="Type operator: x as A"]; + 150 [label="Jump: break@@@[Boolean(true)] "]; + 151 [label="Stub" style="filled" fillcolor=gray]; + 152 [label="Exit block" style="filled" fillcolor=gray]; + } + 153 [label="Exit when branch result" style="filled" fillcolor=gray]; + 154 [label="Exit when"]; + } + 155 [label="Exit block"]; + } + 156 [label="Exit loop block"]; + } + subgraph cluster_48 { + color=blue + 157 [label="Enter loop condition"]; + 158 [label="Const: Boolean(true)"]; + 159 [label="Exit loop condition"]; + } + 160 [label="Stub" style="filled" fillcolor=gray]; + 161 [label="Exit do-whileloop"]; + } + 162 [label="Access variable R|/x|"]; + 163 [label="Function call: R|/x|.R|/A.foo|()"]; + 164 [label="Exit block"]; + } + 165 [label="Exit function test_5" style="filled" fillcolor=red]; + } + 136 -> {137}; 137 -> {138}; 138 -> {139}; 139 -> {140}; 140 -> {141}; - 141 -> {150}; + 141 -> {142}; 142 -> {143}; 143 -> {144}; - 144 -> {145}; - 145 -> {146}; - 146 -> {156}; - 146 -> {147} [style=dotted]; - 147 -> {148} [style=dotted]; - 148 -> {149} [style=dotted]; - 149 -> {150} [style=dotted]; - 150 -> {151}; - 151 -> {156}; + 144 -> {146 145}; + 145 -> {154}; + 146 -> {147}; + 147 -> {148}; + 148 -> {149}; + 149 -> {150}; + 150 -> {161}; + 150 -> {151} [style=dotted]; 151 -> {152} [style=dotted]; 152 -> {153} [style=dotted]; 153 -> {154} [style=dotted]; - 154 -> {127} [style=dotted]; - 155 -> {156} [style=dotted]; + 154 -> {155}; + 155 -> {156}; 156 -> {157}; 157 -> {158}; 158 -> {159}; - 159 -> {160}; + 159 -> {139}; + 159 -> {160} [style=dotted]; + 160 -> {161} [style=dotted]; + 161 -> {162}; + 162 -> {163}; + 163 -> {164}; + 164 -> {165}; - subgraph cluster_50 { + subgraph cluster_49 { color=red - 161 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_51 { + 166 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_50 { color=blue - 162 [label="Enter block"]; - subgraph cluster_52 { + 167 [label="Enter block"]; + subgraph cluster_51 { color=blue - 163 [label="Enter do-while loop"]; - subgraph cluster_53 { + 168 [label="Enter do-while loop"]; + subgraph cluster_52 { color=blue - 164 [label="Enter loop block"]; - subgraph cluster_54 { + 169 [label="Enter loop block"]; + subgraph cluster_53 { color=blue - 165 [label="Enter block"]; - subgraph cluster_55 { + 170 [label="Enter block"]; + 171 [label="Access variable R|/x|"]; + 172 [label="Type operator: x as A"]; + subgraph cluster_54 { color=blue - 166 [label="Enter when"]; + 173 [label="Enter when"]; + subgraph cluster_55 { + color=blue + 174 [label="Enter when branch condition "]; + 175 [label="Access variable R|/b|"]; + 176 [label="Exit when branch condition"]; + } + 177 [label="Synthetic else branch"]; + 178 [label="Enter when branch result"]; subgraph cluster_56 { color=blue - 167 [label="Enter when branch condition "]; - 168 [label="Access variable R|/b|"]; - 169 [label="Exit when branch condition"]; - } - subgraph cluster_57 { - color=blue - 170 [label="Enter when branch condition else"]; - 171 [label="Exit when branch condition"]; - } - 172 [label="Enter when branch result"]; - subgraph cluster_58 { - color=blue - 173 [label="Enter block"]; - 174 [label="Exit block"]; - } - 175 [label="Exit when branch result"]; - 176 [label="Enter when branch result"]; - subgraph cluster_59 { - color=blue - 177 [label="Enter block"]; - 178 [label="Access variable R|/x|"]; - 179 [label="Type operator: x as A"]; + 179 [label="Enter block"]; 180 [label="Jump: break@@@[Boolean(true)] "]; 181 [label="Stub" style="filled" fillcolor=gray]; 182 [label="Exit block" style="filled" fillcolor=gray]; @@ -543,7 +542,7 @@ digraph endlessLoops_kt { } 186 [label="Exit loop block"]; } - subgraph cluster_60 { + subgraph cluster_57 { color=blue 187 [label="Enter loop condition"]; 188 [label="Const: Boolean(true)"]; @@ -556,26 +555,21 @@ digraph endlessLoops_kt { 193 [label="Function call: R|/x|.R|/A.foo|()"]; 194 [label="Exit block"]; } - 195 [label="Exit function test_5" style="filled" fillcolor=red]; + 195 [label="Exit function test_6" style="filled" fillcolor=red]; } - 161 -> {162}; - 162 -> {163}; - 163 -> {164}; - 164 -> {165}; - 165 -> {166}; 166 -> {167}; 167 -> {168}; 168 -> {169}; - 169 -> {176 170}; + 169 -> {170}; 170 -> {171}; 171 -> {172}; 172 -> {173}; 173 -> {174}; 174 -> {175}; - 175 -> {184}; - 176 -> {177}; - 177 -> {178}; + 175 -> {176}; + 176 -> {178 177}; + 177 -> {184}; 178 -> {179}; 179 -> {180}; 180 -> {191}; @@ -588,7 +582,7 @@ digraph endlessLoops_kt { 186 -> {187}; 187 -> {188}; 188 -> {189}; - 189 -> {164}; + 189 -> {169}; 189 -> {190} [style=dotted]; 190 -> {191} [style=dotted]; 191 -> {192}; @@ -596,73 +590,41 @@ digraph endlessLoops_kt { 193 -> {194}; 194 -> {195}; - subgraph cluster_61 { + subgraph cluster_58 { color=red - 196 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_62 { + 196 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_59 { color=blue 197 [label="Enter block"]; - subgraph cluster_63 { + subgraph cluster_60 { color=blue 198 [label="Enter do-while loop"]; - subgraph cluster_64 { + subgraph cluster_61 { color=blue 199 [label="Enter loop block"]; - subgraph cluster_65 { + subgraph cluster_62 { color=blue 200 [label="Enter block"]; 201 [label="Access variable R|/x|"]; 202 [label="Type operator: x as A"]; - subgraph cluster_66 { - color=blue - 203 [label="Enter when"]; - subgraph cluster_67 { - color=blue - 204 [label="Enter when branch condition "]; - 205 [label="Access variable R|/b|"]; - 206 [label="Exit when branch condition"]; - } - subgraph cluster_68 { - color=blue - 207 [label="Enter when branch condition else"]; - 208 [label="Exit when branch condition"]; - } - 209 [label="Enter when branch result"]; - subgraph cluster_69 { - color=blue - 210 [label="Enter block"]; - 211 [label="Exit block"]; - } - 212 [label="Exit when branch result"]; - 213 [label="Enter when branch result"]; - subgraph cluster_70 { - color=blue - 214 [label="Enter block"]; - 215 [label="Jump: break@@@[Boolean(true)] "]; - 216 [label="Stub" style="filled" fillcolor=gray]; - 217 [label="Exit block" style="filled" fillcolor=gray]; - } - 218 [label="Exit when branch result" style="filled" fillcolor=gray]; - 219 [label="Exit when"]; - } - 220 [label="Exit block"]; + 203 [label="Exit block"]; } - 221 [label="Exit loop block"]; + 204 [label="Exit loop block"]; } - subgraph cluster_71 { + subgraph cluster_63 { color=blue - 222 [label="Enter loop condition"]; - 223 [label="Const: Boolean(true)"]; - 224 [label="Exit loop condition"]; + 205 [label="Enter loop condition"]; + 206 [label="Const: Boolean(true)"]; + 207 [label="Exit loop condition"]; } - 225 [label="Stub" style="filled" fillcolor=gray]; - 226 [label="Exit do-whileloop"]; + 208 [label="Stub" style="filled" fillcolor=gray]; + 209 [label="Exit do-whileloop" style="filled" fillcolor=gray]; } - 227 [label="Access variable R|/x|"]; - 228 [label="Function call: R|/x|.R|/A.foo|()"]; - 229 [label="Exit block"]; + 210 [label="Access variable R|/x|" style="filled" fillcolor=gray]; + 211 [label="Function call: R|/x|.R|/A.foo|()" style="filled" fillcolor=gray]; + 212 [label="Exit block" style="filled" fillcolor=gray]; } - 230 [label="Exit function test_6" style="filled" fillcolor=red]; + 213 [label="Exit function test_7" style="filled" fillcolor=red style="filled" fillcolor=gray]; } 196 -> {197}; @@ -675,87 +637,13 @@ digraph endlessLoops_kt { 203 -> {204}; 204 -> {205}; 205 -> {206}; - 206 -> {213 207}; - 207 -> {208}; - 208 -> {209}; - 209 -> {210}; - 210 -> {211}; - 211 -> {212}; - 212 -> {219}; - 213 -> {214}; - 214 -> {215}; - 215 -> {226}; - 215 -> {216} [style=dotted]; - 216 -> {217} [style=dotted]; - 217 -> {218} [style=dotted]; - 218 -> {219} [style=dotted]; - 219 -> {220}; - 220 -> {221}; - 221 -> {222}; - 222 -> {223}; - 223 -> {224}; - 224 -> {199}; - 224 -> {225} [style=dotted]; - 225 -> {226} [style=dotted]; - 226 -> {227}; - 227 -> {228}; - 228 -> {229}; - 229 -> {230}; - - subgraph cluster_72 { - color=red - 231 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_73 { - color=blue - 232 [label="Enter block"]; - subgraph cluster_74 { - color=blue - 233 [label="Enter do-while loop"]; - subgraph cluster_75 { - color=blue - 234 [label="Enter loop block"]; - subgraph cluster_76 { - color=blue - 235 [label="Enter block"]; - 236 [label="Access variable R|/x|"]; - 237 [label="Type operator: x as A"]; - 238 [label="Exit block"]; - } - 239 [label="Exit loop block"]; - } - subgraph cluster_77 { - color=blue - 240 [label="Enter loop condition"]; - 241 [label="Const: Boolean(true)"]; - 242 [label="Exit loop condition"]; - } - 243 [label="Stub" style="filled" fillcolor=gray]; - 244 [label="Exit do-whileloop" style="filled" fillcolor=gray]; - } - 245 [label="Access variable R|/x|" style="filled" fillcolor=gray]; - 246 [label="Function call: R|/x|.R|/A.foo|()" style="filled" fillcolor=gray]; - 247 [label="Exit block" style="filled" fillcolor=gray]; - } - 248 [label="Exit function test_7" style="filled" fillcolor=red style="filled" fillcolor=gray]; - } - - 231 -> {232}; - 232 -> {233}; - 233 -> {234}; - 234 -> {235}; - 235 -> {236}; - 236 -> {237}; - 237 -> {238}; - 238 -> {239}; - 239 -> {240}; - 240 -> {241}; - 241 -> {242}; - 242 -> {234}; - 242 -> {243} [style=dotted]; - 243 -> {244} [style=dotted]; - 244 -> {245} [style=dotted]; - 245 -> {246} [style=dotted]; - 246 -> {247} [style=dotted]; - 247 -> {248} [style=dotted]; + 206 -> {207}; + 207 -> {199}; + 207 -> {208} [style=dotted]; + 208 -> {209} [style=dotted]; + 209 -> {210} [style=dotted]; + 210 -> {211} [style=dotted]; + 211 -> {212} [style=dotted]; + 212 -> {213} [style=dotted]; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.txt b/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.txt index 60fb5463f1a..11128b315b4 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/endlessLoops.txt @@ -10,8 +10,6 @@ FILE: endlessLoops.kt R|/b| -> { break@@@[Boolean(true)] } - else -> { - } } } @@ -25,8 +23,6 @@ FILE: endlessLoops.kt (R|/x| as R|A|) break@@@[Boolean(true)] } - else -> { - } } } @@ -40,16 +36,12 @@ FILE: endlessLoops.kt R|/b| -> { break@@@[Boolean(true)] } - else -> { - } } when () { R|/b| -> { break@@@[Boolean(true)] } - else -> { - } } } @@ -63,8 +55,6 @@ FILE: endlessLoops.kt (R|/x| as R|A|) break@@@[Boolean(true)] } - else -> { - } } break@@@[Boolean(true)] @@ -79,8 +69,6 @@ FILE: endlessLoops.kt (R|/x| as R|A|) break@@@[Boolean(true)] } - else -> { - } } } @@ -94,8 +82,6 @@ FILE: endlessLoops.kt R|/b| -> { break@@@[Boolean(true)] } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot index fb6b5e9bd58..26d1faf5766 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot @@ -28,70 +28,48 @@ digraph equalsAndIdentity_kt { 8 [label="Operator =="]; 9 [label="Exit when branch condition"]; } + 10 [label="Synthetic else branch"]; + 11 [label="Enter when branch result"]; subgraph cluster_5 { color=blue - 10 [label="Enter when branch condition else"]; - 11 [label="Exit when branch condition"]; + 12 [label="Enter block"]; + 13 [label="Access variable R|/x|"]; + 14 [label="Function call: R|/x|.R|/A.foo|()"]; + 15 [label="Access variable R|/y|"]; + 16 [label="Function call: R|/y|.R|/A.foo|()"]; + 17 [label="Exit block"]; } - 12 [label="Enter when branch result"]; - subgraph cluster_6 { - color=blue - 13 [label="Enter block"]; - 14 [label="Exit block"]; - } - 15 [label="Exit when branch result"]; - 16 [label="Enter when branch result"]; + 18 [label="Exit when branch result"]; + 19 [label="Exit when"]; + } + subgraph cluster_6 { + color=blue + 20 [label="Enter when"]; subgraph cluster_7 { color=blue - 17 [label="Enter block"]; - 18 [label="Access variable R|/x|"]; - 19 [label="Function call: R|/x|.R|/A.foo|()"]; - 20 [label="Access variable R|/y|"]; - 21 [label="Function call: R|/y|.R|/A.foo|()"]; - 22 [label="Exit block"]; + 21 [label="Enter when branch condition "]; + 22 [label="Access variable R|/x|"]; + 23 [label="Access variable R|/y|"]; + 24 [label="Operator ==="]; + 25 [label="Exit when branch condition"]; } - 23 [label="Exit when branch result"]; - 24 [label="Exit when"]; + 26 [label="Synthetic else branch"]; + 27 [label="Enter when branch result"]; + subgraph cluster_8 { + color=blue + 28 [label="Enter block"]; + 29 [label="Access variable R|/x|"]; + 30 [label="Function call: R|/x|.R|/A.foo|()"]; + 31 [label="Access variable R|/y|"]; + 32 [label="Function call: R|/y|.R|/A.foo|()"]; + 33 [label="Exit block"]; + } + 34 [label="Exit when branch result"]; + 35 [label="Exit when"]; } - subgraph cluster_8 { - color=blue - 25 [label="Enter when"]; - subgraph cluster_9 { - color=blue - 26 [label="Enter when branch condition "]; - 27 [label="Access variable R|/x|"]; - 28 [label="Access variable R|/y|"]; - 29 [label="Operator ==="]; - 30 [label="Exit when branch condition"]; - } - subgraph cluster_10 { - color=blue - 31 [label="Enter when branch condition else"]; - 32 [label="Exit when branch condition"]; - } - 33 [label="Enter when branch result"]; - subgraph cluster_11 { - color=blue - 34 [label="Enter block"]; - 35 [label="Exit block"]; - } - 36 [label="Exit when branch result"]; - 37 [label="Enter when branch result"]; - subgraph cluster_12 { - color=blue - 38 [label="Enter block"]; - 39 [label="Access variable R|/x|"]; - 40 [label="Function call: R|/x|.R|/A.foo|()"]; - 41 [label="Access variable R|/y|"]; - 42 [label="Function call: R|/y|.R|/A.foo|()"]; - 43 [label="Exit block"]; - } - 44 [label="Exit when branch result"]; - 45 [label="Exit when"]; - } - 46 [label="Exit block"]; + 36 [label="Exit block"]; } - 47 [label="Exit function test_1" style="filled" fillcolor=red]; + 37 [label="Exit function test_1" style="filled" fillcolor=red]; } 2 -> {3}; @@ -101,13 +79,13 @@ digraph equalsAndIdentity_kt { 6 -> {7}; 7 -> {8}; 8 -> {9}; - 9 -> {16 10}; - 10 -> {11}; + 9 -> {11 10}; + 10 -> {19}; 11 -> {12}; 12 -> {13}; 13 -> {14}; 14 -> {15}; - 15 -> {24}; + 15 -> {16}; 16 -> {17}; 17 -> {18}; 18 -> {19}; @@ -117,19 +95,80 @@ digraph equalsAndIdentity_kt { 22 -> {23}; 23 -> {24}; 24 -> {25}; - 25 -> {26}; - 26 -> {27}; + 25 -> {27 26}; + 26 -> {35}; 27 -> {28}; 28 -> {29}; 29 -> {30}; - 30 -> {37 31}; + 30 -> {31}; 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; 35 -> {36}; - 36 -> {45}; - 37 -> {38}; + 36 -> {37}; + + subgraph cluster_9 { + color=red + 38 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_10 { + color=blue + 39 [label="Enter block"]; + subgraph cluster_11 { + color=blue + 40 [label="Enter when"]; + subgraph cluster_12 { + color=blue + 41 [label="Enter when branch condition "]; + 42 [label="Access variable R|/x|"]; + 43 [label="Access variable R|/y|"]; + 44 [label="Operator =="]; + 45 [label="Exit when branch condition"]; + } + 46 [label="Synthetic else branch"]; + 47 [label="Enter when branch result"]; + subgraph cluster_13 { + color=blue + 48 [label="Enter block"]; + 49 [label="Access variable R|/x|"]; + 50 [label="Function call: R|/x|.#()"]; + 51 [label="Access variable R|/y|"]; + 52 [label="Function call: R|/y|.#()"]; + 53 [label="Exit block"]; + } + 54 [label="Exit when branch result"]; + 55 [label="Exit when"]; + } + subgraph cluster_14 { + color=blue + 56 [label="Enter when"]; + subgraph cluster_15 { + color=blue + 57 [label="Enter when branch condition "]; + 58 [label="Access variable R|/x|"]; + 59 [label="Access variable R|/y|"]; + 60 [label="Operator ==="]; + 61 [label="Exit when branch condition"]; + } + 62 [label="Synthetic else branch"]; + 63 [label="Enter when branch result"]; + subgraph cluster_16 { + color=blue + 64 [label="Enter block"]; + 65 [label="Access variable R|/x|"]; + 66 [label="Function call: R|/x|.#()"]; + 67 [label="Access variable R|/y|"]; + 68 [label="Function call: R|/y|.#()"]; + 69 [label="Exit block"]; + } + 70 [label="Exit when branch result"]; + 71 [label="Exit when"]; + } + 72 [label="Exit block"]; + } + 73 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 38 -> {39}; 39 -> {40}; 40 -> {41}; @@ -137,92 +176,9 @@ digraph equalsAndIdentity_kt { 42 -> {43}; 43 -> {44}; 44 -> {45}; - 45 -> {46}; - 46 -> {47}; - - subgraph cluster_13 { - color=red - 48 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_14 { - color=blue - 49 [label="Enter block"]; - subgraph cluster_15 { - color=blue - 50 [label="Enter when"]; - subgraph cluster_16 { - color=blue - 51 [label="Enter when branch condition "]; - 52 [label="Access variable R|/x|"]; - 53 [label="Access variable R|/y|"]; - 54 [label="Operator =="]; - 55 [label="Exit when branch condition"]; - } - subgraph cluster_17 { - color=blue - 56 [label="Enter when branch condition else"]; - 57 [label="Exit when branch condition"]; - } - 58 [label="Enter when branch result"]; - subgraph cluster_18 { - color=blue - 59 [label="Enter block"]; - 60 [label="Exit block"]; - } - 61 [label="Exit when branch result"]; - 62 [label="Enter when branch result"]; - subgraph cluster_19 { - color=blue - 63 [label="Enter block"]; - 64 [label="Access variable R|/x|"]; - 65 [label="Function call: R|/x|.#()"]; - 66 [label="Access variable R|/y|"]; - 67 [label="Function call: R|/y|.#()"]; - 68 [label="Exit block"]; - } - 69 [label="Exit when branch result"]; - 70 [label="Exit when"]; - } - subgraph cluster_20 { - color=blue - 71 [label="Enter when"]; - subgraph cluster_21 { - color=blue - 72 [label="Enter when branch condition "]; - 73 [label="Access variable R|/x|"]; - 74 [label="Access variable R|/y|"]; - 75 [label="Operator ==="]; - 76 [label="Exit when branch condition"]; - } - subgraph cluster_22 { - color=blue - 77 [label="Enter when branch condition else"]; - 78 [label="Exit when branch condition"]; - } - 79 [label="Enter when branch result"]; - subgraph cluster_23 { - color=blue - 80 [label="Enter block"]; - 81 [label="Exit block"]; - } - 82 [label="Exit when branch result"]; - 83 [label="Enter when branch result"]; - subgraph cluster_24 { - color=blue - 84 [label="Enter block"]; - 85 [label="Access variable R|/x|"]; - 86 [label="Function call: R|/x|.#()"]; - 87 [label="Access variable R|/y|"]; - 88 [label="Function call: R|/y|.#()"]; - 89 [label="Exit block"]; - } - 90 [label="Exit when branch result"]; - 91 [label="Exit when"]; - } - 92 [label="Exit block"]; - } - 93 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 45 -> {47 46}; + 46 -> {55}; + 47 -> {48}; 48 -> {49}; 49 -> {50}; 50 -> {51}; @@ -230,14 +186,14 @@ digraph equalsAndIdentity_kt { 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {62 56}; + 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {70}; - 62 -> {63}; + 61 -> {63 62}; + 62 -> {71}; 63 -> {64}; 64 -> {65}; 65 -> {66}; @@ -248,208 +204,140 @@ digraph equalsAndIdentity_kt { 70 -> {71}; 71 -> {72}; 72 -> {73}; - 73 -> {74}; + + subgraph cluster_17 { + color=red + 74 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_18 { + color=blue + 75 [label="Enter block"]; + subgraph cluster_19 { + color=blue + 76 [label="Enter when"]; + subgraph cluster_20 { + color=blue + 77 [label="Enter when branch condition "]; + 78 [label="Access variable R|/y|"]; + 79 [label="Const: Null(null)"]; + 80 [label="Operator =="]; + 81 [label="Exit when branch condition"]; + } + 82 [label="Synthetic else branch"]; + 83 [label="Enter when branch result"]; + subgraph cluster_21 { + color=blue + 84 [label="Enter block"]; + 85 [label="Jump: ^test_3 Unit"]; + 86 [label="Stub" style="filled" fillcolor=gray]; + 87 [label="Exit block" style="filled" fillcolor=gray]; + } + 88 [label="Exit when branch result" style="filled" fillcolor=gray]; + 89 [label="Exit when"]; + } + subgraph cluster_22 { + color=blue + 90 [label="Enter when"]; + subgraph cluster_23 { + color=blue + 91 [label="Enter when branch condition "]; + 92 [label="Access variable R|/x|"]; + 93 [label="Access variable R|/y|"]; + 94 [label="Operator =="]; + 95 [label="Exit when branch condition"]; + } + 96 [label="Synthetic else branch"]; + 97 [label="Enter when branch result"]; + subgraph cluster_24 { + color=blue + 98 [label="Enter block"]; + 99 [label="Access variable R|/x|"]; + 100 [label="Function call: R|/x|.R|/A.foo|()"]; + 101 [label="Access variable R|/y|"]; + 102 [label="Function call: R|/y|.R|/A.foo|()"]; + 103 [label="Exit block"]; + } + 104 [label="Exit when branch result"]; + 105 [label="Exit when"]; + } + subgraph cluster_25 { + color=blue + 106 [label="Enter when"]; + subgraph cluster_26 { + color=blue + 107 [label="Enter when branch condition "]; + 108 [label="Access variable R|/x|"]; + 109 [label="Access variable R|/y|"]; + 110 [label="Operator ==="]; + 111 [label="Exit when branch condition"]; + } + 112 [label="Synthetic else branch"]; + 113 [label="Enter when branch result"]; + subgraph cluster_27 { + color=blue + 114 [label="Enter block"]; + 115 [label="Access variable R|/x|"]; + 116 [label="Function call: R|/x|.R|/A.foo|()"]; + 117 [label="Access variable R|/y|"]; + 118 [label="Function call: R|/y|.R|/A.foo|()"]; + 119 [label="Exit block"]; + } + 120 [label="Exit when branch result"]; + 121 [label="Exit when"]; + } + 122 [label="Exit block"]; + } + 123 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 74 -> {75}; 75 -> {76}; - 76 -> {83 77}; + 76 -> {77}; 77 -> {78}; 78 -> {79}; 79 -> {80}; 80 -> {81}; - 81 -> {82}; - 82 -> {91}; + 81 -> {83 82}; + 82 -> {89}; 83 -> {84}; 84 -> {85}; - 85 -> {86}; - 86 -> {87}; - 87 -> {88}; - 88 -> {89}; + 85 -> {123}; + 85 -> {86} [style=dotted]; + 86 -> {87} [style=dotted]; + 87 -> {88} [style=dotted]; + 88 -> {89} [style=dotted]; 89 -> {90}; 90 -> {91}; 91 -> {92}; 92 -> {93}; - - subgraph cluster_25 { - color=red - 94 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_26 { - color=blue - 95 [label="Enter block"]; - subgraph cluster_27 { - color=blue - 96 [label="Enter when"]; - subgraph cluster_28 { - color=blue - 97 [label="Enter when branch condition "]; - 98 [label="Access variable R|/y|"]; - 99 [label="Const: Null(null)"]; - 100 [label="Operator =="]; - 101 [label="Exit when branch condition"]; - } - subgraph cluster_29 { - color=blue - 102 [label="Enter when branch condition else"]; - 103 [label="Exit when branch condition"]; - } - 104 [label="Enter when branch result"]; - subgraph cluster_30 { - color=blue - 105 [label="Enter block"]; - 106 [label="Exit block"]; - } - 107 [label="Exit when branch result"]; - 108 [label="Enter when branch result"]; - subgraph cluster_31 { - color=blue - 109 [label="Enter block"]; - 110 [label="Jump: ^test_3 Unit"]; - 111 [label="Stub" style="filled" fillcolor=gray]; - 112 [label="Exit block" style="filled" fillcolor=gray]; - } - 113 [label="Exit when branch result" style="filled" fillcolor=gray]; - 114 [label="Exit when"]; - } - subgraph cluster_32 { - color=blue - 115 [label="Enter when"]; - subgraph cluster_33 { - color=blue - 116 [label="Enter when branch condition "]; - 117 [label="Access variable R|/x|"]; - 118 [label="Access variable R|/y|"]; - 119 [label="Operator =="]; - 120 [label="Exit when branch condition"]; - } - subgraph cluster_34 { - color=blue - 121 [label="Enter when branch condition else"]; - 122 [label="Exit when branch condition"]; - } - 123 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 124 [label="Enter block"]; - 125 [label="Exit block"]; - } - 126 [label="Exit when branch result"]; - 127 [label="Enter when branch result"]; - subgraph cluster_36 { - color=blue - 128 [label="Enter block"]; - 129 [label="Access variable R|/x|"]; - 130 [label="Function call: R|/x|.R|/A.foo|()"]; - 131 [label="Access variable R|/y|"]; - 132 [label="Function call: R|/y|.R|/A.foo|()"]; - 133 [label="Exit block"]; - } - 134 [label="Exit when branch result"]; - 135 [label="Exit when"]; - } - subgraph cluster_37 { - color=blue - 136 [label="Enter when"]; - subgraph cluster_38 { - color=blue - 137 [label="Enter when branch condition "]; - 138 [label="Access variable R|/x|"]; - 139 [label="Access variable R|/y|"]; - 140 [label="Operator ==="]; - 141 [label="Exit when branch condition"]; - } - subgraph cluster_39 { - color=blue - 142 [label="Enter when branch condition else"]; - 143 [label="Exit when branch condition"]; - } - 144 [label="Enter when branch result"]; - subgraph cluster_40 { - color=blue - 145 [label="Enter block"]; - 146 [label="Exit block"]; - } - 147 [label="Exit when branch result"]; - 148 [label="Enter when branch result"]; - subgraph cluster_41 { - color=blue - 149 [label="Enter block"]; - 150 [label="Access variable R|/x|"]; - 151 [label="Function call: R|/x|.R|/A.foo|()"]; - 152 [label="Access variable R|/y|"]; - 153 [label="Function call: R|/y|.R|/A.foo|()"]; - 154 [label="Exit block"]; - } - 155 [label="Exit when branch result"]; - 156 [label="Exit when"]; - } - 157 [label="Exit block"]; - } - 158 [label="Exit function test_3" style="filled" fillcolor=red]; - } - + 93 -> {94}; 94 -> {95}; - 95 -> {96}; - 96 -> {97}; + 95 -> {97 96}; + 96 -> {105}; 97 -> {98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; - 101 -> {108 102}; + 101 -> {102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; 106 -> {107}; - 107 -> {114}; + 107 -> {108}; 108 -> {109}; 109 -> {110}; - 110 -> {158}; - 110 -> {111} [style=dotted]; - 111 -> {112} [style=dotted]; - 112 -> {113} [style=dotted]; - 113 -> {114} [style=dotted]; + 110 -> {111}; + 111 -> {113 112}; + 112 -> {121}; + 113 -> {114}; 114 -> {115}; 115 -> {116}; 116 -> {117}; 117 -> {118}; 118 -> {119}; 119 -> {120}; - 120 -> {127 121}; + 120 -> {121}; 121 -> {122}; 122 -> {123}; - 123 -> {124}; - 124 -> {125}; - 125 -> {126}; - 126 -> {135}; - 127 -> {128}; - 128 -> {129}; - 129 -> {130}; - 130 -> {131}; - 131 -> {132}; - 132 -> {133}; - 133 -> {134}; - 134 -> {135}; - 135 -> {136}; - 136 -> {137}; - 137 -> {138}; - 138 -> {139}; - 139 -> {140}; - 140 -> {141}; - 141 -> {148 142}; - 142 -> {143}; - 143 -> {144}; - 144 -> {145}; - 145 -> {146}; - 146 -> {147}; - 147 -> {156}; - 148 -> {149}; - 149 -> {150}; - 150 -> {151}; - 151 -> {152}; - 152 -> {153}; - 153 -> {154}; - 154 -> {155}; - 155 -> {156}; - 156 -> {157}; - 157 -> {158}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.txt b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.txt index 5caef1b14c5..a14f253607c 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.txt @@ -9,8 +9,6 @@ FILE: equalsAndIdentity.kt R|/x|.R|/A.foo|() R|/y|.R|/A.foo|() } - else -> { - } } when () { @@ -18,8 +16,6 @@ FILE: equalsAndIdentity.kt R|/x|.R|/A.foo|() R|/y|.R|/A.foo|() } - else -> { - } } } @@ -29,8 +25,6 @@ FILE: equalsAndIdentity.kt R|/x|.#() R|/y|.#() } - else -> { - } } when () { @@ -38,8 +32,6 @@ FILE: equalsAndIdentity.kt R|/x|.#() R|/y|.#() } - else -> { - } } } @@ -48,8 +40,6 @@ FILE: equalsAndIdentity.kt ==(R|/y|, Null(null)) -> { ^test_3 Unit } - else -> { - } } when () { @@ -57,8 +47,6 @@ FILE: equalsAndIdentity.kt R|/x|.R|/A.foo|() R|/y|.R|/A.foo|() } - else -> { - } } when () { @@ -66,8 +54,6 @@ FILE: equalsAndIdentity.kt R|/x|.R|/A.foo|() R|/y|.R|/A.foo|() } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot b/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot index 1db858f3b2d..bf36304a0ed 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot @@ -51,29 +51,30 @@ digraph equalsToBoolean_kt { 16 [label="Enter when branch condition else"]; 17 [label="Exit when branch condition"]; } - 18 [label="Enter when branch result"]; + 18 [label="Synthetic else branch"]; + 19 [label="Enter when branch result"]; subgraph cluster_8 { color=blue - 19 [label="Enter block"]; - 20 [label="Access variable R|/b|"]; - 21 [label="Function call: R|/b|.#()"]; - 22 [label="Exit block"]; + 20 [label="Enter block"]; + 21 [label="Access variable R|/b|"]; + 22 [label="Function call: R|/b|.#()"]; + 23 [label="Exit block"]; } - 23 [label="Exit when branch result"]; - 24 [label="Enter when branch result"]; + 24 [label="Exit when branch result"]; + 25 [label="Enter when branch result"]; subgraph cluster_9 { color=blue - 25 [label="Enter block"]; - 26 [label="Access variable R|/b|"]; - 27 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 28 [label="Exit block"]; + 26 [label="Enter block"]; + 27 [label="Access variable R|/b|"]; + 28 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 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="Exit block"]; + 32 [label="Exit block"]; } - 32 [label="Exit function test_1" style="filled" fillcolor=red]; + 33 [label="Exit function test_1" style="filled" fillcolor=red]; } 6 -> {7}; @@ -85,16 +86,16 @@ digraph equalsToBoolean_kt { 12 -> {13}; 13 -> {14}; 14 -> {15}; - 15 -> {24 16}; + 15 -> {25 16}; 16 -> {17}; - 17 -> {18}; - 18 -> {19}; + 17 -> {19 18}; + 18 -> {31}; 19 -> {20}; 20 -> {21}; 21 -> {22}; 22 -> {23}; - 23 -> {30}; - 24 -> {25}; + 23 -> {24}; + 24 -> {31}; 25 -> {26}; 26 -> {27}; 27 -> {28}; @@ -102,57 +103,58 @@ digraph equalsToBoolean_kt { 29 -> {30}; 30 -> {31}; 31 -> {32}; + 32 -> {33}; 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="Enter block"]; subgraph cluster_12 { color=blue - 35 [label="Enter when"]; + 36 [label="Enter when"]; subgraph cluster_13 { color=blue - 36 [label="Enter when branch condition "]; - 37 [label="Access variable R|/b|"]; - 38 [label="Const: Boolean(true)"]; - 39 [label="Operator =="]; - 40 [label="Const: Boolean(true)"]; - 41 [label="Operator !="]; - 42 [label="Exit when branch condition"]; + 37 [label="Enter when branch condition "]; + 38 [label="Access variable R|/b|"]; + 39 [label="Const: Boolean(true)"]; + 40 [label="Operator =="]; + 41 [label="Const: Boolean(true)"]; + 42 [label="Operator !="]; + 43 [label="Exit when branch condition"]; } subgraph cluster_14 { color=blue - 43 [label="Enter when branch condition else"]; - 44 [label="Exit when branch condition"]; + 44 [label="Enter when branch condition else"]; + 45 [label="Exit when branch condition"]; } - 45 [label="Enter when branch result"]; + 46 [label="Synthetic else branch"]; + 47 [label="Enter when branch result"]; subgraph cluster_15 { color=blue - 46 [label="Enter block"]; - 47 [label="Access variable R|/b|"]; - 48 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 49 [label="Exit block"]; + 48 [label="Enter block"]; + 49 [label="Access variable R|/b|"]; + 50 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 51 [label="Exit block"]; } - 50 [label="Exit when branch result"]; - 51 [label="Enter when branch result"]; + 52 [label="Exit when branch result"]; + 53 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 52 [label="Enter block"]; - 53 [label="Access variable R|/b|"]; - 54 [label="Function call: R|/b|.#()"]; - 55 [label="Exit block"]; + 54 [label="Enter block"]; + 55 [label="Access variable R|/b|"]; + 56 [label="Function call: R|/b|.#()"]; + 57 [label="Exit block"]; } - 56 [label="Exit when branch result"]; - 57 [label="Exit when"]; + 58 [label="Exit when branch result"]; + 59 [label="Exit when"]; } - 58 [label="Exit block"]; + 60 [label="Exit block"]; } - 59 [label="Exit function test_2" style="filled" fillcolor=red]; + 61 [label="Exit function test_2" style="filled" fillcolor=red]; } - 33 -> {34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; @@ -161,75 +163,76 @@ digraph equalsToBoolean_kt { 39 -> {40}; 40 -> {41}; 41 -> {42}; - 42 -> {51 43}; - 43 -> {44}; + 42 -> {43}; + 43 -> {53 44}; 44 -> {45}; - 45 -> {46}; - 46 -> {47}; + 45 -> {47 46}; + 46 -> {59}; 47 -> {48}; 48 -> {49}; 49 -> {50}; - 50 -> {57}; + 50 -> {51}; 51 -> {52}; - 52 -> {53}; + 52 -> {59}; 53 -> {54}; 54 -> {55}; 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; + 59 -> {60}; + 60 -> {61}; subgraph cluster_17 { color=red - 60 [label="Enter function test_3" style="filled" fillcolor=red]; + 62 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_18 { color=blue - 61 [label="Enter block"]; + 63 [label="Enter block"]; subgraph cluster_19 { color=blue - 62 [label="Enter when"]; + 64 [label="Enter when"]; subgraph cluster_20 { color=blue - 63 [label="Enter when branch condition "]; - 64 [label="Access variable R|/b|"]; - 65 [label="Const: Boolean(true)"]; - 66 [label="Operator =="]; - 67 [label="Const: Boolean(false)"]; + 65 [label="Enter when branch condition "]; + 66 [label="Access variable R|/b|"]; + 67 [label="Const: Boolean(true)"]; 68 [label="Operator =="]; - 69 [label="Exit when branch condition"]; + 69 [label="Const: Boolean(false)"]; + 70 [label="Operator =="]; + 71 [label="Exit when branch condition"]; } subgraph cluster_21 { color=blue - 70 [label="Enter when branch condition else"]; - 71 [label="Exit when branch condition"]; + 72 [label="Enter when branch condition else"]; + 73 [label="Exit when branch condition"]; } - 72 [label="Enter when branch result"]; + 74 [label="Synthetic else branch"]; + 75 [label="Enter when branch result"]; subgraph cluster_22 { color=blue - 73 [label="Enter block"]; - 74 [label="Access variable R|/b|"]; - 75 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 76 [label="Exit block"]; + 76 [label="Enter block"]; + 77 [label="Access variable R|/b|"]; + 78 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 79 [label="Exit block"]; } - 77 [label="Exit when branch result"]; - 78 [label="Enter when branch result"]; + 80 [label="Exit when branch result"]; + 81 [label="Enter when branch result"]; subgraph cluster_23 { color=blue - 79 [label="Enter block"]; - 80 [label="Access variable R|/b|"]; - 81 [label="Function call: R|/b|.#()"]; - 82 [label="Exit block"]; + 82 [label="Enter block"]; + 83 [label="Access variable R|/b|"]; + 84 [label="Function call: R|/b|.#()"]; + 85 [label="Exit block"]; } - 83 [label="Exit when branch result"]; - 84 [label="Exit when"]; + 86 [label="Exit when branch result"]; + 87 [label="Exit when"]; } - 85 [label="Exit block"]; + 88 [label="Exit block"]; } - 86 [label="Exit function test_3" style="filled" fillcolor=red]; + 89 [label="Exit function test_3" style="filled" fillcolor=red]; } - 60 -> {61}; - 61 -> {62}; 62 -> {63}; 63 -> {64}; 64 -> {65}; @@ -237,402 +240,415 @@ digraph equalsToBoolean_kt { 66 -> {67}; 67 -> {68}; 68 -> {69}; - 69 -> {78 70}; + 69 -> {70}; 70 -> {71}; - 71 -> {72}; + 71 -> {81 72}; 72 -> {73}; - 73 -> {74}; - 74 -> {75}; + 73 -> {75 74}; + 74 -> {87}; 75 -> {76}; 76 -> {77}; - 77 -> {84}; + 77 -> {78}; 78 -> {79}; 79 -> {80}; - 80 -> {81}; + 80 -> {87}; 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; 85 -> {86}; + 86 -> {87}; + 87 -> {88}; + 88 -> {89}; subgraph cluster_24 { color=red - 87 [label="Enter function test_4" style="filled" fillcolor=red]; + 90 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_25 { color=blue - 88 [label="Enter block"]; + 91 [label="Enter block"]; subgraph cluster_26 { color=blue - 89 [label="Enter when"]; + 92 [label="Enter when"]; subgraph cluster_27 { color=blue - 90 [label="Enter when branch condition "]; - 91 [label="Access variable R|/b|"]; - 92 [label="Const: Boolean(true)"]; - 93 [label="Operator =="]; - 94 [label="Const: Boolean(false)"]; - 95 [label="Operator !="]; - 96 [label="Exit when branch condition"]; + 93 [label="Enter when branch condition "]; + 94 [label="Access variable R|/b|"]; + 95 [label="Const: Boolean(true)"]; + 96 [label="Operator =="]; + 97 [label="Const: Boolean(false)"]; + 98 [label="Operator !="]; + 99 [label="Exit when branch condition"]; } subgraph cluster_28 { color=blue - 97 [label="Enter when branch condition else"]; - 98 [label="Exit when branch condition"]; + 100 [label="Enter when branch condition else"]; + 101 [label="Exit when branch condition"]; } - 99 [label="Enter when branch result"]; + 102 [label="Synthetic else branch"]; + 103 [label="Enter when branch result"]; subgraph cluster_29 { color=blue - 100 [label="Enter block"]; - 101 [label="Access variable R|/b|"]; - 102 [label="Function call: R|/b|.#()"]; - 103 [label="Exit block"]; + 104 [label="Enter block"]; + 105 [label="Access variable R|/b|"]; + 106 [label="Function call: R|/b|.#()"]; + 107 [label="Exit block"]; } - 104 [label="Exit when branch result"]; - 105 [label="Enter when branch result"]; + 108 [label="Exit when branch result"]; + 109 [label="Enter when branch result"]; subgraph cluster_30 { color=blue - 106 [label="Enter block"]; - 107 [label="Access variable R|/b|"]; - 108 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 109 [label="Exit block"]; + 110 [label="Enter block"]; + 111 [label="Access variable R|/b|"]; + 112 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 113 [label="Exit block"]; } - 110 [label="Exit when branch result"]; - 111 [label="Exit when"]; + 114 [label="Exit when branch result"]; + 115 [label="Exit when"]; } - 112 [label="Exit block"]; + 116 [label="Exit block"]; } - 113 [label="Exit function test_4" style="filled" fillcolor=red]; + 117 [label="Exit function test_4" style="filled" fillcolor=red]; } - 87 -> {88}; - 88 -> {89}; - 89 -> {90}; 90 -> {91}; 91 -> {92}; 92 -> {93}; 93 -> {94}; 94 -> {95}; 95 -> {96}; - 96 -> {105 97}; + 96 -> {97}; 97 -> {98}; 98 -> {99}; - 99 -> {100}; + 99 -> {109 100}; 100 -> {101}; - 101 -> {102}; - 102 -> {103}; + 101 -> {103 102}; + 102 -> {115}; 103 -> {104}; - 104 -> {111}; + 104 -> {105}; 105 -> {106}; 106 -> {107}; 107 -> {108}; - 108 -> {109}; + 108 -> {115}; 109 -> {110}; 110 -> {111}; 111 -> {112}; 112 -> {113}; - - subgraph cluster_31 { - color=red - 114 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_32 { - color=blue - 115 [label="Enter block"]; - subgraph cluster_33 { - color=blue - 116 [label="Enter when"]; - subgraph cluster_34 { - color=blue - 117 [label="Enter when branch condition "]; - 118 [label="Access variable R|/b|"]; - 119 [label="Const: Boolean(true)"]; - 120 [label="Operator !="]; - 121 [label="Const: Boolean(true)"]; - 122 [label="Operator =="]; - 123 [label="Exit when branch condition"]; - } - subgraph cluster_35 { - color=blue - 124 [label="Enter when branch condition else"]; - 125 [label="Exit when branch condition"]; - } - 126 [label="Enter when branch result"]; - subgraph cluster_36 { - color=blue - 127 [label="Enter block"]; - 128 [label="Access variable R|/b|"]; - 129 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 130 [label="Exit block"]; - } - 131 [label="Exit when branch result"]; - 132 [label="Enter when branch result"]; - subgraph cluster_37 { - color=blue - 133 [label="Enter block"]; - 134 [label="Access variable R|/b|"]; - 135 [label="Function call: R|/b|.#()"]; - 136 [label="Exit block"]; - } - 137 [label="Exit when branch result"]; - 138 [label="Exit when"]; - } - 139 [label="Exit block"]; - } - 140 [label="Exit function test_5" style="filled" fillcolor=red]; - } - + 113 -> {114}; 114 -> {115}; 115 -> {116}; 116 -> {117}; - 117 -> {118}; + + subgraph cluster_31 { + color=red + 118 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_32 { + color=blue + 119 [label="Enter block"]; + subgraph cluster_33 { + color=blue + 120 [label="Enter when"]; + subgraph cluster_34 { + color=blue + 121 [label="Enter when branch condition "]; + 122 [label="Access variable R|/b|"]; + 123 [label="Const: Boolean(true)"]; + 124 [label="Operator !="]; + 125 [label="Const: Boolean(true)"]; + 126 [label="Operator =="]; + 127 [label="Exit when branch condition"]; + } + subgraph cluster_35 { + color=blue + 128 [label="Enter when branch condition else"]; + 129 [label="Exit when branch condition"]; + } + 130 [label="Synthetic else branch"]; + 131 [label="Enter when branch result"]; + subgraph cluster_36 { + color=blue + 132 [label="Enter block"]; + 133 [label="Access variable R|/b|"]; + 134 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 135 [label="Exit block"]; + } + 136 [label="Exit when branch result"]; + 137 [label="Enter when branch result"]; + subgraph cluster_37 { + color=blue + 138 [label="Enter block"]; + 139 [label="Access variable R|/b|"]; + 140 [label="Function call: R|/b|.#()"]; + 141 [label="Exit block"]; + } + 142 [label="Exit when branch result"]; + 143 [label="Exit when"]; + } + 144 [label="Exit block"]; + } + 145 [label="Exit function test_5" style="filled" fillcolor=red]; + } + 118 -> {119}; 119 -> {120}; 120 -> {121}; 121 -> {122}; 122 -> {123}; - 123 -> {132 124}; + 123 -> {124}; 124 -> {125}; 125 -> {126}; 126 -> {127}; - 127 -> {128}; + 127 -> {137 128}; 128 -> {129}; - 129 -> {130}; - 130 -> {131}; - 131 -> {138}; + 129 -> {131 130}; + 130 -> {143}; + 131 -> {132}; 132 -> {133}; 133 -> {134}; 134 -> {135}; 135 -> {136}; - 136 -> {137}; + 136 -> {143}; 137 -> {138}; 138 -> {139}; 139 -> {140}; - - subgraph cluster_38 { - color=red - 141 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_39 { - color=blue - 142 [label="Enter block"]; - subgraph cluster_40 { - color=blue - 143 [label="Enter when"]; - subgraph cluster_41 { - color=blue - 144 [label="Enter when branch condition "]; - 145 [label="Access variable R|/b|"]; - 146 [label="Const: Boolean(true)"]; - 147 [label="Operator !="]; - 148 [label="Const: Boolean(true)"]; - 149 [label="Operator !="]; - 150 [label="Exit when branch condition"]; - } - subgraph cluster_42 { - color=blue - 151 [label="Enter when branch condition else"]; - 152 [label="Exit when branch condition"]; - } - 153 [label="Enter when branch result"]; - subgraph cluster_43 { - color=blue - 154 [label="Enter block"]; - 155 [label="Access variable R|/b|"]; - 156 [label="Function call: R|/b|.#()"]; - 157 [label="Exit block"]; - } - 158 [label="Exit when branch result"]; - 159 [label="Enter when branch result"]; - subgraph cluster_44 { - color=blue - 160 [label="Enter block"]; - 161 [label="Access variable R|/b|"]; - 162 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 163 [label="Exit block"]; - } - 164 [label="Exit when branch result"]; - 165 [label="Exit when"]; - } - 166 [label="Exit block"]; - } - 167 [label="Exit function test_6" style="filled" fillcolor=red]; - } - + 140 -> {141}; 141 -> {142}; 142 -> {143}; 143 -> {144}; 144 -> {145}; - 145 -> {146}; + + subgraph cluster_38 { + color=red + 146 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_39 { + color=blue + 147 [label="Enter block"]; + subgraph cluster_40 { + color=blue + 148 [label="Enter when"]; + subgraph cluster_41 { + color=blue + 149 [label="Enter when branch condition "]; + 150 [label="Access variable R|/b|"]; + 151 [label="Const: Boolean(true)"]; + 152 [label="Operator !="]; + 153 [label="Const: Boolean(true)"]; + 154 [label="Operator !="]; + 155 [label="Exit when branch condition"]; + } + subgraph cluster_42 { + color=blue + 156 [label="Enter when branch condition else"]; + 157 [label="Exit when branch condition"]; + } + 158 [label="Synthetic else branch"]; + 159 [label="Enter when branch result"]; + subgraph cluster_43 { + color=blue + 160 [label="Enter block"]; + 161 [label="Access variable R|/b|"]; + 162 [label="Function call: R|/b|.#()"]; + 163 [label="Exit block"]; + } + 164 [label="Exit when branch result"]; + 165 [label="Enter when branch result"]; + subgraph cluster_44 { + color=blue + 166 [label="Enter block"]; + 167 [label="Access variable R|/b|"]; + 168 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 169 [label="Exit block"]; + } + 170 [label="Exit when branch result"]; + 171 [label="Exit when"]; + } + 172 [label="Exit block"]; + } + 173 [label="Exit function test_6" style="filled" fillcolor=red]; + } + 146 -> {147}; 147 -> {148}; 148 -> {149}; 149 -> {150}; - 150 -> {159 151}; + 150 -> {151}; 151 -> {152}; 152 -> {153}; 153 -> {154}; 154 -> {155}; - 155 -> {156}; + 155 -> {165 156}; 156 -> {157}; - 157 -> {158}; - 158 -> {165}; + 157 -> {159 158}; + 158 -> {171}; 159 -> {160}; 160 -> {161}; 161 -> {162}; 162 -> {163}; 163 -> {164}; - 164 -> {165}; + 164 -> {171}; 165 -> {166}; 166 -> {167}; - - subgraph cluster_45 { - color=red - 168 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_46 { - color=blue - 169 [label="Enter block"]; - subgraph cluster_47 { - color=blue - 170 [label="Enter when"]; - subgraph cluster_48 { - color=blue - 171 [label="Enter when branch condition "]; - 172 [label="Access variable R|/b|"]; - 173 [label="Const: Boolean(true)"]; - 174 [label="Operator !="]; - 175 [label="Const: Boolean(false)"]; - 176 [label="Operator =="]; - 177 [label="Exit when branch condition"]; - } - subgraph cluster_49 { - color=blue - 178 [label="Enter when branch condition else"]; - 179 [label="Exit when branch condition"]; - } - 180 [label="Enter when branch result"]; - subgraph cluster_50 { - color=blue - 181 [label="Enter block"]; - 182 [label="Access variable R|/b|"]; - 183 [label="Function call: R|/b|.#()"]; - 184 [label="Exit block"]; - } - 185 [label="Exit when branch result"]; - 186 [label="Enter when branch result"]; - subgraph cluster_51 { - color=blue - 187 [label="Enter block"]; - 188 [label="Access variable R|/b|"]; - 189 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 190 [label="Exit block"]; - } - 191 [label="Exit when branch result"]; - 192 [label="Exit when"]; - } - 193 [label="Exit block"]; - } - 194 [label="Exit function test_7" style="filled" fillcolor=red]; - } - + 167 -> {168}; 168 -> {169}; 169 -> {170}; 170 -> {171}; 171 -> {172}; 172 -> {173}; - 173 -> {174}; + + subgraph cluster_45 { + color=red + 174 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_46 { + color=blue + 175 [label="Enter block"]; + subgraph cluster_47 { + color=blue + 176 [label="Enter when"]; + subgraph cluster_48 { + color=blue + 177 [label="Enter when branch condition "]; + 178 [label="Access variable R|/b|"]; + 179 [label="Const: Boolean(true)"]; + 180 [label="Operator !="]; + 181 [label="Const: Boolean(false)"]; + 182 [label="Operator =="]; + 183 [label="Exit when branch condition"]; + } + subgraph cluster_49 { + color=blue + 184 [label="Enter when branch condition else"]; + 185 [label="Exit when branch condition"]; + } + 186 [label="Synthetic else branch"]; + 187 [label="Enter when branch result"]; + subgraph cluster_50 { + color=blue + 188 [label="Enter block"]; + 189 [label="Access variable R|/b|"]; + 190 [label="Function call: R|/b|.#()"]; + 191 [label="Exit block"]; + } + 192 [label="Exit when branch result"]; + 193 [label="Enter when branch result"]; + subgraph cluster_51 { + color=blue + 194 [label="Enter block"]; + 195 [label="Access variable R|/b|"]; + 196 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 197 [label="Exit block"]; + } + 198 [label="Exit when branch result"]; + 199 [label="Exit when"]; + } + 200 [label="Exit block"]; + } + 201 [label="Exit function test_7" style="filled" fillcolor=red]; + } + 174 -> {175}; 175 -> {176}; 176 -> {177}; - 177 -> {186 178}; + 177 -> {178}; 178 -> {179}; 179 -> {180}; 180 -> {181}; 181 -> {182}; 182 -> {183}; - 183 -> {184}; + 183 -> {193 184}; 184 -> {185}; - 185 -> {192}; - 186 -> {187}; + 185 -> {187 186}; + 186 -> {199}; 187 -> {188}; 188 -> {189}; 189 -> {190}; 190 -> {191}; 191 -> {192}; - 192 -> {193}; + 192 -> {199}; 193 -> {194}; - - subgraph cluster_52 { - color=red - 195 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_53 { - color=blue - 196 [label="Enter block"]; - subgraph cluster_54 { - color=blue - 197 [label="Enter when"]; - subgraph cluster_55 { - color=blue - 198 [label="Enter when branch condition "]; - 199 [label="Access variable R|/b|"]; - 200 [label="Const: Boolean(true)"]; - 201 [label="Operator !="]; - 202 [label="Const: Boolean(false)"]; - 203 [label="Operator !="]; - 204 [label="Exit when branch condition"]; - } - subgraph cluster_56 { - color=blue - 205 [label="Enter when branch condition else"]; - 206 [label="Exit when branch condition"]; - } - 207 [label="Enter when branch result"]; - subgraph cluster_57 { - color=blue - 208 [label="Enter block"]; - 209 [label="Access variable R|/b|"]; - 210 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; - 211 [label="Exit block"]; - } - 212 [label="Exit when branch result"]; - 213 [label="Enter when branch result"]; - subgraph cluster_58 { - color=blue - 214 [label="Enter block"]; - 215 [label="Access variable R|/b|"]; - 216 [label="Function call: R|/b|.#()"]; - 217 [label="Exit block"]; - } - 218 [label="Exit when branch result"]; - 219 [label="Exit when"]; - } - 220 [label="Exit block"]; - } - 221 [label="Exit function test_8" style="filled" fillcolor=red]; - } - + 194 -> {195}; 195 -> {196}; 196 -> {197}; 197 -> {198}; 198 -> {199}; 199 -> {200}; 200 -> {201}; - 201 -> {202}; + + subgraph cluster_52 { + color=red + 202 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_53 { + color=blue + 203 [label="Enter block"]; + subgraph cluster_54 { + color=blue + 204 [label="Enter when"]; + subgraph cluster_55 { + color=blue + 205 [label="Enter when branch condition "]; + 206 [label="Access variable R|/b|"]; + 207 [label="Const: Boolean(true)"]; + 208 [label="Operator !="]; + 209 [label="Const: Boolean(false)"]; + 210 [label="Operator !="]; + 211 [label="Exit when branch condition"]; + } + subgraph cluster_56 { + color=blue + 212 [label="Enter when branch condition else"]; + 213 [label="Exit when branch condition"]; + } + 214 [label="Synthetic else branch"]; + 215 [label="Enter when branch result"]; + subgraph cluster_57 { + color=blue + 216 [label="Enter block"]; + 217 [label="Access variable R|/b|"]; + 218 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 219 [label="Exit block"]; + } + 220 [label="Exit when branch result"]; + 221 [label="Enter when branch result"]; + subgraph cluster_58 { + color=blue + 222 [label="Enter block"]; + 223 [label="Access variable R|/b|"]; + 224 [label="Function call: R|/b|.#()"]; + 225 [label="Exit block"]; + } + 226 [label="Exit when branch result"]; + 227 [label="Exit when"]; + } + 228 [label="Exit block"]; + } + 229 [label="Exit function test_8" style="filled" fillcolor=red]; + } + 202 -> {203}; 203 -> {204}; - 204 -> {213 205}; + 204 -> {205}; 205 -> {206}; 206 -> {207}; 207 -> {208}; 208 -> {209}; 209 -> {210}; 210 -> {211}; - 211 -> {212}; - 212 -> {219}; - 213 -> {214}; - 214 -> {215}; + 211 -> {221 212}; + 212 -> {213}; + 213 -> {215 214}; + 214 -> {227}; 215 -> {216}; 216 -> {217}; 217 -> {218}; 218 -> {219}; 219 -> {220}; - 220 -> {221}; + 220 -> {227}; + 221 -> {222}; + 222 -> {223}; + 223 -> {224}; + 224 -> {225}; + 225 -> {226}; + 226 -> {227}; + 227 -> {228}; + 228 -> {229}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/implicitReceivers.dot b/compiler/fir/resolve/testData/resolve/smartcasts/implicitReceivers.dot index e58cf388020..73fb05a5b29 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/implicitReceivers.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/implicitReceivers.dot @@ -62,34 +62,35 @@ digraph implicitReceivers_kt { 17 [label="Enter when branch condition else"]; 18 [label="Exit when branch condition"]; } - 19 [label="Enter when branch result"]; + 19 [label="Synthetic else branch"]; + 20 [label="Enter when branch result"]; subgraph cluster_10 { color=blue - 20 [label="Enter block"]; - 21 [label="Access variable this@R|/test_1|"]; - 22 [label="Function call: this@R|/test_1|.#()"]; - 23 [label="Function call: #()"]; - 24 [label="Exit block"]; + 21 [label="Enter block"]; + 22 [label="Access variable this@R|/test_1|"]; + 23 [label="Function call: this@R|/test_1|.#()"]; + 24 [label="Function call: #()"]; + 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_11 { color=blue - 27 [label="Enter block"]; - 28 [label="Access variable this@R|/test_1|"]; - 29 [label="Function call: this@R|/test_1|.R|/A.foo|()"]; - 30 [label="Function call: this@R|/A|.R|/A.foo|()"]; - 31 [label="Exit block"]; + 28 [label="Enter block"]; + 29 [label="Access variable this@R|/test_1|"]; + 30 [label="Function call: this@R|/test_1|.R|/A.foo|()"]; + 31 [label="Function call: this@R|/A|.R|/A.foo|()"]; + 32 [label="Exit block"]; } - 32 [label="Exit when branch result"]; - 33 [label="Exit when"]; + 33 [label="Exit when branch result"]; + 34 [label="Exit when"]; } - 34 [label="Access variable this@R|/test_1|"]; - 35 [label="Function call: this@R|/test_1|.#()"]; - 36 [label="Function call: #()"]; - 37 [label="Exit block"]; + 35 [label="Access variable this@R|/test_1|"]; + 36 [label="Function call: this@R|/test_1|.#()"]; + 37 [label="Function call: #()"]; + 38 [label="Exit block"]; } - 38 [label="Exit function test_1" style="filled" fillcolor=red]; + 39 [label="Exit function test_1" style="filled" fillcolor=red]; } 10 -> {11}; @@ -98,17 +99,17 @@ digraph implicitReceivers_kt { 13 -> {14}; 14 -> {15}; 15 -> {16}; - 16 -> {26 17}; + 16 -> {27 17}; 17 -> {18}; - 18 -> {19}; - 19 -> {20}; + 18 -> {20 19}; + 19 -> {34}; 20 -> {21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; - 25 -> {33}; - 26 -> {27}; + 25 -> {26}; + 26 -> {34}; 27 -> {28}; 28 -> {29}; 29 -> {30}; @@ -120,76 +121,77 @@ digraph implicitReceivers_kt { 35 -> {36}; 36 -> {37}; 37 -> {38}; + 38 -> {39}; subgraph cluster_12 { color=red - 39 [label="Enter function test_2" style="filled" fillcolor=red]; + 40 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_13 { color=blue - 40 [label="Enter block"]; + 41 [label="Enter block"]; subgraph cluster_14 { color=blue - 41 [label="Enter when"]; + 42 [label="Enter when"]; subgraph cluster_15 { color=blue - 42 [label="Enter when branch condition "]; - 43 [label="Access variable this@R|/test_2|"]; - 44 [label="Type operator: this !is A"]; - 45 [label="Exit when branch condition"]; + 43 [label="Enter when branch condition "]; + 44 [label="Access variable this@R|/test_2|"]; + 45 [label="Type operator: this !is A"]; + 46 [label="Exit when branch condition"]; } subgraph cluster_16 { 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="Synthetic else branch"]; + 50 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 49 [label="Enter block"]; - 50 [label="Access variable this@R|/test_2|"]; - 51 [label="Function call: this@R|/test_2|.R|/A.foo|()"]; - 52 [label="Function call: this@R|/A|.R|/A.foo|()"]; - 53 [label="Exit block"]; + 51 [label="Enter block"]; + 52 [label="Access variable this@R|/test_2|"]; + 53 [label="Function call: this@R|/test_2|.R|/A.foo|()"]; + 54 [label="Function call: this@R|/A|.R|/A.foo|()"]; + 55 [label="Exit block"]; } - 54 [label="Exit when branch result"]; - 55 [label="Enter when branch result"]; + 56 [label="Exit when branch result"]; + 57 [label="Enter when branch result"]; subgraph cluster_18 { color=blue - 56 [label="Enter block"]; - 57 [label="Access variable this@R|/test_2|"]; - 58 [label="Function call: this@R|/test_2|.#()"]; - 59 [label="Function call: #()"]; - 60 [label="Exit block"]; + 58 [label="Enter block"]; + 59 [label="Access variable this@R|/test_2|"]; + 60 [label="Function call: this@R|/test_2|.#()"]; + 61 [label="Function call: #()"]; + 62 [label="Exit block"]; } - 61 [label="Exit when branch result"]; - 62 [label="Exit when"]; + 63 [label="Exit when branch result"]; + 64 [label="Exit when"]; } - 63 [label="Access variable this@R|/test_2|"]; - 64 [label="Function call: this@R|/test_2|.#()"]; - 65 [label="Function call: #()"]; - 66 [label="Exit block"]; + 65 [label="Access variable this@R|/test_2|"]; + 66 [label="Function call: this@R|/test_2|.#()"]; + 67 [label="Function call: #()"]; + 68 [label="Exit block"]; } - 67 [label="Exit function test_2" style="filled" fillcolor=red]; + 69 [label="Exit function test_2" style="filled" fillcolor=red]; } - 39 -> {40}; 40 -> {41}; 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; - 45 -> {55 46}; - 46 -> {47}; + 45 -> {46}; + 46 -> {57 47}; 47 -> {48}; - 48 -> {49}; - 49 -> {50}; + 48 -> {50 49}; + 49 -> {64}; 50 -> {51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; - 54 -> {62}; + 54 -> {55}; 55 -> {56}; - 56 -> {57}; + 56 -> {64}; 57 -> {58}; 58 -> {59}; 59 -> {60}; @@ -200,57 +202,59 @@ digraph implicitReceivers_kt { 64 -> {65}; 65 -> {66}; 66 -> {67}; + 67 -> {68}; + 68 -> {69}; subgraph cluster_19 { color=red - 68 [label="Enter function test_3" style="filled" fillcolor=red]; + 70 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_20 { color=blue - 69 [label="Enter block"]; - 70 [label="Access variable R|/a|"]; + 71 [label="Enter block"]; + 72 [label="Access variable R|/a|"]; subgraph cluster_21 { color=blue - 71 [label="Enter function anonymousFunction"]; + 73 [label="Enter function anonymousFunction"]; subgraph cluster_22 { color=blue - 72 [label="Enter block"]; - 73 [label="Access variable R|/b|"]; + 74 [label="Enter block"]; + 75 [label="Access variable R|/b|"]; subgraph cluster_23 { color=blue - 74 [label="Enter function anonymousFunction"]; + 76 [label="Enter function anonymousFunction"]; subgraph cluster_24 { color=blue - 75 [label="Enter block"]; - 76 [label="Access variable R|/c|"]; + 77 [label="Enter block"]; + 78 [label="Access variable R|/c|"]; subgraph cluster_25 { color=blue - 77 [label="Enter function anonymousFunction"]; + 79 [label="Enter function anonymousFunction"]; subgraph cluster_26 { color=blue - 78 [label="Enter block"]; - 79 [label="Access variable this@R|special/anonymous|"]; - 80 [label="Type operator: this@wb as A"]; + 80 [label="Enter block"]; 81 [label="Access variable this@R|special/anonymous|"]; - 82 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; - 83 [label="Function call: this@R|/A|.R|/A.foo|()"]; - 84 [label="Exit block"]; + 82 [label="Type operator: this@wb as A"]; + 83 [label="Access variable this@R|special/anonymous|"]; + 84 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; + 85 [label="Function call: this@R|/A|.R|/A.foo|()"]; + 86 [label="Exit block"]; } - 85 [label="Exit function anonymousFunction"]; + 87 [label="Exit function anonymousFunction"]; } - 86 [label="Function call: R|kotlin/with|(R|/c|, = wc@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { + 88 [label="Function call: R|kotlin/with|(R|/c|, = wc@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { (this@R|special/anonymous| as R|A|) this@R|special/anonymous|.R|/A.foo|() this@R|/A|.R|/A.foo|() } )"]; - 87 [label="Access variable this@R|special/anonymous|"]; - 88 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; - 89 [label="Function call: this@R|/A|.R|/A.foo|()"]; - 90 [label="Exit block"]; + 89 [label="Access variable this@R|special/anonymous|"]; + 90 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; + 91 [label="Function call: this@R|/A|.R|/A.foo|()"]; + 92 [label="Exit block"]; } - 91 [label="Exit function anonymousFunction"]; + 93 [label="Exit function anonymousFunction"]; } - 92 [label="Function call: R|kotlin/with|(R|/b|, = wb@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { + 94 [label="Function call: R|kotlin/with|(R|/b|, = wb@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { R|kotlin/with|(R|/c|, = wc@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { (this@R|special/anonymous| as R|A|) this@R|special/anonymous|.R|/A.foo|() @@ -261,11 +265,11 @@ digraph implicitReceivers_kt { this@R|/A|.R|/A.foo|() } )"]; - 93 [label="Exit block"]; + 95 [label="Exit block"]; } - 94 [label="Exit function anonymousFunction"]; + 96 [label="Exit function anonymousFunction"]; } - 95 [label="Function call: R|kotlin/with|(R|/a|, = wa@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { + 97 [label="Function call: R|kotlin/with|(R|/a|, = wa@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { R|kotlin/with|(R|/b|, = wb@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { R|kotlin/with|(R|/c|, = wc@fun R|kotlin/Any|.(it: R|kotlin/Any|): R|kotlin/Unit| { (this@R|special/anonymous| as R|A|) @@ -279,13 +283,11 @@ digraph implicitReceivers_kt { ) } )"]; - 96 [label="Exit block"]; + 98 [label="Exit block"]; } - 97 [label="Exit function test_3" style="filled" fillcolor=red]; + 99 [label="Exit function test_3" style="filled" fillcolor=red]; } - 68 -> {69}; - 69 -> {70}; 70 -> {71}; 71 -> {72}; 72 -> {73}; @@ -313,5 +315,7 @@ digraph implicitReceivers_kt { 94 -> {95}; 95 -> {96}; 96 -> {97}; + 97 -> {98}; + 98 -> {99}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot index 5a35e967c06..bcc605d58f0 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot @@ -52,46 +52,35 @@ digraph inPlaceLambdas_kt { 14 [label="Type operator: x is A"]; 15 [label="Exit when branch condition"]; } + 16 [label="Synthetic else branch"]; + 17 [label="Enter when branch result"]; subgraph cluster_8 { color=blue - 16 [label="Enter when branch condition else"]; - 17 [label="Exit when branch condition"]; - } - 18 [label="Enter when branch result"]; - subgraph cluster_9 { - color=blue - 19 [label="Enter block"]; - 20 [label="Exit block"]; - } - 21 [label="Exit when branch result"]; - 22 [label="Enter when branch result"]; - subgraph cluster_10 { - color=blue - 23 [label="Enter block"]; - subgraph cluster_11 { + 18 [label="Enter block"]; + subgraph cluster_9 { color=blue - 24 [label="Enter function anonymousFunction"]; - subgraph cluster_12 { + 19 [label="Enter function anonymousFunction"]; + subgraph cluster_10 { color=blue - 25 [label="Enter block"]; - 26 [label="Access variable R|/x|"]; - 27 [label="Function call: R|/x|.R|/A.foo|()"]; - 28 [label="Exit block"]; + 20 [label="Enter block"]; + 21 [label="Access variable R|/x|"]; + 22 [label="Function call: R|/x|.R|/A.foo|()"]; + 23 [label="Exit block"]; } - 29 [label="Exit function anonymousFunction"]; + 24 [label="Exit function anonymousFunction"]; } - 30 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + 25 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { R|/x|.R|/A.foo|() } )"]; - 31 [label="Exit block"]; + 26 [label="Exit block"]; } - 32 [label="Exit when branch result"]; - 33 [label="Exit when"]; + 27 [label="Exit when branch result"]; + 28 [label="Exit when"]; } - 34 [label="Exit block"]; + 29 [label="Exit block"]; } - 35 [label="Exit function test_1" style="filled" fillcolor=red]; + 30 [label="Exit function test_1" style="filled" fillcolor=red]; } 9 -> {10}; @@ -100,13 +89,13 @@ digraph inPlaceLambdas_kt { 12 -> {13}; 13 -> {14}; 14 -> {15}; - 15 -> {22 16}; - 16 -> {17}; + 15 -> {17 16}; + 16 -> {28}; 17 -> {18}; 18 -> {19}; 19 -> {20}; 20 -> {21}; - 21 -> {33}; + 21 -> {22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; @@ -115,41 +104,41 @@ digraph inPlaceLambdas_kt { 27 -> {28}; 28 -> {29}; 29 -> {30}; - 30 -> {31}; + + subgraph cluster_11 { + color=red + 31 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_12 { + color=blue + 32 [label="Enter block"]; + subgraph cluster_13 { + color=blue + 33 [label="Enter function anonymousFunction"]; + subgraph cluster_14 { + color=blue + 34 [label="Enter block"]; + 35 [label="Access variable R|/x|"]; + 36 [label="Type operator: x as B"]; + 37 [label="Exit block"]; + } + 38 [label="Exit function anonymousFunction"]; + } + 39 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + (R|/x| as R|B|) +} +)"]; + 40 [label="Access variable R|/x|"]; + 41 [label="Function call: R|/x|.R|/B.bar|()"]; + 42 [label="Exit block"]; + } + 43 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 31 -> {32}; 32 -> {33}; 33 -> {34}; 34 -> {35}; - - subgraph cluster_13 { - color=red - 36 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_14 { - color=blue - 37 [label="Enter block"]; - subgraph cluster_15 { - color=blue - 38 [label="Enter function anonymousFunction"]; - subgraph cluster_16 { - color=blue - 39 [label="Enter block"]; - 40 [label="Access variable R|/x|"]; - 41 [label="Type operator: x as B"]; - 42 [label="Exit block"]; - } - 43 [label="Exit function anonymousFunction"]; - } - 44 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { - (R|/x| as R|B|) -} -)"]; - 45 [label="Access variable R|/x|"]; - 46 [label="Function call: R|/x|.R|/B.bar|()"]; - 47 [label="Exit block"]; - } - 48 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 35 -> {36}; 36 -> {37}; 37 -> {38}; 38 -> {39}; @@ -157,88 +146,77 @@ digraph inPlaceLambdas_kt { 40 -> {41}; 41 -> {42}; 42 -> {43}; - 43 -> {44}; - 44 -> {45}; - 45 -> {46}; - 46 -> {47}; - 47 -> {48}; - subgraph cluster_17 { + subgraph cluster_15 { color=red - 49 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_18 { + 44 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_16 { color=blue - 50 [label="Enter block"]; - subgraph cluster_19 { + 45 [label="Enter block"]; + subgraph cluster_17 { color=blue - 51 [label="Enter when"]; - subgraph cluster_20 { + 46 [label="Enter when"]; + subgraph cluster_18 { color=blue - 52 [label="Enter when branch condition "]; - 53 [label="Access variable R|/x|"]; - 54 [label="Type operator: x is A"]; - 55 [label="Exit when branch condition"]; + 47 [label="Enter when branch condition "]; + 48 [label="Access variable R|/x|"]; + 49 [label="Type operator: x is A"]; + 50 [label="Exit when branch condition"]; } - subgraph cluster_21 { + 51 [label="Synthetic else branch"]; + 52 [label="Enter when branch result"]; + subgraph cluster_19 { color=blue - 56 [label="Enter when branch condition else"]; - 57 [label="Exit when branch condition"]; - } - 58 [label="Enter when branch result"]; - subgraph cluster_22 { - color=blue - 59 [label="Enter block"]; - 60 [label="Exit block"]; - } - 61 [label="Exit when branch result"]; - 62 [label="Enter when branch result"]; - subgraph cluster_23 { - color=blue - 63 [label="Enter block"]; - subgraph cluster_24 { + 53 [label="Enter block"]; + subgraph cluster_20 { color=blue - 64 [label="Enter function anonymousFunction"]; - subgraph cluster_25 { + 54 [label="Enter function anonymousFunction"]; + subgraph cluster_21 { color=blue - 65 [label="Enter block"]; - 66 [label="Access variable R|/x|"]; - 67 [label="Function call: R|/x|.R|/A.foo|()"]; - 68 [label="Access variable R|/x|"]; - 69 [label="Type operator: x as B"]; - 70 [label="Exit block"]; + 55 [label="Enter block"]; + 56 [label="Access variable R|/x|"]; + 57 [label="Function call: R|/x|.R|/A.foo|()"]; + 58 [label="Access variable R|/x|"]; + 59 [label="Type operator: x as B"]; + 60 [label="Exit block"]; } - 71 [label="Exit function anonymousFunction"]; + 61 [label="Exit function anonymousFunction"]; } - 72 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { + 62 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| { R|/x|.R|/A.foo|() (R|/x| as R|B|) } )"]; - 73 [label="Access variable R|/x|"]; - 74 [label="Function call: R|/x|.R|/B.bar|()"]; - 75 [label="Exit block"]; + 63 [label="Access variable R|/x|"]; + 64 [label="Function call: R|/x|.R|/B.bar|()"]; + 65 [label="Exit block"]; } - 76 [label="Exit when branch result"]; - 77 [label="Exit when"]; + 66 [label="Exit when branch result"]; + 67 [label="Exit when"]; } - 78 [label="Exit block"]; + 68 [label="Exit block"]; } - 79 [label="Exit function test_3" style="filled" fillcolor=red]; + 69 [label="Exit function test_3" style="filled" fillcolor=red]; } + 44 -> {45}; + 45 -> {46}; + 46 -> {47}; + 47 -> {48}; + 48 -> {49}; 49 -> {50}; - 50 -> {51}; - 51 -> {52}; + 50 -> {52 51}; + 51 -> {67}; 52 -> {53}; 53 -> {54}; 54 -> {55}; - 55 -> {62 56}; + 55 -> {56}; 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {77}; + 61 -> {62}; 62 -> {63}; 63 -> {64}; 64 -> {65}; @@ -246,15 +224,5 @@ digraph inPlaceLambdas_kt { 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 -> {79}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.txt b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.txt index 41cce5aee88..d8bb6ca1ad1 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.txt @@ -18,8 +18,6 @@ FILE: inPlaceLambdas.kt } ) } - else -> { - } } } @@ -40,8 +38,6 @@ FILE: inPlaceLambdas.kt ) R|/x|.R|/B.bar|() } - else -> { - } } } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot index f69e8015f95..cce140cb413 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot @@ -89,31 +89,32 @@ digraph nullability_kt { 24 [label="Enter when branch condition else"]; 25 [label="Exit when branch condition"]; } - 26 [label="Enter when branch result"]; + 26 [label="Synthetic else branch"]; + 27 [label="Enter when branch result"]; subgraph cluster_13 { color=blue - 27 [label="Enter block"]; - 28 [label="Access variable R|/x|"]; - 29 [label="Function call: R|/x|.#()"]; - 30 [label="Exit block"]; + 28 [label="Enter block"]; + 29 [label="Access variable R|/x|"]; + 30 [label="Function call: R|/x|.#()"]; + 31 [label="Exit block"]; } - 31 [label="Exit when branch result"]; - 32 [label="Enter when branch result"]; + 32 [label="Exit when branch result"]; + 33 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 33 [label="Enter block"]; - 34 [label="Access variable R|/x|"]; - 35 [label="Function call: R|/x|.R|/A.foo|()"]; - 36 [label="Exit block"]; + 34 [label="Enter block"]; + 35 [label="Access variable R|/x|"]; + 36 [label="Function call: R|/x|.R|/A.foo|()"]; + 37 [label="Exit block"]; } - 37 [label="Exit when branch result"]; - 38 [label="Exit when"]; + 38 [label="Exit when branch result"]; + 39 [label="Exit when"]; } - 39 [label="Access variable R|/x|"]; - 40 [label="Function call: R|/x|.#()"]; - 41 [label="Exit block"]; + 40 [label="Access variable R|/x|"]; + 41 [label="Function call: R|/x|.#()"]; + 42 [label="Exit block"]; } - 42 [label="Exit function test_1" style="filled" fillcolor=red]; + 43 [label="Exit function test_1" style="filled" fillcolor=red]; } 16 -> {17}; @@ -123,16 +124,16 @@ digraph nullability_kt { 20 -> {21}; 21 -> {22}; 22 -> {23}; - 23 -> {32 24}; + 23 -> {33 24}; 24 -> {25}; - 25 -> {26}; - 26 -> {27}; + 25 -> {27 26}; + 26 -> {39}; 27 -> {28}; 28 -> {29}; 29 -> {30}; 30 -> {31}; - 31 -> {38}; - 32 -> {33}; + 31 -> {32}; + 32 -> {39}; 33 -> {34}; 34 -> {35}; 35 -> {36}; @@ -142,74 +143,75 @@ digraph nullability_kt { 39 -> {40}; 40 -> {41}; 41 -> {42}; + 42 -> {43}; subgraph cluster_15 { color=red - 43 [label="Enter function test_2" style="filled" fillcolor=red]; + 44 [label="Enter function test_2" style="filled" fillcolor=red]; subgraph cluster_16 { color=blue - 44 [label="Enter block"]; + 45 [label="Enter block"]; subgraph cluster_17 { color=blue - 45 [label="Enter when"]; + 46 [label="Enter when"]; subgraph cluster_18 { color=blue - 46 [label="Enter when branch condition "]; - 47 [label="Access variable R|/x|"]; - 48 [label="Const: Null(null)"]; - 49 [label="Operator =="]; - 50 [label="Exit when branch condition"]; + 47 [label="Enter when branch condition "]; + 48 [label="Access variable R|/x|"]; + 49 [label="Const: Null(null)"]; + 50 [label="Operator =="]; + 51 [label="Exit when branch condition"]; } subgraph cluster_19 { color=blue - 51 [label="Enter when branch condition else"]; - 52 [label="Exit when branch condition"]; + 52 [label="Enter when branch condition else"]; + 53 [label="Exit when branch condition"]; } - 53 [label="Enter when branch result"]; + 54 [label="Synthetic else branch"]; + 55 [label="Enter when branch result"]; subgraph cluster_20 { color=blue - 54 [label="Enter block"]; - 55 [label="Access variable R|/x|"]; - 56 [label="Function call: R|/x|.R|/A.foo|()"]; - 57 [label="Exit block"]; + 56 [label="Enter block"]; + 57 [label="Access variable R|/x|"]; + 58 [label="Function call: R|/x|.R|/A.foo|()"]; + 59 [label="Exit block"]; } - 58 [label="Exit when branch result"]; - 59 [label="Enter when branch result"]; + 60 [label="Exit when branch result"]; + 61 [label="Enter when branch result"]; subgraph cluster_21 { color=blue - 60 [label="Enter block"]; - 61 [label="Access variable R|/x|"]; - 62 [label="Function call: R|/x|.#()"]; - 63 [label="Exit block"]; + 62 [label="Enter block"]; + 63 [label="Access variable R|/x|"]; + 64 [label="Function call: R|/x|.#()"]; + 65 [label="Exit block"]; } - 64 [label="Exit when branch result"]; - 65 [label="Exit when"]; + 66 [label="Exit when branch result"]; + 67 [label="Exit when"]; } - 66 [label="Access variable R|/x|"]; - 67 [label="Function call: R|/x|.#()"]; - 68 [label="Exit block"]; + 68 [label="Access variable R|/x|"]; + 69 [label="Function call: R|/x|.#()"]; + 70 [label="Exit block"]; } - 69 [label="Exit function test_2" style="filled" fillcolor=red]; + 71 [label="Exit function test_2" style="filled" fillcolor=red]; } - 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; 47 -> {48}; 48 -> {49}; 49 -> {50}; - 50 -> {59 51}; - 51 -> {52}; + 50 -> {51}; + 51 -> {61 52}; 52 -> {53}; - 53 -> {54}; - 54 -> {55}; + 53 -> {55 54}; + 54 -> {67}; 55 -> {56}; 56 -> {57}; 57 -> {58}; - 58 -> {65}; + 58 -> {59}; 59 -> {60}; - 60 -> {61}; + 60 -> {67}; 61 -> {62}; 62 -> {63}; 63 -> {64}; @@ -218,214 +220,192 @@ digraph nullability_kt { 66 -> {67}; 67 -> {68}; 68 -> {69}; + 69 -> {70}; + 70 -> {71}; subgraph cluster_22 { color=red - 70 [label="Enter function test_3" style="filled" fillcolor=red]; + 72 [label="Enter function test_3" style="filled" fillcolor=red]; subgraph cluster_23 { color=blue - 71 [label="Enter block"]; + 73 [label="Enter block"]; subgraph cluster_24 { color=blue - 72 [label="Enter when"]; - 73 [label="Access variable R|/x|"]; - 74 [label="Variable declaration: lval : R|A?|"]; + 74 [label="Enter when"]; + 75 [label="Access variable R|/x|"]; + 76 [label="Variable declaration: lval : R|A?|"]; subgraph cluster_25 { color=blue - 75 [label="Enter when branch condition "]; - 76 [label="Const: Null(null)"]; - 77 [label="Operator =="]; - 78 [label="Exit when branch condition"]; + 77 [label="Enter when branch condition "]; + 78 [label="Const: Null(null)"]; + 79 [label="Operator =="]; + 80 [label="Exit when branch condition"]; } subgraph cluster_26 { color=blue - 79 [label="Enter when branch condition else"]; - 80 [label="Exit when branch condition"]; + 81 [label="Enter when branch condition else"]; + 82 [label="Exit when branch condition"]; } - 81 [label="Enter when branch result"]; + 83 [label="Enter when branch result"]; subgraph cluster_27 { color=blue - 82 [label="Enter block"]; - 83 [label="Access variable R|/|"]; - 84 [label="Exit block"]; + 84 [label="Enter block"]; + 85 [label="Access variable R|/|"]; + 86 [label="Exit block"]; } - 85 [label="Exit when branch result"]; - 86 [label="Enter when branch result"]; + 87 [label="Exit when branch result"]; + 88 [label="Enter when branch result"]; subgraph cluster_28 { color=blue - 87 [label="Enter block"]; - 88 [label="Jump: ^test_3 Unit"]; - 89 [label="Stub" style="filled" fillcolor=gray]; - 90 [label="Exit block" style="filled" fillcolor=gray]; + 89 [label="Enter block"]; + 90 [label="Jump: ^test_3 Unit"]; + 91 [label="Stub" style="filled" fillcolor=gray]; + 92 [label="Exit block" style="filled" fillcolor=gray]; } - 91 [label="Exit when branch result" style="filled" fillcolor=gray]; - 92 [label="Exit when"]; + 93 [label="Exit when branch result" style="filled" fillcolor=gray]; + 94 [label="Exit when"]; } - 93 [label="Access variable R|/x|"]; - 94 [label="Function call: R|/x|.R|/A.foo|()"]; - 95 [label="Exit block"]; + 95 [label="Access variable R|/x|"]; + 96 [label="Function call: R|/x|.R|/A.foo|()"]; + 97 [label="Exit block"]; } - 96 [label="Exit function test_3" style="filled" fillcolor=red]; + 98 [label="Exit function test_3" style="filled" fillcolor=red]; } - 70 -> {71}; - 71 -> {72}; 72 -> {73}; 73 -> {74}; 74 -> {75}; 75 -> {76}; 76 -> {77}; 77 -> {78}; - 78 -> {86 79}; + 78 -> {79}; 79 -> {80}; - 80 -> {81}; + 80 -> {88 81}; 81 -> {82}; 82 -> {83}; 83 -> {84}; 84 -> {85}; - 85 -> {92}; + 85 -> {86}; 86 -> {87}; - 87 -> {88}; - 88 -> {96}; - 88 -> {89} [style=dotted]; - 89 -> {90} [style=dotted]; + 87 -> {94}; + 88 -> {89}; + 89 -> {90}; + 90 -> {98}; 90 -> {91} [style=dotted]; 91 -> {92} [style=dotted]; - 92 -> {93}; - 93 -> {94}; + 92 -> {93} [style=dotted]; + 93 -> {94} [style=dotted]; 94 -> {95}; 95 -> {96}; + 96 -> {97}; + 97 -> {98}; subgraph cluster_29 { color=red - 97 [label="Enter function test_4" style="filled" fillcolor=red]; + 99 [label="Enter function test_4" style="filled" fillcolor=red]; subgraph cluster_30 { color=blue - 98 [label="Enter block"]; + 100 [label="Enter block"]; subgraph cluster_31 { color=blue - 99 [label="Enter when"]; + 101 [label="Enter when"]; subgraph cluster_32 { color=blue - 100 [label="Enter when branch condition "]; - 101 [label="Access variable R|/x|"]; - 102 [label="Function call: R|/x|?.R|/A.getA|()"]; - 103 [label="Const: Null(null)"]; - 104 [label="Operator =="]; - 105 [label="Exit when branch condition"]; - } - subgraph cluster_33 { - color=blue - 106 [label="Enter when branch condition else"]; + 102 [label="Enter when branch condition "]; + 103 [label="Access variable R|/x|"]; + 104 [label="Function call: R|/x|?.R|/A.getA|()"]; + 105 [label="Const: Null(null)"]; + 106 [label="Operator =="]; 107 [label="Exit when branch condition"]; } - 108 [label="Enter when branch result"]; - subgraph cluster_34 { + 108 [label="Synthetic else branch"]; + 109 [label="Enter when branch result"]; + subgraph cluster_33 { color=blue - 109 [label="Enter block"]; - 110 [label="Exit block"]; + 110 [label="Enter block"]; + 111 [label="Jump: ^test_4 Unit"]; + 112 [label="Stub" style="filled" fillcolor=gray]; + 113 [label="Exit block" style="filled" fillcolor=gray]; } - 111 [label="Exit when branch result"]; - 112 [label="Enter when branch result"]; - subgraph cluster_35 { - color=blue - 113 [label="Enter block"]; - 114 [label="Jump: ^test_4 Unit"]; - 115 [label="Stub" style="filled" fillcolor=gray]; - 116 [label="Exit block" style="filled" fillcolor=gray]; - } - 117 [label="Exit when branch result" style="filled" fillcolor=gray]; - 118 [label="Exit when"]; + 114 [label="Exit when branch result" style="filled" fillcolor=gray]; + 115 [label="Exit when"]; } - 119 [label="Access variable R|/x|"]; - 120 [label="Function call: R|/x|.R|/A.foo|()"]; - 121 [label="Exit block"]; + 116 [label="Access variable R|/x|"]; + 117 [label="Function call: R|/x|.R|/A.foo|()"]; + 118 [label="Exit block"]; } - 122 [label="Exit function test_4" style="filled" fillcolor=red]; + 119 [label="Exit function test_4" style="filled" fillcolor=red]; } - 97 -> {98}; - 98 -> {99}; 99 -> {100}; 100 -> {101}; 101 -> {102}; 102 -> {103}; 103 -> {104}; 104 -> {105}; - 105 -> {112 106}; + 105 -> {106}; 106 -> {107}; - 107 -> {108}; - 108 -> {109}; + 107 -> {109 108}; + 108 -> {115}; 109 -> {110}; 110 -> {111}; - 111 -> {118}; - 112 -> {113}; - 113 -> {114}; - 114 -> {122}; + 111 -> {119}; + 111 -> {112} [style=dotted]; + 112 -> {113} [style=dotted]; + 113 -> {114} [style=dotted]; 114 -> {115} [style=dotted]; - 115 -> {116} [style=dotted]; - 116 -> {117} [style=dotted]; - 117 -> {118} [style=dotted]; + 115 -> {116}; + 116 -> {117}; + 117 -> {118}; 118 -> {119}; - 119 -> {120}; - 120 -> {121}; - 121 -> {122}; - subgraph cluster_36 { + subgraph cluster_34 { color=red - 123 [label="Enter function test_5" style="filled" fillcolor=red]; - subgraph cluster_37 { + 120 [label="Enter function test_5" style="filled" fillcolor=red]; + subgraph cluster_35 { color=blue - 124 [label="Enter block"]; - subgraph cluster_38 { + 121 [label="Enter block"]; + subgraph cluster_36 { color=blue - 125 [label="Enter when"]; - subgraph cluster_39 { + 122 [label="Enter when"]; + subgraph cluster_37 { color=blue - 126 [label="Enter when branch condition "]; - 127 [label="Access variable R|/q|"]; - 128 [label="Access variable R|/Q.data|"]; - 129 [label="Access variable R|/MyData.s|"]; - 130 [label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; - 131 [label="Const: Null(null)"]; - 132 [label="Operator !="]; - 133 [label="Exit when branch condition"]; + 123 [label="Enter when branch condition "]; + 124 [label="Access variable R|/q|"]; + 125 [label="Access variable R|/Q.data|"]; + 126 [label="Access variable R|/MyData.s|"]; + 127 [label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; + 128 [label="Const: Null(null)"]; + 129 [label="Operator !="]; + 130 [label="Exit when branch condition"]; } - subgraph cluster_40 { + 131 [label="Synthetic else branch"]; + 132 [label="Enter when branch result"]; + subgraph cluster_38 { color=blue - 134 [label="Enter when branch condition else"]; - 135 [label="Exit when branch condition"]; + 133 [label="Enter block"]; + 134 [label="Access variable R|/q|"]; + 135 [label="Access variable R|/Q.data|"]; + 136 [label="Access variable R|/q|"]; + 137 [label="Access variable R|/Q.data|"]; + 138 [label="Access variable R|/MyData.s|"]; + 139 [label="Access variable R|/q|"]; + 140 [label="Access variable R|/Q.data|"]; + 141 [label="Access variable R|/MyData.s|"]; + 142 [label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; + 143 [label="Exit block"]; } - 136 [label="Enter when branch result"]; - subgraph cluster_41 { - color=blue - 137 [label="Enter block"]; - 138 [label="Exit block"]; - } - 139 [label="Exit when branch result"]; - 140 [label="Enter when branch result"]; - subgraph cluster_42 { - color=blue - 141 [label="Enter block"]; - 142 [label="Access variable R|/q|"]; - 143 [label="Access variable R|/Q.data|"]; - 144 [label="Access variable R|/q|"]; - 145 [label="Access variable R|/Q.data|"]; - 146 [label="Access variable R|/MyData.s|"]; - 147 [label="Access variable R|/q|"]; - 148 [label="Access variable R|/Q.data|"]; - 149 [label="Access variable R|/MyData.s|"]; - 150 [label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; - 151 [label="Exit block"]; - } - 152 [label="Exit when branch result"]; - 153 [label="Exit when"]; + 144 [label="Exit when branch result"]; + 145 [label="Exit when"]; } - 154 [label="Exit block"]; + 146 [label="Exit block"]; } - 155 [label="Exit function test_5" style="filled" fillcolor=red]; + 147 [label="Exit function test_5" style="filled" fillcolor=red]; } + 120 -> {121}; + 121 -> {122}; + 122 -> {123}; 123 -> {124}; 124 -> {125}; 125 -> {126}; @@ -433,16 +413,16 @@ digraph nullability_kt { 127 -> {128}; 128 -> {129}; 129 -> {130}; - 130 -> {131}; - 131 -> {132}; + 130 -> {132 131}; + 131 -> {145}; 132 -> {133}; - 133 -> {140 134}; + 133 -> {134}; 134 -> {135}; 135 -> {136}; 136 -> {137}; 137 -> {138}; 138 -> {139}; - 139 -> {153}; + 139 -> {140}; 140 -> {141}; 141 -> {142}; 142 -> {143}; @@ -450,7 +430,66 @@ digraph nullability_kt { 144 -> {145}; 145 -> {146}; 146 -> {147}; - 147 -> {148}; + + subgraph cluster_39 { + color=red + 148 [label="Enter function test_6" style="filled" fillcolor=red]; + subgraph cluster_40 { + color=blue + 149 [label="Enter block"]; + subgraph cluster_41 { + color=blue + 150 [label="Enter when"]; + 151 [label="Access variable R|/q|"]; + 152 [label="Access variable R|/Q.data|"]; + 153 [label="Access variable R|/MyData.s|"]; + 154 [label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; + 155 [label="Variable declaration: lval : R|kotlin/Int?|"]; + subgraph cluster_42 { + color=blue + 156 [label="Enter when branch condition "]; + 157 [label="Const: Null(null)"]; + 158 [label="Operator =="]; + 159 [label="Exit when branch condition"]; + } + subgraph cluster_43 { + color=blue + 160 [label="Enter when branch condition else"]; + 161 [label="Exit when branch condition"]; + } + 162 [label="Enter when branch result"]; + subgraph cluster_44 { + color=blue + 163 [label="Enter block"]; + 164 [label="Access variable R|/|"]; + 165 [label="Exit block"]; + } + 166 [label="Exit when branch result"]; + 167 [label="Enter when branch result"]; + subgraph cluster_45 { + color=blue + 168 [label="Enter block"]; + 169 [label="Jump: ^test_6 Unit"]; + 170 [label="Stub" style="filled" fillcolor=gray]; + 171 [label="Exit block" style="filled" fillcolor=gray]; + } + 172 [label="Exit when branch result" style="filled" fillcolor=gray]; + 173 [label="Exit when"]; + } + 174 [label="Access variable R|/q|"]; + 175 [label="Access variable R|/Q.data|"]; + 176 [label="Access variable R|/q|"]; + 177 [label="Access variable R|/Q.data|"]; + 178 [label="Access variable R|/MyData.s|"]; + 179 [label="Access variable R|/q|"]; + 180 [label="Access variable R|/Q.data|"]; + 181 [label="Access variable R|/MyData.s|"]; + 182 [label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; + 183 [label="Exit block"]; + } + 184 [label="Exit function test_6" style="filled" fillcolor=red]; + } + 148 -> {149}; 149 -> {150}; 150 -> {151}; @@ -458,96 +497,81 @@ digraph nullability_kt { 152 -> {153}; 153 -> {154}; 154 -> {155}; - - subgraph cluster_43 { - color=red - 156 [label="Enter function test_6" style="filled" fillcolor=red]; - subgraph cluster_44 { - color=blue - 157 [label="Enter block"]; - subgraph cluster_45 { - color=blue - 158 [label="Enter when"]; - 159 [label="Access variable R|/q|"]; - 160 [label="Access variable R|/Q.data|"]; - 161 [label="Access variable R|/MyData.s|"]; - 162 [label="Function call: R|/q|?.R|/Q.data|?.R|/MyData.s|?.R|kotlin/Int.inc|()"]; - 163 [label="Variable declaration: lval : R|kotlin/Int?|"]; - subgraph cluster_46 { - color=blue - 164 [label="Enter when branch condition "]; - 165 [label="Const: Null(null)"]; - 166 [label="Operator =="]; - 167 [label="Exit when branch condition"]; - } - subgraph cluster_47 { - color=blue - 168 [label="Enter when branch condition else"]; - 169 [label="Exit when branch condition"]; - } - 170 [label="Enter when branch result"]; - subgraph cluster_48 { - color=blue - 171 [label="Enter block"]; - 172 [label="Access variable R|/|"]; - 173 [label="Exit block"]; - } - 174 [label="Exit when branch result"]; - 175 [label="Enter when branch result"]; - subgraph cluster_49 { - color=blue - 176 [label="Enter block"]; - 177 [label="Jump: ^test_6 Unit"]; - 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="Access variable R|/q|"]; - 183 [label="Access variable R|/Q.data|"]; - 184 [label="Access variable R|/q|"]; - 185 [label="Access variable R|/Q.data|"]; - 186 [label="Access variable R|/MyData.s|"]; - 187 [label="Access variable R|/q|"]; - 188 [label="Access variable R|/Q.data|"]; - 189 [label="Access variable R|/MyData.s|"]; - 190 [label="Function call: R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|()"]; - 191 [label="Exit block"]; - } - 192 [label="Exit function test_6" style="filled" fillcolor=red]; - } - + 155 -> {156}; 156 -> {157}; 157 -> {158}; 158 -> {159}; - 159 -> {160}; + 159 -> {167 160}; 160 -> {161}; 161 -> {162}; 162 -> {163}; 163 -> {164}; 164 -> {165}; 165 -> {166}; - 166 -> {167}; - 167 -> {175 168}; + 166 -> {173}; + 167 -> {168}; 168 -> {169}; - 169 -> {170}; - 170 -> {171}; - 171 -> {172}; - 172 -> {173}; + 169 -> {184}; + 169 -> {170} [style=dotted]; + 170 -> {171} [style=dotted]; + 171 -> {172} [style=dotted]; + 172 -> {173} [style=dotted]; 173 -> {174}; - 174 -> {181}; + 174 -> {175}; 175 -> {176}; 176 -> {177}; - 177 -> {192}; - 177 -> {178} [style=dotted]; - 178 -> {179} [style=dotted]; - 179 -> {180} [style=dotted]; - 180 -> {181} [style=dotted]; + 177 -> {178}; + 178 -> {179}; + 179 -> {180}; + 180 -> {181}; 181 -> {182}; 182 -> {183}; 183 -> {184}; - 184 -> {185}; + + subgraph cluster_46 { + color=red + 185 [label="Enter function test_7" style="filled" fillcolor=red]; + subgraph cluster_47 { + color=blue + 186 [label="Enter block"]; + subgraph cluster_48 { + color=blue + 187 [label="Enter when"]; + subgraph cluster_49 { + color=blue + 188 [label="Enter when branch condition "]; + 189 [label="Access variable R|/q|"]; + 190 [label="Function call: R|/q|?.R|/Q.fdata|()"]; + 191 [label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()"]; + 192 [label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()?.R|kotlin/Int.inc|()"]; + 193 [label="Const: Null(null)"]; + 194 [label="Operator !="]; + 195 [label="Exit when branch condition"]; + } + 196 [label="Synthetic else branch"]; + 197 [label="Enter when branch result"]; + subgraph cluster_50 { + color=blue + 198 [label="Enter block"]; + 199 [label="Access variable R|/q|"]; + 200 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 201 [label="Access variable R|/q|"]; + 202 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 203 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 204 [label="Access variable R|/q|"]; + 205 [label="Function call: R|/q|.R|/Q.fdata|()"]; + 206 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 207 [label="Function call: R|/q|.R|/Q.fdata|().#().#()"]; + 208 [label="Exit block"]; + } + 209 [label="Exit when branch result"]; + 210 [label="Exit when"]; + } + 211 [label="Exit block"]; + } + 212 [label="Exit function test_7" style="filled" fillcolor=red]; + } + 185 -> {186}; 186 -> {187}; 187 -> {188}; @@ -555,82 +579,61 @@ digraph nullability_kt { 189 -> {190}; 190 -> {191}; 191 -> {192}; - - subgraph cluster_50 { - color=red - 193 [label="Enter function test_7" style="filled" fillcolor=red]; - subgraph cluster_51 { - color=blue - 194 [label="Enter block"]; - subgraph cluster_52 { - color=blue - 195 [label="Enter when"]; - subgraph cluster_53 { - color=blue - 196 [label="Enter when branch condition "]; - 197 [label="Access variable R|/q|"]; - 198 [label="Function call: R|/q|?.R|/Q.fdata|()"]; - 199 [label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()"]; - 200 [label="Function call: R|/q|?.R|/Q.fdata|()?.R|/MyData.fs|()?.R|kotlin/Int.inc|()"]; - 201 [label="Const: Null(null)"]; - 202 [label="Operator !="]; - 203 [label="Exit when branch condition"]; - } - subgraph cluster_54 { - color=blue - 204 [label="Enter when branch condition else"]; - 205 [label="Exit when branch condition"]; - } - 206 [label="Enter when branch result"]; - subgraph cluster_55 { - color=blue - 207 [label="Enter block"]; - 208 [label="Exit block"]; - } - 209 [label="Exit when branch result"]; - 210 [label="Enter when branch result"]; - subgraph cluster_56 { - color=blue - 211 [label="Enter block"]; - 212 [label="Access variable R|/q|"]; - 213 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 214 [label="Access variable R|/q|"]; - 215 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 216 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; - 217 [label="Access variable R|/q|"]; - 218 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 219 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; - 220 [label="Function call: R|/q|.R|/Q.fdata|().#().#()"]; - 221 [label="Exit block"]; - } - 222 [label="Exit when branch result"]; - 223 [label="Exit when"]; - } - 224 [label="Exit block"]; - } - 225 [label="Exit function test_7" style="filled" fillcolor=red]; - } - + 192 -> {193}; 193 -> {194}; 194 -> {195}; - 195 -> {196}; - 196 -> {197}; + 195 -> {197 196}; + 196 -> {210}; 197 -> {198}; 198 -> {199}; 199 -> {200}; 200 -> {201}; 201 -> {202}; 202 -> {203}; - 203 -> {210 204}; + 203 -> {204}; 204 -> {205}; 205 -> {206}; 206 -> {207}; 207 -> {208}; 208 -> {209}; - 209 -> {223}; + 209 -> {210}; 210 -> {211}; 211 -> {212}; - 212 -> {213}; + + subgraph cluster_51 { + color=red + 213 [label="Enter function test_8" style="filled" fillcolor=red]; + subgraph cluster_52 { + color=blue + 214 [label="Enter block"]; + subgraph cluster_53 { + color=blue + 215 [label="Enter when"]; + subgraph cluster_54 { + color=blue + 216 [label="Enter when branch condition "]; + 217 [label="Access variable R|/b|"]; + 218 [label="Const: Boolean(true)"]; + 219 [label="Operator =="]; + 220 [label="Exit when branch condition"]; + } + 221 [label="Synthetic else branch"]; + 222 [label="Enter when branch result"]; + subgraph cluster_55 { + color=blue + 223 [label="Enter block"]; + 224 [label="Access variable R|/b|"]; + 225 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 226 [label="Exit block"]; + } + 227 [label="Exit when branch result"]; + 228 [label="Exit when"]; + } + 229 [label="Exit block"]; + } + 230 [label="Exit function test_8" style="filled" fillcolor=red]; + } + 213 -> {214}; 214 -> {215}; 215 -> {216}; @@ -638,70 +641,136 @@ digraph nullability_kt { 217 -> {218}; 218 -> {219}; 219 -> {220}; - 220 -> {221}; - 221 -> {222}; + 220 -> {222 221}; + 221 -> {228}; 222 -> {223}; 223 -> {224}; 224 -> {225}; + 225 -> {226}; + 226 -> {227}; + 227 -> {228}; + 228 -> {229}; + 229 -> {230}; - subgraph cluster_57 { + subgraph cluster_56 { color=red - 226 [label="Enter function test_8" style="filled" fillcolor=red]; - subgraph cluster_58 { + 231 [label="Enter function test_9" style="filled" fillcolor=red]; + subgraph cluster_57 { color=blue - 227 [label="Enter block"]; - subgraph cluster_59 { + 232 [label="Enter block"]; + subgraph cluster_58 { color=blue - 228 [label="Enter when"]; - subgraph cluster_60 { + 233 [label="Enter when"]; + subgraph cluster_59 { color=blue - 229 [label="Enter when branch condition "]; - 230 [label="Access variable R|/b|"]; - 231 [label="Const: Boolean(true)"]; - 232 [label="Operator =="]; - 233 [label="Exit when branch condition"]; + 234 [label="Enter when branch condition "]; + 235 [label="Access variable R|/a|"]; + 236 [label="Access variable R|/b|"]; + 237 [label="Operator =="]; + 238 [label="Exit when branch condition"]; } - subgraph cluster_61 { - color=blue - 234 [label="Enter when branch condition else"]; - 235 [label="Exit when branch condition"]; - } - 236 [label="Enter when branch result"]; - subgraph cluster_62 { - color=blue - 237 [label="Enter block"]; - 238 [label="Exit block"]; - } - 239 [label="Exit when branch result"]; + 239 [label="Synthetic else branch"]; 240 [label="Enter when branch result"]; - subgraph cluster_63 { + subgraph cluster_60 { color=blue 241 [label="Enter block"]; 242 [label="Access variable R|/b|"]; - 243 [label="Function call: R|/b|.R|kotlin/Boolean.not|()"]; + 243 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; 244 [label="Exit block"]; } 245 [label="Exit when branch result"]; 246 [label="Exit when"]; } - 247 [label="Exit block"]; + 247 [label="Access variable R|/b|"]; + 248 [label="Function call: R|/b|.#()"]; + subgraph cluster_61 { + color=blue + 249 [label="Enter when"]; + subgraph cluster_62 { + color=blue + 250 [label="Enter when branch condition "]; + 251 [label="Access variable R|/a|"]; + 252 [label="Access variable R|/b|"]; + 253 [label="Operator ==="]; + 254 [label="Exit when branch condition"]; + } + 255 [label="Synthetic else branch"]; + 256 [label="Enter when branch result"]; + subgraph cluster_63 { + color=blue + 257 [label="Enter block"]; + 258 [label="Access variable R|/b|"]; + 259 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 260 [label="Exit block"]; + } + 261 [label="Exit when branch result"]; + 262 [label="Exit when"]; + } + 263 [label="Access variable R|/b|"]; + 264 [label="Function call: R|/b|.#()"]; + subgraph cluster_64 { + color=blue + 265 [label="Enter when"]; + subgraph cluster_65 { + color=blue + 266 [label="Enter when branch condition "]; + 267 [label="Access variable R|/b|"]; + 268 [label="Access variable R|/a|"]; + 269 [label="Operator =="]; + 270 [label="Exit when branch condition"]; + } + 271 [label="Synthetic else branch"]; + 272 [label="Enter when branch result"]; + subgraph cluster_66 { + color=blue + 273 [label="Enter block"]; + 274 [label="Access variable R|/b|"]; + 275 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 276 [label="Exit block"]; + } + 277 [label="Exit when branch result"]; + 278 [label="Exit when"]; + } + 279 [label="Access variable R|/b|"]; + 280 [label="Function call: R|/b|.#()"]; + subgraph cluster_67 { + color=blue + 281 [label="Enter when"]; + subgraph cluster_68 { + color=blue + 282 [label="Enter when branch condition "]; + 283 [label="Access variable R|/b|"]; + 284 [label="Access variable R|/a|"]; + 285 [label="Operator ==="]; + 286 [label="Exit when branch condition"]; + } + 287 [label="Synthetic else branch"]; + 288 [label="Enter when branch result"]; + subgraph cluster_69 { + color=blue + 289 [label="Enter block"]; + 290 [label="Access variable R|/b|"]; + 291 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; + 292 [label="Exit block"]; + } + 293 [label="Exit when branch result"]; + 294 [label="Exit when"]; + } + 295 [label="Access variable R|/b|"]; + 296 [label="Function call: R|/b|.#()"]; + 297 [label="Exit block"]; } - 248 [label="Exit function test_8" style="filled" fillcolor=red]; + 298 [label="Exit function test_9" style="filled" fillcolor=red]; } - 226 -> {227}; - 227 -> {228}; - 228 -> {229}; - 229 -> {230}; - 230 -> {231}; 231 -> {232}; 232 -> {233}; - 233 -> {240 234}; + 233 -> {234}; 234 -> {235}; 235 -> {236}; 236 -> {237}; 237 -> {238}; - 238 -> {239}; + 238 -> {240 239}; 239 -> {246}; 240 -> {241}; 241 -> {242}; @@ -711,176 +780,21 @@ digraph nullability_kt { 245 -> {246}; 246 -> {247}; 247 -> {248}; - - subgraph cluster_64 { - color=red - 249 [label="Enter function test_9" style="filled" fillcolor=red]; - subgraph cluster_65 { - color=blue - 250 [label="Enter block"]; - subgraph cluster_66 { - color=blue - 251 [label="Enter when"]; - subgraph cluster_67 { - color=blue - 252 [label="Enter when branch condition "]; - 253 [label="Access variable R|/a|"]; - 254 [label="Access variable R|/b|"]; - 255 [label="Operator =="]; - 256 [label="Exit when branch condition"]; - } - subgraph cluster_68 { - color=blue - 257 [label="Enter when branch condition else"]; - 258 [label="Exit when branch condition"]; - } - 259 [label="Enter when branch result"]; - subgraph cluster_69 { - color=blue - 260 [label="Enter block"]; - 261 [label="Exit block"]; - } - 262 [label="Exit when branch result"]; - 263 [label="Enter when branch result"]; - subgraph cluster_70 { - color=blue - 264 [label="Enter block"]; - 265 [label="Access variable R|/b|"]; - 266 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 267 [label="Exit block"]; - } - 268 [label="Exit when branch result"]; - 269 [label="Exit when"]; - } - 270 [label="Access variable R|/b|"]; - 271 [label="Function call: R|/b|.#()"]; - subgraph cluster_71 { - color=blue - 272 [label="Enter when"]; - subgraph cluster_72 { - color=blue - 273 [label="Enter when branch condition "]; - 274 [label="Access variable R|/a|"]; - 275 [label="Access variable R|/b|"]; - 276 [label="Operator ==="]; - 277 [label="Exit when branch condition"]; - } - subgraph cluster_73 { - color=blue - 278 [label="Enter when branch condition else"]; - 279 [label="Exit when branch condition"]; - } - 280 [label="Enter when branch result"]; - subgraph cluster_74 { - color=blue - 281 [label="Enter block"]; - 282 [label="Exit block"]; - } - 283 [label="Exit when branch result"]; - 284 [label="Enter when branch result"]; - subgraph cluster_75 { - color=blue - 285 [label="Enter block"]; - 286 [label="Access variable R|/b|"]; - 287 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 288 [label="Exit block"]; - } - 289 [label="Exit when branch result"]; - 290 [label="Exit when"]; - } - 291 [label="Access variable R|/b|"]; - 292 [label="Function call: R|/b|.#()"]; - subgraph cluster_76 { - color=blue - 293 [label="Enter when"]; - subgraph cluster_77 { - color=blue - 294 [label="Enter when branch condition "]; - 295 [label="Access variable R|/b|"]; - 296 [label="Access variable R|/a|"]; - 297 [label="Operator =="]; - 298 [label="Exit when branch condition"]; - } - subgraph cluster_78 { - color=blue - 299 [label="Enter when branch condition else"]; - 300 [label="Exit when branch condition"]; - } - 301 [label="Enter when branch result"]; - subgraph cluster_79 { - color=blue - 302 [label="Enter block"]; - 303 [label="Exit block"]; - } - 304 [label="Exit when branch result"]; - 305 [label="Enter when branch result"]; - subgraph cluster_80 { - color=blue - 306 [label="Enter block"]; - 307 [label="Access variable R|/b|"]; - 308 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 309 [label="Exit block"]; - } - 310 [label="Exit when branch result"]; - 311 [label="Exit when"]; - } - 312 [label="Access variable R|/b|"]; - 313 [label="Function call: R|/b|.#()"]; - subgraph cluster_81 { - color=blue - 314 [label="Enter when"]; - subgraph cluster_82 { - color=blue - 315 [label="Enter when branch condition "]; - 316 [label="Access variable R|/b|"]; - 317 [label="Access variable R|/a|"]; - 318 [label="Operator ==="]; - 319 [label="Exit when branch condition"]; - } - subgraph cluster_83 { - color=blue - 320 [label="Enter when branch condition else"]; - 321 [label="Exit when branch condition"]; - } - 322 [label="Enter when branch result"]; - subgraph cluster_84 { - color=blue - 323 [label="Enter block"]; - 324 [label="Exit block"]; - } - 325 [label="Exit when branch result"]; - 326 [label="Enter when branch result"]; - subgraph cluster_85 { - color=blue - 327 [label="Enter block"]; - 328 [label="Access variable R|/b|"]; - 329 [label="Function call: R|/b|.R|kotlin/Int.inc|()"]; - 330 [label="Exit block"]; - } - 331 [label="Exit when branch result"]; - 332 [label="Exit when"]; - } - 333 [label="Access variable R|/b|"]; - 334 [label="Function call: R|/b|.#()"]; - 335 [label="Exit block"]; - } - 336 [label="Exit function test_9" style="filled" fillcolor=red]; - } - + 248 -> {249}; 249 -> {250}; 250 -> {251}; 251 -> {252}; 252 -> {253}; 253 -> {254}; - 254 -> {255}; - 255 -> {256}; - 256 -> {263 257}; + 254 -> {256 255}; + 255 -> {262}; + 256 -> {257}; 257 -> {258}; 258 -> {259}; 259 -> {260}; 260 -> {261}; 261 -> {262}; - 262 -> {269}; + 262 -> {263}; 263 -> {264}; 264 -> {265}; 265 -> {266}; @@ -888,24 +802,24 @@ digraph nullability_kt { 267 -> {268}; 268 -> {269}; 269 -> {270}; - 270 -> {271}; - 271 -> {272}; + 270 -> {272 271}; + 271 -> {278}; 272 -> {273}; 273 -> {274}; 274 -> {275}; 275 -> {276}; 276 -> {277}; - 277 -> {284 278}; + 277 -> {278}; 278 -> {279}; 279 -> {280}; 280 -> {281}; 281 -> {282}; 282 -> {283}; - 283 -> {290}; + 283 -> {284}; 284 -> {285}; 285 -> {286}; - 286 -> {287}; - 287 -> {288}; + 286 -> {288 287}; + 287 -> {294}; 288 -> {289}; 289 -> {290}; 290 -> {291}; @@ -916,16 +830,127 @@ digraph nullability_kt { 295 -> {296}; 296 -> {297}; 297 -> {298}; - 298 -> {305 299}; + + subgraph cluster_70 { + color=red + 299 [label="Enter function test_10" style="filled" fillcolor=red]; + subgraph cluster_71 { + color=blue + 300 [label="Enter block"]; + subgraph cluster_72 { + color=blue + 301 [label="Enter when"]; + subgraph cluster_73 { + color=blue + 302 [label="Enter when branch condition "]; + 303 [label="Access variable R|/a|"]; + 304 [label="Access variable R|/b|"]; + 305 [label="Operator =="]; + 306 [label="Exit when branch condition"]; + } + 307 [label="Synthetic else branch"]; + 308 [label="Enter when branch result"]; + subgraph cluster_74 { + color=blue + 309 [label="Enter block"]; + 310 [label="Access variable R|/b|"]; + 311 [label="Function call: R|/b|.#()"]; + 312 [label="Exit block"]; + } + 313 [label="Exit when branch result"]; + 314 [label="Exit when"]; + } + 315 [label="Access variable R|/b|"]; + 316 [label="Function call: R|/b|.#()"]; + subgraph cluster_75 { + color=blue + 317 [label="Enter when"]; + subgraph cluster_76 { + color=blue + 318 [label="Enter when branch condition "]; + 319 [label="Access variable R|/a|"]; + 320 [label="Access variable R|/b|"]; + 321 [label="Operator ==="]; + 322 [label="Exit when branch condition"]; + } + 323 [label="Synthetic else branch"]; + 324 [label="Enter when branch result"]; + subgraph cluster_77 { + color=blue + 325 [label="Enter block"]; + 326 [label="Access variable R|/b|"]; + 327 [label="Function call: R|/b|.#()"]; + 328 [label="Exit block"]; + } + 329 [label="Exit when branch result"]; + 330 [label="Exit when"]; + } + 331 [label="Access variable R|/b|"]; + 332 [label="Function call: R|/b|.#()"]; + subgraph cluster_78 { + color=blue + 333 [label="Enter when"]; + subgraph cluster_79 { + color=blue + 334 [label="Enter when branch condition "]; + 335 [label="Access variable R|/b|"]; + 336 [label="Access variable R|/a|"]; + 337 [label="Operator =="]; + 338 [label="Exit when branch condition"]; + } + 339 [label="Synthetic else branch"]; + 340 [label="Enter when branch result"]; + subgraph cluster_80 { + color=blue + 341 [label="Enter block"]; + 342 [label="Access variable R|/b|"]; + 343 [label="Function call: R|/b|.#()"]; + 344 [label="Exit block"]; + } + 345 [label="Exit when branch result"]; + 346 [label="Exit when"]; + } + 347 [label="Access variable R|/b|"]; + 348 [label="Function call: R|/b|.#()"]; + subgraph cluster_81 { + color=blue + 349 [label="Enter when"]; + subgraph cluster_82 { + color=blue + 350 [label="Enter when branch condition "]; + 351 [label="Access variable R|/b|"]; + 352 [label="Access variable R|/a|"]; + 353 [label="Operator ==="]; + 354 [label="Exit when branch condition"]; + } + 355 [label="Synthetic else branch"]; + 356 [label="Enter when branch result"]; + subgraph cluster_83 { + color=blue + 357 [label="Enter block"]; + 358 [label="Access variable R|/b|"]; + 359 [label="Function call: R|/b|.#()"]; + 360 [label="Exit block"]; + } + 361 [label="Exit when branch result"]; + 362 [label="Exit when"]; + } + 363 [label="Access variable R|/b|"]; + 364 [label="Function call: R|/b|.#()"]; + 365 [label="Exit block"]; + } + 366 [label="Exit function test_10" style="filled" fillcolor=red]; + } + 299 -> {300}; 300 -> {301}; 301 -> {302}; 302 -> {303}; 303 -> {304}; - 304 -> {311}; + 304 -> {305}; 305 -> {306}; - 306 -> {307}; - 307 -> {308}; + 306 -> {308 307}; + 307 -> {314}; 308 -> {309}; 309 -> {310}; 310 -> {311}; @@ -937,13 +962,13 @@ digraph nullability_kt { 316 -> {317}; 317 -> {318}; 318 -> {319}; - 319 -> {326 320}; + 319 -> {320}; 320 -> {321}; 321 -> {322}; - 322 -> {323}; - 323 -> {324}; + 322 -> {324 323}; + 323 -> {330}; 324 -> {325}; - 325 -> {332}; + 325 -> {326}; 326 -> {327}; 327 -> {328}; 328 -> {329}; @@ -954,181 +979,26 @@ digraph nullability_kt { 333 -> {334}; 334 -> {335}; 335 -> {336}; - - subgraph cluster_86 { - color=red - 337 [label="Enter function test_10" style="filled" fillcolor=red]; - subgraph cluster_87 { - color=blue - 338 [label="Enter block"]; - subgraph cluster_88 { - color=blue - 339 [label="Enter when"]; - subgraph cluster_89 { - color=blue - 340 [label="Enter when branch condition "]; - 341 [label="Access variable R|/a|"]; - 342 [label="Access variable R|/b|"]; - 343 [label="Operator =="]; - 344 [label="Exit when branch condition"]; - } - subgraph cluster_90 { - color=blue - 345 [label="Enter when branch condition else"]; - 346 [label="Exit when branch condition"]; - } - 347 [label="Enter when branch result"]; - subgraph cluster_91 { - color=blue - 348 [label="Enter block"]; - 349 [label="Exit block"]; - } - 350 [label="Exit when branch result"]; - 351 [label="Enter when branch result"]; - subgraph cluster_92 { - color=blue - 352 [label="Enter block"]; - 353 [label="Access variable R|/b|"]; - 354 [label="Function call: R|/b|.#()"]; - 355 [label="Exit block"]; - } - 356 [label="Exit when branch result"]; - 357 [label="Exit when"]; - } - 358 [label="Access variable R|/b|"]; - 359 [label="Function call: R|/b|.#()"]; - subgraph cluster_93 { - color=blue - 360 [label="Enter when"]; - subgraph cluster_94 { - color=blue - 361 [label="Enter when branch condition "]; - 362 [label="Access variable R|/a|"]; - 363 [label="Access variable R|/b|"]; - 364 [label="Operator ==="]; - 365 [label="Exit when branch condition"]; - } - subgraph cluster_95 { - color=blue - 366 [label="Enter when branch condition else"]; - 367 [label="Exit when branch condition"]; - } - 368 [label="Enter when branch result"]; - subgraph cluster_96 { - color=blue - 369 [label="Enter block"]; - 370 [label="Exit block"]; - } - 371 [label="Exit when branch result"]; - 372 [label="Enter when branch result"]; - subgraph cluster_97 { - color=blue - 373 [label="Enter block"]; - 374 [label="Access variable R|/b|"]; - 375 [label="Function call: R|/b|.#()"]; - 376 [label="Exit block"]; - } - 377 [label="Exit when branch result"]; - 378 [label="Exit when"]; - } - 379 [label="Access variable R|/b|"]; - 380 [label="Function call: R|/b|.#()"]; - subgraph cluster_98 { - color=blue - 381 [label="Enter when"]; - subgraph cluster_99 { - color=blue - 382 [label="Enter when branch condition "]; - 383 [label="Access variable R|/b|"]; - 384 [label="Access variable R|/a|"]; - 385 [label="Operator =="]; - 386 [label="Exit when branch condition"]; - } - subgraph cluster_100 { - color=blue - 387 [label="Enter when branch condition else"]; - 388 [label="Exit when branch condition"]; - } - 389 [label="Enter when branch result"]; - subgraph cluster_101 { - color=blue - 390 [label="Enter block"]; - 391 [label="Exit block"]; - } - 392 [label="Exit when branch result"]; - 393 [label="Enter when branch result"]; - subgraph cluster_102 { - color=blue - 394 [label="Enter block"]; - 395 [label="Access variable R|/b|"]; - 396 [label="Function call: R|/b|.#()"]; - 397 [label="Exit block"]; - } - 398 [label="Exit when branch result"]; - 399 [label="Exit when"]; - } - 400 [label="Access variable R|/b|"]; - 401 [label="Function call: R|/b|.#()"]; - subgraph cluster_103 { - color=blue - 402 [label="Enter when"]; - subgraph cluster_104 { - color=blue - 403 [label="Enter when branch condition "]; - 404 [label="Access variable R|/b|"]; - 405 [label="Access variable R|/a|"]; - 406 [label="Operator ==="]; - 407 [label="Exit when branch condition"]; - } - subgraph cluster_105 { - color=blue - 408 [label="Enter when branch condition else"]; - 409 [label="Exit when branch condition"]; - } - 410 [label="Enter when branch result"]; - subgraph cluster_106 { - color=blue - 411 [label="Enter block"]; - 412 [label="Exit block"]; - } - 413 [label="Exit when branch result"]; - 414 [label="Enter when branch result"]; - subgraph cluster_107 { - color=blue - 415 [label="Enter block"]; - 416 [label="Access variable R|/b|"]; - 417 [label="Function call: R|/b|.#()"]; - 418 [label="Exit block"]; - } - 419 [label="Exit when branch result"]; - 420 [label="Exit when"]; - } - 421 [label="Access variable R|/b|"]; - 422 [label="Function call: R|/b|.#()"]; - 423 [label="Exit block"]; - } - 424 [label="Exit function test_10" style="filled" fillcolor=red]; - } - + 336 -> {337}; 337 -> {338}; - 338 -> {339}; - 339 -> {340}; + 338 -> {340 339}; + 339 -> {346}; 340 -> {341}; 341 -> {342}; 342 -> {343}; 343 -> {344}; - 344 -> {351 345}; + 344 -> {345}; 345 -> {346}; 346 -> {347}; 347 -> {348}; 348 -> {349}; 349 -> {350}; - 350 -> {357}; + 350 -> {351}; 351 -> {352}; 352 -> {353}; 353 -> {354}; - 354 -> {355}; - 355 -> {356}; + 354 -> {356 355}; + 355 -> {362}; 356 -> {357}; 357 -> {358}; 358 -> {359}; @@ -1138,64 +1008,6 @@ digraph nullability_kt { 362 -> {363}; 363 -> {364}; 364 -> {365}; - 365 -> {372 366}; - 366 -> {367}; - 367 -> {368}; - 368 -> {369}; - 369 -> {370}; - 370 -> {371}; - 371 -> {378}; - 372 -> {373}; - 373 -> {374}; - 374 -> {375}; - 375 -> {376}; - 376 -> {377}; - 377 -> {378}; - 378 -> {379}; - 379 -> {380}; - 380 -> {381}; - 381 -> {382}; - 382 -> {383}; - 383 -> {384}; - 384 -> {385}; - 385 -> {386}; - 386 -> {393 387}; - 387 -> {388}; - 388 -> {389}; - 389 -> {390}; - 390 -> {391}; - 391 -> {392}; - 392 -> {399}; - 393 -> {394}; - 394 -> {395}; - 395 -> {396}; - 396 -> {397}; - 397 -> {398}; - 398 -> {399}; - 399 -> {400}; - 400 -> {401}; - 401 -> {402}; - 402 -> {403}; - 403 -> {404}; - 404 -> {405}; - 405 -> {406}; - 406 -> {407}; - 407 -> {414 408}; - 408 -> {409}; - 409 -> {410}; - 410 -> {411}; - 411 -> {412}; - 412 -> {413}; - 413 -> {420}; - 414 -> {415}; - 415 -> {416}; - 416 -> {417}; - 417 -> {418}; - 418 -> {419}; - 419 -> {420}; - 420 -> {421}; - 421 -> {422}; - 422 -> {423}; - 423 -> {424}; + 365 -> {366}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.txt b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.txt index 7cc49f9067d..cc7d9d49818 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.txt @@ -60,8 +60,6 @@ FILE: nullability.kt ==(R|/x|?.R|/A.getA|(), Null(null)) -> { ^test_4 Unit } - else -> { - } } R|/x|.R|/A.foo|() @@ -73,8 +71,6 @@ FILE: nullability.kt R|/q|.R|/Q.data|.R|/MyData.s| R|/q|.R|/Q.data|.R|/MyData.s|.R|kotlin/Int.inc|() } - else -> { - } } } @@ -99,8 +95,6 @@ FILE: nullability.kt R|/q|.R|/Q.fdata|().#() R|/q|.R|/Q.fdata|().#().#() } - else -> { - } } } @@ -109,8 +103,6 @@ FILE: nullability.kt ==(R|/b|, Boolean(true)) -> { R|/b|.R|kotlin/Boolean.not|() } - else -> { - } } } @@ -119,8 +111,6 @@ FILE: nullability.kt ==(R|/a|, R|/b|) -> { R|/b|.R|kotlin/Int.inc|() } - else -> { - } } R|/b|.#() @@ -128,8 +118,6 @@ FILE: nullability.kt ===(R|/a|, R|/b|) -> { R|/b|.R|kotlin/Int.inc|() } - else -> { - } } R|/b|.#() @@ -137,8 +125,6 @@ FILE: nullability.kt ==(R|/b|, R|/a|) -> { R|/b|.R|kotlin/Int.inc|() } - else -> { - } } R|/b|.#() @@ -146,8 +132,6 @@ FILE: nullability.kt ===(R|/b|, R|/a|) -> { R|/b|.R|kotlin/Int.inc|() } - else -> { - } } R|/b|.#() @@ -157,8 +141,6 @@ FILE: nullability.kt ==(R|/a|, R|/b|) -> { R|/b|.#() } - else -> { - } } R|/b|.#() @@ -166,8 +148,6 @@ FILE: nullability.kt ===(R|/a|, R|/b|) -> { R|/b|.#() } - else -> { - } } R|/b|.#() @@ -175,8 +155,6 @@ FILE: nullability.kt ==(R|/b|, R|/a|) -> { R|/b|.#() } - else -> { - } } R|/b|.#() @@ -184,8 +162,6 @@ FILE: nullability.kt ===(R|/b|, R|/a|) -> { R|/b|.#() } - else -> { - } } R|/b|.#() diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot b/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot index 42c736f6a09..d8bb76b63ac 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot @@ -304,47 +304,36 @@ digraph returns_kt { 105 [label="Type operator: x is C"]; 106 [label="Exit when branch condition"]; } + 107 [label="Synthetic else branch"]; + 108 [label="Enter when branch result"]; subgraph cluster_31 { color=blue - 107 [label="Enter when branch condition else"]; - 108 [label="Exit when branch condition"]; + 109 [label="Enter block"]; + 110 [label="Access variable R|/x|"]; + 111 [label="Function call: R|/x|.R|/C.baz|()"]; + 112 [label="Exit block"]; } - 109 [label="Enter when branch result"]; + 113 [label="Exit when branch result"]; + 114 [label="Enter when branch result"]; subgraph cluster_32 { color=blue - 110 [label="Enter block"]; - 111 [label="Exit block"]; + 115 [label="Enter block"]; + 116 [label="Access variable R|/x|"]; + 117 [label="Function call: R|/x|.R|/B.bar|()"]; + 118 [label="Exit block"]; } - 112 [label="Exit when branch result"]; - 113 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 114 [label="Enter block"]; - 115 [label="Access variable R|/x|"]; - 116 [label="Function call: R|/x|.R|/C.baz|()"]; - 117 [label="Exit block"]; - } - 118 [label="Exit when branch result"]; - 119 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 120 [label="Enter block"]; - 121 [label="Access variable R|/x|"]; - 122 [label="Function call: R|/x|.R|/B.bar|()"]; - 123 [label="Exit block"]; - } - 124 [label="Exit when branch result"]; - 125 [label="Exit when"]; + 119 [label="Exit when branch result"]; + 120 [label="Exit when"]; } - 126 [label="Access variable R|/x|"]; - 127 [label="Function call: R|/x|.#()"]; - 128 [label="Access variable R|/x|"]; - 129 [label="Function call: R|/x|.#()"]; - 130 [label="Access variable R|/x|"]; - 131 [label="Function call: R|/x|.#()"]; - 132 [label="Exit block"]; + 121 [label="Access variable R|/x|"]; + 122 [label="Function call: R|/x|.#()"]; + 123 [label="Access variable R|/x|"]; + 124 [label="Function call: R|/x|.#()"]; + 125 [label="Access variable R|/x|"]; + 126 [label="Function call: R|/x|.#()"]; + 127 [label="Exit block"]; } - 133 [label="Exit function test_3" style="filled" fillcolor=red]; + 128 [label="Exit function test_3" style="filled" fillcolor=red]; } 96 -> {97}; @@ -353,23 +342,23 @@ digraph returns_kt { 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {119 103}; + 102 -> {114 103}; 103 -> {104}; 104 -> {105}; 105 -> {106}; - 106 -> {113 107}; - 107 -> {108}; + 106 -> {108 107}; + 107 -> {120}; 108 -> {109}; 109 -> {110}; 110 -> {111}; 111 -> {112}; - 112 -> {125}; - 113 -> {114}; + 112 -> {113}; + 113 -> {120}; 114 -> {115}; 115 -> {116}; 116 -> {117}; 117 -> {118}; - 118 -> {125}; + 118 -> {119}; 119 -> {120}; 120 -> {121}; 121 -> {122}; @@ -379,10 +368,5 @@ digraph returns_kt { 125 -> {126}; 126 -> {127}; 127 -> {128}; - 128 -> {129}; - 129 -> {130}; - 130 -> {131}; - 131 -> {132}; - 132 -> {133}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/returns.txt b/compiler/fir/resolve/testData/resolve/smartcasts/returns.txt index 970097b299b..1a7d51ef421 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/returns.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/returns.txt @@ -59,8 +59,6 @@ FILE: returns.kt (R|/x| is R|C|) -> { R|/x|.R|/C.baz|() } - else -> { - } } R|/x|.#() diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot index 37bea432166..fe595816f6b 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot @@ -19,34 +19,23 @@ digraph simpleIf_kt { 5 [label="Type operator: x is String"]; 6 [label="Exit when branch condition"]; } + 7 [label="Synthetic else branch"]; + 8 [label="Enter when branch result"]; subgraph cluster_4 { color=blue - 7 [label="Enter when branch condition else"]; - 8 [label="Exit when branch condition"]; + 9 [label="Enter block"]; + 10 [label="Access variable R|/x|"]; + 11 [label="Access variable R|kotlin/String.length|"]; + 12 [label="Exit block"]; } - 9 [label="Enter when branch result"]; - subgraph cluster_5 { - color=blue - 10 [label="Enter block"]; - 11 [label="Exit block"]; - } - 12 [label="Exit when branch result"]; - 13 [label="Enter when branch result"]; - subgraph cluster_6 { - color=blue - 14 [label="Enter block"]; - 15 [label="Access variable R|/x|"]; - 16 [label="Access variable R|kotlin/String.length|"]; - 17 [label="Exit block"]; - } - 18 [label="Exit when branch result"]; - 19 [label="Exit when"]; + 13 [label="Exit when branch result"]; + 14 [label="Exit when"]; } - 20 [label="Access variable R|/x|"]; - 21 [label="Access variable #"]; - 22 [label="Exit block"]; + 15 [label="Access variable R|/x|"]; + 16 [label="Access variable #"]; + 17 [label="Exit block"]; } - 23 [label="Exit function test_1" style="filled" fillcolor=red]; + 18 [label="Exit function test_1" style="filled" fillcolor=red]; } 0 -> {1}; @@ -55,188 +44,167 @@ digraph simpleIf_kt { 3 -> {4}; 4 -> {5}; 5 -> {6}; - 6 -> {13 7}; - 7 -> {8}; + 6 -> {8 7}; + 7 -> {14}; 8 -> {9}; 9 -> {10}; 10 -> {11}; 11 -> {12}; - 12 -> {19}; + 12 -> {13}; 13 -> {14}; 14 -> {15}; 15 -> {16}; 16 -> {17}; 17 -> {18}; - 18 -> {19}; + + subgraph cluster_5 { + color=red + 19 [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: x is String"]; + 23 [label="Variable declaration: lval b: R|kotlin/Boolean|"]; + subgraph cluster_7 { + color=blue + 24 [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"]; + } + 28 [label="Synthetic else branch"]; + 29 [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"]; + } + 34 [label="Exit when branch result"]; + 35 [label="Exit when"]; + } + 36 [label="Access variable R|/x|"]; + 37 [label="Access variable #"]; + 38 [label="Exit block"]; + } + 39 [label="Exit function test_2" style="filled" fillcolor=red]; + } + 19 -> {20}; 20 -> {21}; 21 -> {22}; 22 -> {23}; - - subgraph cluster_7 { - color=red - 24 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_8 { - color=blue - 25 [label="Enter block"]; - 26 [label="Access variable R|/x|"]; - 27 [label="Type operator: x is String"]; - 28 [label="Variable declaration: lval b: R|kotlin/Boolean|"]; - subgraph cluster_9 { - color=blue - 29 [label="Enter when"]; - subgraph cluster_10 { - color=blue - 30 [label="Enter when branch condition "]; - 31 [label="Access variable R|/b|"]; - 32 [label="Exit when branch condition"]; - } - subgraph cluster_11 { - color=blue - 33 [label="Enter when branch condition else"]; - 34 [label="Exit when branch condition"]; - } - 35 [label="Enter when branch result"]; - subgraph cluster_12 { - color=blue - 36 [label="Enter block"]; - 37 [label="Exit block"]; - } - 38 [label="Exit when branch result"]; - 39 [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"]; - } - 44 [label="Exit when branch result"]; - 45 [label="Exit when"]; - } - 46 [label="Access variable R|/x|"]; - 47 [label="Access variable #"]; - 48 [label="Exit block"]; - } - 49 [label="Exit function test_2" style="filled" fillcolor=red]; - } - + 23 -> {24}; 24 -> {25}; 25 -> {26}; 26 -> {27}; - 27 -> {28}; - 28 -> {29}; + 27 -> {29 28}; + 28 -> {35}; 29 -> {30}; 30 -> {31}; 31 -> {32}; - 32 -> {39 33}; + 32 -> {33}; 33 -> {34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; 37 -> {38}; - 38 -> {45}; - 39 -> {40}; + 38 -> {39}; + + subgraph cluster_10 { + color=red + 40 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_11 { + color=blue + 41 [label="Enter block"]; + subgraph cluster_12 { + color=blue + 42 [label="Enter when"]; + subgraph cluster_13 { + color=blue + 43 [label="Enter when branch condition "]; + 44 [label="Access variable R|/x|"]; + 45 [label="Type operator: x !is String"]; + 46 [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: x !is Int"]; + 50 [label="Exit when branch condition"]; + } + subgraph cluster_15 { + color=blue + 51 [label="Enter when branch condition else"]; + 52 [label="Exit when branch condition"]; + } + 53 [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"]; + } + 60 [label="Exit when branch result"]; + 61 [label="Enter when branch result"]; + subgraph cluster_17 { + color=blue + 62 [label="Enter block"]; + 63 [label="Exit block"]; + } + 64 [label="Exit when branch result"]; + 65 [label="Enter when branch result"]; + subgraph cluster_18 { + color=blue + 66 [label="Enter block"]; + 67 [label="Exit block"]; + } + 68 [label="Exit when branch result"]; + 69 [label="Exit when"]; + } + 70 [label="Exit block"]; + } + 71 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 40 -> {41}; 41 -> {42}; 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; - 46 -> {47}; + 46 -> {65 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"]; - subgraph cluster_16 { - color=blue - 52 [label="Enter when"]; - subgraph cluster_17 { - color=blue - 53 [label="Enter when branch condition "]; - 54 [label="Access variable R|/x|"]; - 55 [label="Type operator: x !is String"]; - 56 [label="Exit when branch condition"]; - } - subgraph cluster_18 { - color=blue - 57 [label="Enter when branch condition "]; - 58 [label="Access variable R|/x|"]; - 59 [label="Type operator: x !is Int"]; - 60 [label="Exit when branch condition"]; - } - subgraph cluster_19 { - color=blue - 61 [label="Enter when branch condition else"]; - 62 [label="Exit when branch condition"]; - } - 63 [label="Enter when branch result"]; - subgraph cluster_20 { - color=blue - 64 [label="Enter block"]; - 65 [label="Access variable R|/x|"]; - 66 [label="Access variable R|kotlin/String.length|"]; - 67 [label="Access variable R|/x|"]; - 68 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 69 [label="Exit block"]; - } - 70 [label="Exit when branch result"]; - 71 [label="Enter when branch result"]; - subgraph cluster_21 { - color=blue - 72 [label="Enter block"]; - 73 [label="Exit block"]; - } - 74 [label="Exit when branch result"]; - 75 [label="Enter when branch result"]; - subgraph cluster_22 { - color=blue - 76 [label="Enter block"]; - 77 [label="Exit block"]; - } - 78 [label="Exit when branch result"]; - 79 [label="Exit when"]; - } - 80 [label="Exit block"]; - } - 81 [label="Exit function test_3" style="filled" fillcolor=red]; - } - - 50 -> {51}; + 49 -> {50}; + 50 -> {61 51}; 51 -> {52}; 52 -> {53}; 53 -> {54}; 54 -> {55}; 55 -> {56}; - 56 -> {75 57}; + 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; - 60 -> {71 61}; + 60 -> {69}; 61 -> {62}; 62 -> {63}; 63 -> {64}; - 64 -> {65}; + 64 -> {69}; 65 -> {66}; 66 -> {67}; 67 -> {68}; 68 -> {69}; 69 -> {70}; - 70 -> {79}; - 71 -> {72}; - 72 -> {73}; - 73 -> {74}; - 74 -> {79}; - 75 -> {76}; - 76 -> {77}; - 77 -> {78}; - 78 -> {79}; - 79 -> {80}; - 80 -> {81}; + 70 -> {71}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.txt b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.txt index 97ecd6f97a4..70757d41809 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.txt @@ -4,8 +4,6 @@ FILE: simpleIf.kt (R|/x| is R|kotlin/String|) -> { R|/x|.R|kotlin/String.length| } - else -> { - } } R|/x|.# @@ -16,8 +14,6 @@ FILE: simpleIf.kt R|/b| -> { R|/x|.R|kotlin/String.length| } - else -> { - } } R|/x|.# diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/when.dot b/compiler/fir/resolve/testData/resolve/smartcasts/when.dot index 0a6e1751d98..1407949ea5c 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/when.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/when.dot @@ -42,112 +42,101 @@ digraph when_kt { 13 [label="Type operator: x is B"]; 14 [label="Exit when branch condition"]; } + 15 [label="Synthetic else branch"]; + 16 [label="Enter when branch result"]; subgraph cluster_7 { color=blue - 15 [label="Enter when branch condition else"]; - 16 [label="Exit when branch condition"]; + 17 [label="Enter block"]; + 18 [label="Access variable R|/x|"]; + 19 [label="Function call: R|/x|.R|/B.bar|()"]; + 20 [label="Exit block"]; } - 17 [label="Enter when branch result"]; + 21 [label="Exit when branch result"]; + 22 [label="Enter when branch result"]; subgraph cluster_8 { color=blue - 18 [label="Enter block"]; - 19 [label="Exit block"]; + 23 [label="Enter block"]; + 24 [label="Access variable R|/x|"]; + 25 [label="Function call: R|/x|.R|/A.foo|()"]; + 26 [label="Exit block"]; } - 20 [label="Exit when branch result"]; - 21 [label="Enter when branch result"]; - subgraph cluster_9 { - color=blue - 22 [label="Enter block"]; - 23 [label="Access variable R|/x|"]; - 24 [label="Function call: R|/x|.R|/B.bar|()"]; - 25 [label="Exit block"]; - } - 26 [label="Exit when branch result"]; - 27 [label="Enter when branch result"]; + 27 [label="Exit when branch result"]; + 28 [label="Exit when"]; + } + subgraph cluster_9 { + color=blue + 29 [label="Enter when"]; subgraph cluster_10 { 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="Enter when branch condition "]; + 31 [label="Access variable R|/x|"]; + 32 [label="Type operator: x !is A"]; + 33 [label="Exit when branch condition"]; + } + subgraph cluster_11 { + color=blue + 34 [label="Enter when branch condition "]; + 35 [label="Access variable R|/x|"]; + 36 [label="Type operator: x !is B"]; + 37 [label="Exit when branch condition"]; } - 32 [label="Exit when branch result"]; - 33 [label="Exit when"]; - } - subgraph cluster_11 { - color=blue - 34 [label="Enter when"]; subgraph cluster_12 { color=blue - 35 [label="Enter when branch condition "]; - 36 [label="Access variable R|/x|"]; - 37 [label="Type operator: x !is A"]; - 38 [label="Exit when branch condition"]; + 38 [label="Enter when branch condition "]; + 39 [label="Access variable R|/x|"]; + 40 [label="Type operator: x is Int"]; + 41 [label="Exit when branch condition"]; } subgraph cluster_13 { color=blue - 39 [label="Enter when branch condition "]; - 40 [label="Access variable R|/x|"]; - 41 [label="Type operator: x !is B"]; - 42 [label="Exit when branch condition"]; + 42 [label="Enter when branch condition else"]; + 43 [label="Exit when branch condition"]; } + 44 [label="Enter when branch result"]; subgraph cluster_14 { color=blue - 43 [label="Enter when branch condition "]; - 44 [label="Access variable R|/x|"]; - 45 [label="Type operator: x is Int"]; - 46 [label="Exit when branch condition"]; + 45 [label="Enter block"]; + 46 [label="Access variable R|/x|"]; + 47 [label="Function call: R|/x|.R|/A.foo|()"]; + 48 [label="Access variable R|/x|"]; + 49 [label="Function call: R|/x|.R|/B.bar|()"]; + 50 [label="Exit block"]; } + 51 [label="Exit when branch result"]; + 52 [label="Enter when branch result"]; subgraph cluster_15 { color=blue - 47 [label="Enter when branch condition else"]; - 48 [label="Exit when branch condition"]; + 53 [label="Enter block"]; + 54 [label="Access variable R|/x|"]; + 55 [label="Function call: R|/x|.R|/A.foo|()"]; + 56 [label="Access variable R|/x|"]; + 57 [label="Function call: R|/x|.R|/B.bar|()"]; + 58 [label="Access variable R|/x|"]; + 59 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 60 [label="Exit block"]; } - 49 [label="Enter when branch result"]; + 61 [label="Exit when branch result"]; + 62 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 50 [label="Enter block"]; - 51 [label="Access variable R|/x|"]; - 52 [label="Function call: R|/x|.R|/A.foo|()"]; - 53 [label="Access variable R|/x|"]; - 54 [label="Function call: R|/x|.R|/B.bar|()"]; - 55 [label="Exit block"]; + 63 [label="Enter block"]; + 64 [label="Access variable R|/x|"]; + 65 [label="Function call: R|/x|.R|/A.foo|()"]; + 66 [label="Exit block"]; } - 56 [label="Exit when branch result"]; - 57 [label="Enter when branch result"]; + 67 [label="Exit when branch result"]; + 68 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 58 [label="Enter block"]; - 59 [label="Access variable R|/x|"]; - 60 [label="Function call: R|/x|.R|/A.foo|()"]; - 61 [label="Access variable R|/x|"]; - 62 [label="Function call: R|/x|.R|/B.bar|()"]; - 63 [label="Access variable R|/x|"]; - 64 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 65 [label="Exit block"]; + 69 [label="Enter block"]; + 70 [label="Exit block"]; } - 66 [label="Exit when branch result"]; - 67 [label="Enter when branch result"]; - subgraph cluster_18 { - color=blue - 68 [label="Enter block"]; - 69 [label="Access variable R|/x|"]; - 70 [label="Function call: R|/x|.R|/A.foo|()"]; - 71 [label="Exit block"]; - } - 72 [label="Exit when branch result"]; - 73 [label="Enter when branch result"]; - subgraph cluster_19 { - color=blue - 74 [label="Enter block"]; - 75 [label="Exit block"]; - } - 76 [label="Exit when branch result"]; - 77 [label="Exit when"]; + 71 [label="Exit when branch result"]; + 72 [label="Exit when"]; } - 78 [label="Exit block"]; + 73 [label="Exit block"]; } - 79 [label="Exit function test_1" style="filled" fillcolor=red]; + 74 [label="Exit function test_1" style="filled" fillcolor=red]; } 4 -> {5}; @@ -156,244 +145,233 @@ digraph when_kt { 7 -> {8}; 8 -> {9}; 9 -> {10}; - 10 -> {27 11}; + 10 -> {22 11}; 11 -> {12}; 12 -> {13}; 13 -> {14}; - 14 -> {21 15}; - 15 -> {16}; + 14 -> {16 15}; + 15 -> {28}; 16 -> {17}; 17 -> {18}; 18 -> {19}; 19 -> {20}; - 20 -> {33}; - 21 -> {22}; + 20 -> {21}; + 21 -> {28}; 22 -> {23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; - 26 -> {33}; + 26 -> {27}; 27 -> {28}; 28 -> {29}; 29 -> {30}; 30 -> {31}; 31 -> {32}; 32 -> {33}; - 33 -> {34}; + 33 -> {68 34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; - 37 -> {38}; - 38 -> {73 39}; + 37 -> {62 38}; + 38 -> {39}; 39 -> {40}; 40 -> {41}; - 41 -> {42}; - 42 -> {67 43}; + 41 -> {52 42}; + 42 -> {43}; 43 -> {44}; 44 -> {45}; 45 -> {46}; - 46 -> {57 47}; + 46 -> {47}; 47 -> {48}; 48 -> {49}; 49 -> {50}; 50 -> {51}; - 51 -> {52}; + 51 -> {72}; 52 -> {53}; 53 -> {54}; 54 -> {55}; 55 -> {56}; - 56 -> {77}; + 56 -> {57}; 57 -> {58}; 58 -> {59}; 59 -> {60}; 60 -> {61}; - 61 -> {62}; + 61 -> {72}; 62 -> {63}; 63 -> {64}; 64 -> {65}; 65 -> {66}; - 66 -> {77}; - 67 -> {68}; + 66 -> {67}; + 67 -> {72}; 68 -> {69}; 69 -> {70}; 70 -> {71}; 71 -> {72}; - 72 -> {77}; + 72 -> {73}; 73 -> {74}; - 74 -> {75}; - 75 -> {76}; - 76 -> {77}; - 77 -> {78}; - 78 -> {79}; - subgraph cluster_20 { + subgraph cluster_18 { color=red - 80 [label="Enter function test_2" style="filled" fillcolor=red]; - subgraph cluster_21 { + 75 [label="Enter function test_2" style="filled" fillcolor=red]; + subgraph cluster_19 { color=blue - 81 [label="Enter block"]; - subgraph cluster_22 { + 76 [label="Enter block"]; + subgraph cluster_20 { color=blue - 82 [label="Enter when"]; - 83 [label="Access variable R|/x|"]; + 77 [label="Enter when"]; + 78 [label="Access variable R|/x|"]; + subgraph cluster_21 { + color=blue + 79 [label="Enter when branch condition "]; + 80 [label="Type operator: A"]; + 81 [label="Exit when branch condition"]; + } + subgraph cluster_22 { + color=blue + 82 [label="Enter when branch condition "]; + 83 [label="Type operator: B"]; + 84 [label="Exit when branch condition"]; + } + 85 [label="Synthetic else branch"]; + 86 [label="Enter when branch result"]; subgraph cluster_23 { color=blue - 84 [label="Enter when branch condition "]; - 85 [label="Type operator: A"]; - 86 [label="Exit when branch condition"]; + 87 [label="Enter block"]; + 88 [label="Access variable R|/x|"]; + 89 [label="Function call: R|/x|.R|/B.bar|()"]; + 90 [label="Exit block"]; } + 91 [label="Exit when branch result"]; + 92 [label="Enter when branch result"]; subgraph cluster_24 { color=blue - 87 [label="Enter when branch condition "]; - 88 [label="Type operator: B"]; - 89 [label="Exit when branch condition"]; + 93 [label="Enter block"]; + 94 [label="Access variable R|/x|"]; + 95 [label="Function call: R|/x|.R|/A.foo|()"]; + 96 [label="Exit block"]; } - subgraph cluster_25 { - color=blue - 90 [label="Enter when branch condition else"]; - 91 [label="Exit when branch condition"]; - } - 92 [label="Enter when branch result"]; + 97 [label="Exit when branch result"]; + 98 [label="Exit when"]; + } + subgraph cluster_25 { + color=blue + 99 [label="Enter when"]; + 100 [label="Access variable R|/x|"]; subgraph cluster_26 { color=blue - 93 [label="Enter block"]; - 94 [label="Exit block"]; + 101 [label="Enter when branch condition "]; + 102 [label="Type operator: A"]; + 103 [label="Exit when branch condition"]; } - 95 [label="Exit when branch result"]; - 96 [label="Enter when branch result"]; subgraph cluster_27 { color=blue - 97 [label="Enter block"]; - 98 [label="Access variable R|/x|"]; - 99 [label="Function call: R|/x|.R|/B.bar|()"]; - 100 [label="Exit block"]; + 104 [label="Enter when branch condition "]; + 105 [label="Type operator: B"]; + 106 [label="Exit when branch condition"]; } - 101 [label="Exit when branch result"]; - 102 [label="Enter when branch result"]; subgraph cluster_28 { 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"]; + 107 [label="Enter when branch condition "]; + 108 [label="Type operator: Int"]; + 109 [label="Exit when branch condition"]; } - 107 [label="Exit when branch result"]; - 108 [label="Exit when"]; - } - subgraph cluster_29 { - color=blue - 109 [label="Enter when"]; - 110 [label="Access variable R|/x|"]; + subgraph cluster_29 { + color=blue + 110 [label="Enter when branch condition else"]; + 111 [label="Exit when branch condition"]; + } + 112 [label="Enter when branch result"]; subgraph cluster_30 { color=blue - 111 [label="Enter when branch condition "]; - 112 [label="Type operator: A"]; - 113 [label="Exit when branch condition"]; + 113 [label="Enter block"]; + 114 [label="Access variable R|/x|"]; + 115 [label="Function call: R|/x|.R|/A.foo|()"]; + 116 [label="Access variable R|/x|"]; + 117 [label="Function call: R|/x|.R|/B.bar|()"]; + 118 [label="Exit block"]; } + 119 [label="Exit when branch result"]; + 120 [label="Enter when branch result"]; subgraph cluster_31 { color=blue - 114 [label="Enter when branch condition "]; - 115 [label="Type operator: B"]; - 116 [label="Exit when branch condition"]; - } - subgraph cluster_32 { - color=blue - 117 [label="Enter when branch condition "]; - 118 [label="Type operator: Int"]; - 119 [label="Exit when branch condition"]; - } - subgraph cluster_33 { - color=blue - 120 [label="Enter when branch condition else"]; - 121 [label="Exit when branch condition"]; - } - 122 [label="Enter when branch result"]; - subgraph cluster_34 { - color=blue - 123 [label="Enter block"]; + 121 [label="Enter block"]; + 122 [label="Access variable R|/x|"]; + 123 [label="Function call: R|/x|.R|/A.foo|()"]; 124 [label="Access variable R|/x|"]; - 125 [label="Function call: R|/x|.R|/A.foo|()"]; + 125 [label="Function call: R|/x|.R|/B.bar|()"]; 126 [label="Access variable R|/x|"]; - 127 [label="Function call: R|/x|.R|/B.bar|()"]; + 127 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; 128 [label="Exit block"]; } 129 [label="Exit when branch result"]; 130 [label="Enter when branch result"]; - subgraph cluster_35 { + subgraph cluster_32 { color=blue 131 [label="Enter block"]; 132 [label="Access variable R|/x|"]; 133 [label="Function call: R|/x|.R|/A.foo|()"]; - 134 [label="Access variable R|/x|"]; - 135 [label="Function call: R|/x|.R|/B.bar|()"]; - 136 [label="Access variable R|/x|"]; - 137 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 134 [label="Exit block"]; + } + 135 [label="Exit when branch result"]; + 136 [label="Enter when branch result"]; + subgraph cluster_33 { + color=blue + 137 [label="Enter block"]; 138 [label="Exit block"]; } 139 [label="Exit when branch result"]; - 140 [label="Enter when branch result"]; - subgraph cluster_36 { - color=blue - 141 [label="Enter block"]; - 142 [label="Access variable R|/x|"]; - 143 [label="Function call: R|/x|.R|/A.foo|()"]; - 144 [label="Exit block"]; - } - 145 [label="Exit when branch result"]; - 146 [label="Enter when branch result"]; - subgraph cluster_37 { - color=blue - 147 [label="Enter block"]; - 148 [label="Exit block"]; - } - 149 [label="Exit when branch result"]; - 150 [label="Exit when"]; + 140 [label="Exit when"]; } - 151 [label="Exit block"]; + 141 [label="Exit block"]; } - 152 [label="Exit function test_2" style="filled" fillcolor=red]; + 142 [label="Exit function test_2" style="filled" fillcolor=red]; } + 75 -> {76}; + 76 -> {77}; + 77 -> {78}; + 78 -> {79}; + 79 -> {80}; 80 -> {81}; - 81 -> {82}; + 81 -> {92 82}; 82 -> {83}; 83 -> {84}; - 84 -> {85}; - 85 -> {86}; - 86 -> {102 87}; + 84 -> {86 85}; + 85 -> {98}; + 86 -> {87}; 87 -> {88}; 88 -> {89}; - 89 -> {96 90}; + 89 -> {90}; 90 -> {91}; - 91 -> {92}; + 91 -> {98}; 92 -> {93}; 93 -> {94}; 94 -> {95}; - 95 -> {108}; + 95 -> {96}; 96 -> {97}; 97 -> {98}; 98 -> {99}; 99 -> {100}; 100 -> {101}; - 101 -> {108}; + 101 -> {102}; 102 -> {103}; - 103 -> {104}; + 103 -> {136 104}; 104 -> {105}; 105 -> {106}; - 106 -> {107}; + 106 -> {130 107}; 107 -> {108}; 108 -> {109}; - 109 -> {110}; + 109 -> {120 110}; 110 -> {111}; 111 -> {112}; 112 -> {113}; - 113 -> {146 114}; + 113 -> {114}; 114 -> {115}; 115 -> {116}; - 116 -> {140 117}; + 116 -> {117}; 117 -> {118}; 118 -> {119}; - 119 -> {130 120}; + 119 -> {140}; 120 -> {121}; 121 -> {122}; 122 -> {123}; @@ -403,193 +381,182 @@ digraph when_kt { 126 -> {127}; 127 -> {128}; 128 -> {129}; - 129 -> {150}; + 129 -> {140}; 130 -> {131}; 131 -> {132}; 132 -> {133}; 133 -> {134}; 134 -> {135}; - 135 -> {136}; + 135 -> {140}; 136 -> {137}; 137 -> {138}; 138 -> {139}; - 139 -> {150}; + 139 -> {140}; 140 -> {141}; 141 -> {142}; - 142 -> {143}; + + subgraph cluster_34 { + color=red + 143 [label="Enter function test_3" style="filled" fillcolor=red]; + subgraph cluster_35 { + color=blue + 144 [label="Enter block"]; + subgraph cluster_36 { + color=blue + 145 [label="Enter when"]; + 146 [label="Access variable R|/x|"]; + 147 [label="Variable declaration: lval y: R|kotlin/Any?|"]; + subgraph cluster_37 { + color=blue + 148 [label="Enter when branch condition "]; + 149 [label="Type operator: A"]; + 150 [label="Exit when branch condition"]; + } + subgraph cluster_38 { + color=blue + 151 [label="Enter when branch condition "]; + 152 [label="Type operator: B"]; + 153 [label="Exit when branch condition"]; + } + 154 [label="Synthetic else branch"]; + 155 [label="Enter when branch result"]; + subgraph cluster_39 { + color=blue + 156 [label="Enter block"]; + 157 [label="Access variable R|/x|"]; + 158 [label="Function call: R|/x|.R|/B.bar|()"]; + 159 [label="Access variable R|/y|"]; + 160 [label="Function call: R|/y|.R|/B.bar|()"]; + 161 [label="Exit block"]; + } + 162 [label="Exit when branch result"]; + 163 [label="Enter when branch result"]; + subgraph cluster_40 { + color=blue + 164 [label="Enter block"]; + 165 [label="Access variable R|/x|"]; + 166 [label="Function call: R|/x|.R|/A.foo|()"]; + 167 [label="Access variable R|/y|"]; + 168 [label="Function call: R|/y|.R|/A.foo|()"]; + 169 [label="Exit block"]; + } + 170 [label="Exit when branch result"]; + 171 [label="Exit when"]; + } + subgraph cluster_41 { + color=blue + 172 [label="Enter when"]; + 173 [label="Access variable R|/x|"]; + 174 [label="Variable declaration: lval y: R|kotlin/Any?|"]; + subgraph cluster_42 { + color=blue + 175 [label="Enter when branch condition "]; + 176 [label="Type operator: A"]; + 177 [label="Exit when branch condition"]; + } + subgraph cluster_43 { + color=blue + 178 [label="Enter when branch condition "]; + 179 [label="Type operator: B"]; + 180 [label="Exit when branch condition"]; + } + subgraph cluster_44 { + color=blue + 181 [label="Enter when branch condition "]; + 182 [label="Type operator: Int"]; + 183 [label="Exit when branch condition"]; + } + subgraph cluster_45 { + color=blue + 184 [label="Enter when branch condition else"]; + 185 [label="Exit when branch condition"]; + } + 186 [label="Enter when branch result"]; + subgraph cluster_46 { + color=blue + 187 [label="Enter block"]; + 188 [label="Access variable R|/x|"]; + 189 [label="Function call: R|/x|.R|/A.foo|()"]; + 190 [label="Access variable R|/x|"]; + 191 [label="Function call: R|/x|.R|/B.bar|()"]; + 192 [label="Access variable R|/y|"]; + 193 [label="Function call: R|/y|.R|/A.foo|()"]; + 194 [label="Access variable R|/y|"]; + 195 [label="Function call: R|/y|.R|/B.bar|()"]; + 196 [label="Exit block"]; + } + 197 [label="Exit when branch result"]; + 198 [label="Enter when branch result"]; + subgraph cluster_47 { + color=blue + 199 [label="Enter block"]; + 200 [label="Access variable R|/x|"]; + 201 [label="Function call: R|/x|.R|/A.foo|()"]; + 202 [label="Access variable R|/x|"]; + 203 [label="Function call: R|/x|.R|/B.bar|()"]; + 204 [label="Access variable R|/x|"]; + 205 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 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="Access variable R|/y|"]; + 211 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; + 212 [label="Exit block"]; + } + 213 [label="Exit when branch result"]; + 214 [label="Enter when branch result"]; + subgraph cluster_48 { + color=blue + 215 [label="Enter block"]; + 216 [label="Access variable R|/x|"]; + 217 [label="Function call: R|/x|.R|/A.foo|()"]; + 218 [label="Access variable R|/y|"]; + 219 [label="Function call: R|/y|.R|/A.foo|()"]; + 220 [label="Exit block"]; + } + 221 [label="Exit when branch result"]; + 222 [label="Enter when branch result"]; + subgraph cluster_49 { + color=blue + 223 [label="Enter block"]; + 224 [label="Exit block"]; + } + 225 [label="Exit when branch result"]; + 226 [label="Exit when"]; + } + 227 [label="Exit block"]; + } + 228 [label="Exit function test_3" style="filled" fillcolor=red]; + } + 143 -> {144}; 144 -> {145}; - 145 -> {150}; + 145 -> {146}; 146 -> {147}; 147 -> {148}; 148 -> {149}; 149 -> {150}; - 150 -> {151}; + 150 -> {163 151}; 151 -> {152}; - - subgraph cluster_38 { - color=red - 153 [label="Enter function test_3" style="filled" fillcolor=red]; - subgraph cluster_39 { - color=blue - 154 [label="Enter block"]; - subgraph cluster_40 { - color=blue - 155 [label="Enter when"]; - 156 [label="Access variable R|/x|"]; - 157 [label="Variable declaration: lval y: R|kotlin/Any?|"]; - subgraph cluster_41 { - color=blue - 158 [label="Enter when branch condition "]; - 159 [label="Type operator: A"]; - 160 [label="Exit when branch condition"]; - } - subgraph cluster_42 { - color=blue - 161 [label="Enter when branch condition "]; - 162 [label="Type operator: B"]; - 163 [label="Exit when branch condition"]; - } - subgraph cluster_43 { - color=blue - 164 [label="Enter when branch condition else"]; - 165 [label="Exit when branch condition"]; - } - 166 [label="Enter when branch result"]; - subgraph cluster_44 { - color=blue - 167 [label="Enter block"]; - 168 [label="Exit block"]; - } - 169 [label="Exit when branch result"]; - 170 [label="Enter when branch result"]; - subgraph cluster_45 { - color=blue - 171 [label="Enter block"]; - 172 [label="Access variable R|/x|"]; - 173 [label="Function call: R|/x|.R|/B.bar|()"]; - 174 [label="Access variable R|/y|"]; - 175 [label="Function call: R|/y|.R|/B.bar|()"]; - 176 [label="Exit block"]; - } - 177 [label="Exit when branch result"]; - 178 [label="Enter when branch result"]; - subgraph cluster_46 { - color=blue - 179 [label="Enter block"]; - 180 [label="Access variable R|/x|"]; - 181 [label="Function call: R|/x|.R|/A.foo|()"]; - 182 [label="Access variable R|/y|"]; - 183 [label="Function call: R|/y|.R|/A.foo|()"]; - 184 [label="Exit block"]; - } - 185 [label="Exit when branch result"]; - 186 [label="Exit when"]; - } - subgraph cluster_47 { - color=blue - 187 [label="Enter when"]; - 188 [label="Access variable R|/x|"]; - 189 [label="Variable declaration: lval y: R|kotlin/Any?|"]; - subgraph cluster_48 { - color=blue - 190 [label="Enter when branch condition "]; - 191 [label="Type operator: A"]; - 192 [label="Exit when branch condition"]; - } - subgraph cluster_49 { - color=blue - 193 [label="Enter when branch condition "]; - 194 [label="Type operator: B"]; - 195 [label="Exit when branch condition"]; - } - subgraph cluster_50 { - color=blue - 196 [label="Enter when branch condition "]; - 197 [label="Type operator: Int"]; - 198 [label="Exit when branch condition"]; - } - subgraph cluster_51 { - color=blue - 199 [label="Enter when branch condition else"]; - 200 [label="Exit when branch condition"]; - } - 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|.R|/A.foo|()"]; - 205 [label="Access variable R|/x|"]; - 206 [label="Function call: R|/x|.R|/B.bar|()"]; - 207 [label="Access variable R|/y|"]; - 208 [label="Function call: R|/y|.R|/A.foo|()"]; - 209 [label="Access variable R|/y|"]; - 210 [label="Function call: R|/y|.R|/B.bar|()"]; - 211 [label="Exit block"]; - } - 212 [label="Exit when branch result"]; - 213 [label="Enter when branch result"]; - subgraph cluster_53 { - color=blue - 214 [label="Enter block"]; - 215 [label="Access variable R|/x|"]; - 216 [label="Function call: R|/x|.R|/A.foo|()"]; - 217 [label="Access variable R|/x|"]; - 218 [label="Function call: R|/x|.R|/B.bar|()"]; - 219 [label="Access variable R|/x|"]; - 220 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 221 [label="Access variable R|/y|"]; - 222 [label="Function call: R|/y|.R|/A.foo|()"]; - 223 [label="Access variable R|/y|"]; - 224 [label="Function call: R|/y|.R|/B.bar|()"]; - 225 [label="Access variable R|/y|"]; - 226 [label="Function call: R|/y|.R|kotlin/Int.inc|()"]; - 227 [label="Exit block"]; - } - 228 [label="Exit when branch result"]; - 229 [label="Enter when branch result"]; - subgraph cluster_54 { - color=blue - 230 [label="Enter block"]; - 231 [label="Access variable R|/x|"]; - 232 [label="Function call: R|/x|.R|/A.foo|()"]; - 233 [label="Access variable R|/y|"]; - 234 [label="Function call: R|/y|.R|/A.foo|()"]; - 235 [label="Exit block"]; - } - 236 [label="Exit when branch result"]; - 237 [label="Enter when branch result"]; - subgraph cluster_55 { - color=blue - 238 [label="Enter block"]; - 239 [label="Exit block"]; - } - 240 [label="Exit when branch result"]; - 241 [label="Exit when"]; - } - 242 [label="Exit block"]; - } - 243 [label="Exit function test_3" style="filled" fillcolor=red]; - } - - 153 -> {154}; - 154 -> {155}; + 152 -> {153}; + 153 -> {155 154}; + 154 -> {171}; 155 -> {156}; 156 -> {157}; 157 -> {158}; 158 -> {159}; 159 -> {160}; - 160 -> {178 161}; + 160 -> {161}; 161 -> {162}; - 162 -> {163}; - 163 -> {170 164}; + 162 -> {171}; + 163 -> {164}; 164 -> {165}; 165 -> {166}; 166 -> {167}; 167 -> {168}; 168 -> {169}; - 169 -> {186}; + 169 -> {170}; 170 -> {171}; 171 -> {172}; 172 -> {173}; @@ -597,13 +564,13 @@ digraph when_kt { 174 -> {175}; 175 -> {176}; 176 -> {177}; - 177 -> {186}; + 177 -> {222 178}; 178 -> {179}; 179 -> {180}; - 180 -> {181}; + 180 -> {214 181}; 181 -> {182}; 182 -> {183}; - 183 -> {184}; + 183 -> {198 184}; 184 -> {185}; 185 -> {186}; 186 -> {187}; @@ -612,13 +579,13 @@ digraph when_kt { 189 -> {190}; 190 -> {191}; 191 -> {192}; - 192 -> {237 193}; + 192 -> {193}; 193 -> {194}; 194 -> {195}; - 195 -> {229 196}; + 195 -> {196}; 196 -> {197}; - 197 -> {198}; - 198 -> {213 199}; + 197 -> {226}; + 198 -> {199}; 199 -> {200}; 200 -> {201}; 201 -> {202}; @@ -632,8 +599,8 @@ digraph when_kt { 209 -> {210}; 210 -> {211}; 211 -> {212}; - 212 -> {241}; - 213 -> {214}; + 212 -> {213}; + 213 -> {226}; 214 -> {215}; 215 -> {216}; 216 -> {217}; @@ -641,14 +608,51 @@ digraph when_kt { 218 -> {219}; 219 -> {220}; 220 -> {221}; - 221 -> {222}; + 221 -> {226}; 222 -> {223}; 223 -> {224}; 224 -> {225}; 225 -> {226}; 226 -> {227}; 227 -> {228}; - 228 -> {241}; + + subgraph cluster_50 { + color=red + 229 [label="Enter function test_4" style="filled" fillcolor=red]; + subgraph cluster_51 { + color=blue + 230 [label="Enter block"]; + subgraph cluster_52 { + color=blue + 231 [label="Enter when"]; + 232 [label="Access variable R|/x|"]; + 233 [label="Type operator: x as Int"]; + subgraph cluster_53 { + color=blue + 234 [label="Enter when branch condition "]; + 235 [label="Const: Int(1)"]; + 236 [label="Operator =="]; + 237 [label="Exit when branch condition"]; + } + 238 [label="Synthetic else branch"]; + 239 [label="Enter when branch result"]; + subgraph cluster_54 { + color=blue + 240 [label="Enter block"]; + 241 [label="Access variable R|/x|"]; + 242 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 243 [label="Exit block"]; + } + 244 [label="Exit when branch result"]; + 245 [label="Exit when"]; + } + 246 [label="Access variable R|/x|"]; + 247 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; + 248 [label="Exit block"]; + } + 249 [label="Exit function test_4" style="filled" fillcolor=red]; + } + 229 -> {230}; 230 -> {231}; 231 -> {232}; @@ -656,86 +660,18 @@ digraph when_kt { 233 -> {234}; 234 -> {235}; 235 -> {236}; - 236 -> {241}; - 237 -> {238}; - 238 -> {239}; + 236 -> {237}; + 237 -> {239 238}; + 238 -> {245}; 239 -> {240}; 240 -> {241}; 241 -> {242}; 242 -> {243}; - - subgraph cluster_56 { - color=red - 244 [label="Enter function test_4" style="filled" fillcolor=red]; - subgraph cluster_57 { - color=blue - 245 [label="Enter block"]; - subgraph cluster_58 { - color=blue - 246 [label="Enter when"]; - 247 [label="Access variable R|/x|"]; - 248 [label="Type operator: x as Int"]; - subgraph cluster_59 { - color=blue - 249 [label="Enter when branch condition "]; - 250 [label="Const: Int(1)"]; - 251 [label="Operator =="]; - 252 [label="Exit when branch condition"]; - } - subgraph cluster_60 { - color=blue - 253 [label="Enter when branch condition else"]; - 254 [label="Exit when branch condition"]; - } - 255 [label="Enter when branch result"]; - subgraph cluster_61 { - color=blue - 256 [label="Enter block"]; - 257 [label="Exit block"]; - } - 258 [label="Exit when branch result"]; - 259 [label="Enter when branch result"]; - subgraph cluster_62 { - color=blue - 260 [label="Enter block"]; - 261 [label="Access variable R|/x|"]; - 262 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 263 [label="Exit block"]; - } - 264 [label="Exit when branch result"]; - 265 [label="Exit when"]; - } - 266 [label="Access variable R|/x|"]; - 267 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; - 268 [label="Exit block"]; - } - 269 [label="Exit function test_4" style="filled" fillcolor=red]; - } - + 243 -> {244}; 244 -> {245}; 245 -> {246}; 246 -> {247}; 247 -> {248}; 248 -> {249}; - 249 -> {250}; - 250 -> {251}; - 251 -> {252}; - 252 -> {259 253}; - 253 -> {254}; - 254 -> {255}; - 255 -> {256}; - 256 -> {257}; - 257 -> {258}; - 258 -> {265}; - 259 -> {260}; - 260 -> {261}; - 261 -> {262}; - 262 -> {263}; - 263 -> {264}; - 264 -> {265}; - 265 -> {266}; - 266 -> {267}; - 267 -> {268}; - 268 -> {269}; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/when.txt b/compiler/fir/resolve/testData/resolve/smartcasts/when.txt index 0a2bd3e26bd..20a696336f8 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/when.txt +++ b/compiler/fir/resolve/testData/resolve/smartcasts/when.txt @@ -15,8 +15,6 @@ FILE: when.kt (R|/x| is R|B|) -> { R|/x|.R|/B.bar|() } - else -> { - } } when () { @@ -45,8 +43,6 @@ FILE: when.kt ($subj$ is R|B|) -> { R|/x|.R|/B.bar|() } - else -> { - } } when (R|/x|) { @@ -77,8 +73,6 @@ FILE: when.kt R|/x|.R|/B.bar|() R|/y|.R|/B.bar|() } - else -> { - } } when (lval y: R|kotlin/Any?| = R|/x|) { @@ -110,8 +104,6 @@ FILE: when.kt ==($subj$, Int(1)) -> { R|/x|.R|kotlin/Int.inc|() } - else -> { - } } R|/x|.R|kotlin/Int.inc|() diff --git a/compiler/fir/resolve/testData/resolve/stdlib/exception.txt b/compiler/fir/resolve/testData/resolve/stdlib/exception.txt index 255993928fa..22a371bb872 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/exception.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/exception.txt @@ -7,8 +7,6 @@ FILE: exception.kt ==(R|/box|(), String(OK)) -> { throw R|java/lang/Exception.Exception|(String(Hello)) } - else -> { - } } } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java index edc6f4879ae..c5985db3666 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirResolveTestCaseGenerated.java @@ -59,6 +59,21 @@ public class FirResolveTestCaseGenerated extends AbstractFirResolveTestCase { runTest("compiler/fir/resolve/testData/resolve/enum.kt"); } + @TestMetadata("exhaustiveness_boolean.kt") + public void testExhaustiveness_boolean() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/exhaustiveness_boolean.kt"); + } + + @TestMetadata("exhaustiveness_enum.kt") + public void testExhaustiveness_enum() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/exhaustiveness_enum.kt"); + } + + @TestMetadata("exhaustiveness_sealedClass.kt") + public void testExhaustiveness_sealedClass() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/exhaustiveness_sealedClass.kt"); + } + @TestMetadata("extension.kt") public void testExtension() throws Exception { runTest("compiler/fir/resolve/testData/resolve/extension.kt"); diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt index ccde9a41738..35bb04b6033 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSession.kt @@ -41,15 +41,15 @@ abstract class FirSession(val sessionProvider: FirSessionProvider?) { } class BuiltinTypes { - val unitType: FirTypeRef = FirImplicitUnitTypeRef(null) - val anyType: FirTypeRef = FirImplicitAnyTypeRef(null) - val nullableAnyType: FirTypeRef = FirImplicitNullableAnyTypeRef(null) - val enumType: FirTypeRef = FirImplicitEnumTypeRef(null) - val annotationType: FirTypeRef = FirImplicitAnnotationTypeRef(null) - val booleanType: FirTypeRef = FirImplicitBooleanTypeRef(null) - val nothingType: FirTypeRef = FirImplicitNothingTypeRef(null) - val nullableNothingType: FirTypeRef = FirImplicitNullableNothingTypeRef(null) - val stringType: FirTypeRef = FirImplicitStringTypeRef(null) + val unitType: FirImplicitBuiltinTypeRef = FirImplicitUnitTypeRef(null) + val anyType: FirImplicitBuiltinTypeRef = FirImplicitAnyTypeRef(null) + val nullableAnyType: FirImplicitBuiltinTypeRef = FirImplicitNullableAnyTypeRef(null) + val enumType: FirImplicitBuiltinTypeRef = FirImplicitEnumTypeRef(null) + val annotationType: FirImplicitBuiltinTypeRef = FirImplicitAnnotationTypeRef(null) + val booleanType: FirImplicitBuiltinTypeRef = FirImplicitBooleanTypeRef(null) + val nothingType: FirImplicitBuiltinTypeRef = FirImplicitNothingTypeRef(null) + val nullableNothingType: FirImplicitBuiltinTypeRef = FirImplicitNullableNothingTypeRef(null) + val stringType: FirImplicitBuiltinTypeRef = FirImplicitStringTypeRef(null) } interface FirSessionProvider { diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt index d0746f31588..cc8ece1d1d2 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.fir.declarations +import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.declarations.impl.FirEnumEntryImpl import org.jetbrains.kotlin.fir.declarations.impl.FirModifiableRegularClass import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl @@ -59,4 +60,9 @@ val FirTypeAlias.expandedConeType: ConeClassLikeType? get() = expandedTypeRef.co val FirRegularClass.classId get() = symbol.classId -val FirClass.superConeTypes get() = superTypeRefs.mapNotNull { it.coneTypeSafe() } \ No newline at end of file +val FirClass.superConeTypes get() = superTypeRefs.mapNotNull { it.coneTypeSafe() } + +fun FirRegularClass.collectEnumEntries(): Collection { + assert(classKind == ClassKind.ENUM_CLASS) + return declarations.filterIsInstance() +} \ No newline at end of file diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirWhenExpression.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirWhenExpression.kt index 7cc3ba15b2f..5c8e9362309 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirWhenExpression.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/FirWhenExpression.kt @@ -24,9 +24,12 @@ interface FirWhenExpression : FirExpression, FirResolvable { val subject: FirExpression? val subjectVariable: FirVariable<*>? val branches: List + val isExhaustive: Boolean override fun accept(visitor: FirVisitor, data: D): R = visitor.visitWhenExpression(this, data) + fun replaceIsExhaustive(newIsExhaustive: Boolean) + override fun transformCalleeReference(transformer: FirTransformer, data: D): FirWhenExpression fun transformSubject(transformer: FirTransformer, data: D): FirWhenExpression diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenExpressionImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenExpressionImpl.kt index 95a341a8af8..1737fa6deee 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenExpressionImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/expressions/impl/FirWhenExpressionImpl.kt @@ -32,6 +32,7 @@ class FirWhenExpressionImpl( override val annotations: MutableList = mutableListOf() override var calleeReference: FirReference = FirStubReference() override val branches: MutableList = mutableListOf() + override var isExhaustive: Boolean = false override fun acceptChildren(visitor: FirVisitor, data: D) { typeRef.accept(visitor, data) @@ -81,4 +82,8 @@ class FirWhenExpressionImpl( override fun replaceTypeRef(newTypeRef: FirTypeRef) { typeRef = newTypeRef } + + override fun replaceIsExhaustive(newIsExhaustive: Boolean) { + isExhaustive = newIsExhaustive + } } 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 7b323ee310a..5af36cc092a 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 @@ -425,6 +425,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() impl(whenExpression) { default("calleeReference", "FirStubReference()") + defaultFalse("isExhaustive") useTypes(stubReferenceType) } 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 8db02b62813..dd81d890069 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 @@ -500,6 +500,7 @@ object NodeConfigurator : AbstractFieldConfigurator() { +field("subject", expression, nullable = true).withTransform() +field("subjectVariable", variable.withArgs("F" to "*"), nullable = true) +fieldList("branches", whenBranch).withTransform() + +booleanField("isExhaustive", withReplace = true) needTransformOtherChildren() } diff --git a/compiler/testData/ir/irText/expressions/bangbang.fir.txt b/compiler/testData/ir/irText/expressions/bangbang.fir.txt index 54934b51c6f..bc02e34c8cf 100644 --- a/compiler/testData/ir/irText/expressions/bangbang.fir.txt +++ b/compiler/testData/ir/irText/expressions/bangbang.fir.txt @@ -59,7 +59,7 @@ FILE fqName: fileName:/bangbang.kt TYPE_PARAMETER name:X index:0 variance: superTypes:[] VALUE_PARAMETER name:a index:0 type:X of .test4 BLOCK_BODY - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String? GET_VAR 'a: X of .test4 declared in .test4' type=X of .test4 origin=null @@ -76,7 +76,7 @@ FILE fqName: fileName:/bangbang.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: GET_VAR 'val : kotlin.String? [val] declared in .test4' type=kotlin.String origin=null - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String? GET_VAR 'a: X of .test4 declared in .test4' type=X of .test4 origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt index 3f6c055a01d..ed4f0c4c0f1 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.fir.txt @@ -103,7 +103,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt CONST Int type=kotlin.Int value=0 WHILE label=Outer origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Any? origin=null VAR name: type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null SET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null @@ -129,7 +129,7 @@ FILE fqName: fileName:/breakContinueInLoopHeader.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: BREAK label=null loop.label=Outer - WHEN type=kotlin.Nothing origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'var i: kotlin.Int [var] declared in .test5' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt index db13e2f6682..28ce84726e7 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt @@ -19,11 +19,11 @@ FILE fqName: fileName:/breakContinueInWhen.kt WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testBreakFor' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Any? origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testBreakFor' type=kotlin.collections.IntIterator origin=null - WHEN type=kotlin.Nothing origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testBreakFor' type=kotlin.Int origin=null @@ -37,7 +37,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testBreakWhile' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 - body: WHEN type=kotlin.Nothing origin=WHEN + body: WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testBreakWhile' type=kotlin.Int origin=null @@ -48,7 +48,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt VAR name:k type:kotlin.Int [var] CONST Int type=kotlin.Int value=0 DO_WHILE label=null origin=DO_WHILE_LOOP - body: WHEN type=kotlin.Nothing origin=WHEN + body: WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testBreakDoWhile' type=kotlin.Int origin=null @@ -77,11 +77,11 @@ FILE fqName: fileName:/breakContinueInWhen.kt WHILE label=null origin=FOR_LOOP_INNER_WHILE condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testContinueFor' type=kotlin.collections.IntIterator origin=null - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Any? origin=null VAR name:x type:kotlin.Int [val] CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testContinueFor' type=kotlin.collections.IntIterator origin=null - WHEN type=kotlin.Nothing origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueFor' type=kotlin.Int origin=null @@ -95,7 +95,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueWhile' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 - body: WHEN type=kotlin.Nothing origin=WHEN + body: WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueWhile' type=kotlin.Int origin=null @@ -115,7 +115,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt CALL 'public final fun inc (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val : kotlin.Int [val] declared in .testContinueDoWhile' type=kotlin.Int origin=null GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null - WHEN type=kotlin.Nothing origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null @@ -128,7 +128,7 @@ FILE fqName: fileName:/breakContinueInWhen.kt condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=10 - WHEN type=kotlin.Nothing origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ diff --git a/compiler/testData/ir/irText/expressions/elvis.fir.txt b/compiler/testData/ir/irText/expressions/elvis.fir.txt index 6c9020c2024..9bea8c04a2c 100644 --- a/compiler/testData/ir/irText/expressions/elvis.fir.txt +++ b/compiler/testData/ir/irText/expressions/elvis.fir.txt @@ -50,13 +50,13 @@ FILE fqName: fileName:/elvis.kt VALUE_PARAMETER name:a index:0 type:kotlin.Any? VALUE_PARAMETER name:b index:1 type:kotlin.Any? BLOCK_BODY - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'b: kotlin.Any? declared in .test3' type=kotlin.Any? origin=null then: RETURN type=kotlin.Nothing from='public final fun test3 (a: kotlin.Any?, b: kotlin.Any?): kotlin.String declared in ' CONST String type=kotlin.String value="" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String? GET_VAR 'a: kotlin.Any? declared in .test3' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt index d3b032450c9..4d2f06c4834 100644 --- a/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt +++ b/compiler/testData/ir/irText/expressions/floatingPointComparisons/whenByFloatingPoint.fir.txt @@ -17,7 +17,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt FUN name:testSmartCastInWhenSubject visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Int VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'x: kotlin.Any declared in .testSmartCastInWhenSubject' type=kotlin.Any origin=null @@ -40,7 +40,7 @@ FILE fqName: fileName:/whenByFloatingPoint.kt VALUE_PARAMETER name:x index:0 type:kotlin.Double VALUE_PARAMETER name:y index:1 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'y: kotlin.Any declared in .testSmartCastInWhenCondition' type=kotlin.Any origin=null @@ -83,14 +83,14 @@ FILE fqName: fileName:/whenByFloatingPoint.kt VALUE_PARAMETER name:x index:0 type:kotlin.Any VALUE_PARAMETER name:y index:1 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Double GET_VAR 'x: kotlin.Any declared in .testSmartCastToDifferentTypes' type=kotlin.Any origin=null then: RETURN type=kotlin.Nothing from='public final fun testSmartCastToDifferentTypes (x: kotlin.Any, y: kotlin.Any): kotlin.Int declared in ' CALL 'public final fun unaryMinus (): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null $this: CONST Int type=kotlin.Int value=1 - WHEN type=kotlin.Int origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Float GET_VAR 'y: kotlin.Any declared in .testSmartCastToDifferentTypes' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt b/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt index 8b60164ef6a..4828831aa20 100644 --- a/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt +++ b/compiler/testData/ir/irText/expressions/ifElseIf.fir.txt @@ -31,7 +31,7 @@ FILE fqName: fileName:/ifElseIf.kt BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CONST Boolean type=kotlin.Boolean value=true - WHEN type=kotlin.Boolean origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: GET_VAR 'flag: kotlin.Boolean declared in .testEmptyBranches1' type=kotlin.Boolean origin=null then: CONST Boolean type=kotlin.Boolean value=true diff --git a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.txt b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.txt index e69cf46dc11..9b84cd16efc 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastInReturnFromConstructor.fir.txt @@ -8,7 +8,7 @@ FILE fqName: fileName:/implicitCastInReturnFromConstructor.kt CONSTRUCTOR visibility:public <> (x:kotlin.Any?) returnType:.C VALUE_PARAMETER name:x index:0 type:kotlin.Any? BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Unit GET_VAR 'x: kotlin.Any? declared in .C.' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt index 787f5f5fa4e..32025ebd925 100644 --- a/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt +++ b/compiler/testData/ir/irText/expressions/implicitCastToNonNull.fir.txt @@ -62,7 +62,7 @@ FILE fqName: fileName:/implicitCastToNonNull.kt VALUE_PARAMETER name:x index:0 type:T of .test5 VALUE_PARAMETER name:fn index:1 type:kotlin.Function1.test5, kotlin.Unit> BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.txt index d6e4e53dc37..601222c1741 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.txt @@ -10,21 +10,21 @@ FILE fqName: fileName:/kt24804.kt VAR name:z type:kotlin.Int [var] CONST Int type=kotlin.Int value=10 DO_WHILE label=l2 origin=DO_WHILE_LOOP - body: BLOCK type=kotlin.Nothing origin=null + body: BLOCK type=kotlin.Any? origin=null SET_VAR 'var z: kotlin.Int [var] declared in .run' type=kotlin.Int origin=null CONST Int type=kotlin.Int value=1 - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT arg0: GET_VAR 'var z: kotlin.Int [var] declared in .run' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=100 then: RETURN type=kotlin.Nothing from='public final fun run (x: kotlin.Boolean, y: kotlin.Boolean): kotlin.String declared in ' CONST String type=kotlin.String value="NOT_OK" - WHEN type=kotlin.Nothing origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: GET_VAR 'x: kotlin.Boolean declared in .run' type=kotlin.Boolean origin=null then: ERROR_EXPR 'Unbound loop: continue@@@[ERROR_EXPR(Cannot bind label l1 to a loop)] ' type=kotlin.Nothing - WHEN type=kotlin.Nothing origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: GET_VAR 'y: kotlin.Boolean declared in .run' type=kotlin.Boolean origin=null then: CONTINUE label=l2 loop.label=l2 diff --git a/compiler/testData/ir/irText/expressions/kt27933.fir.txt b/compiler/testData/ir/irText/expressions/kt27933.fir.txt index 8103ccaf2aa..b241bb649a1 100644 --- a/compiler/testData/ir/irText/expressions/kt27933.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt27933.fir.txt @@ -15,7 +15,7 @@ FILE fqName: fileName:/kt27933.kt then: BLOCK type=kotlin.Unit origin=null SET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null CONST String type=kotlin.String value="O" - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'var r: kotlin.String [var] declared in .box' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt index be9cc6cb1ec..aa3bddd7dfa 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.txt @@ -2,7 +2,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test1 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test1' type=kotlin.Function0 origin=null @@ -11,7 +11,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test2' type=kotlin.Function0 origin=null @@ -21,7 +21,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Function0) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test3' type=kotlin.Function0 origin=null @@ -33,7 +33,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt VALUE_PARAMETER name:a index:0 type:kotlin.Function0 VALUE_PARAMETER name:b index:1 type:kotlin.Function0 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Function0 declared in .test4' type=kotlin.Function0 origin=null @@ -44,7 +44,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Any declared in .test5' type=kotlin.Any origin=null @@ -54,7 +54,7 @@ FILE fqName: fileName:/samConversionsWithSmartCasts.kt FUN name:test5x visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=java.lang.Runnable GET_VAR 'a: kotlin.Any declared in .test5x' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt index 6f3b1cc2016..a6a2d94310a 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt @@ -9,7 +9,7 @@ FILE fqName: fileName:/Derived.kt $this: VALUE_PARAMETER name: type:.Derived VALUE_PARAMETER name:v index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String GET_VAR 'v: kotlin.Any declared in .Derived.setValue' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/smartCasts.fir.txt b/compiler/testData/ir/irText/expressions/smartCasts.fir.txt index 2816e253721..7b974f10638 100644 --- a/compiler/testData/ir/irText/expressions/smartCasts.fir.txt +++ b/compiler/testData/ir/irText/expressions/smartCasts.fir.txt @@ -18,7 +18,7 @@ FILE fqName: fileName:/smartCasts.kt FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'x: kotlin.Any declared in .test1' type=kotlin.Any origin=null @@ -38,7 +38,7 @@ FILE fqName: fileName:/smartCasts.kt FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.String VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'x: kotlin.Any declared in .test2' type=kotlin.Any origin=null @@ -50,7 +50,7 @@ FILE fqName: fileName:/smartCasts.kt FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.String VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'x: kotlin.Any declared in .test3' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.txt b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.txt index 8d074ef72f8..5d292cd8a56 100644 --- a/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.txt +++ b/compiler/testData/ir/irText/expressions/smartCastsWithDestructuring.fir.txt @@ -42,7 +42,7 @@ FILE fqName: fileName:/smartCastsWithDestructuring.kt FUN name:test visibility:public modality:FINAL <> (x:.I1) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:.I1 BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.I2 GET_VAR 'x: .I1 declared in .test' type=.I1 origin=null diff --git a/compiler/testData/ir/irText/expressions/throw.fir.txt b/compiler/testData/ir/irText/expressions/throw.fir.txt index b484f564470..02ae7954324 100644 --- a/compiler/testData/ir/irText/expressions/throw.fir.txt +++ b/compiler/testData/ir/irText/expressions/throw.fir.txt @@ -6,7 +6,7 @@ FILE fqName: fileName:/throw.kt FUN name:testImplicitCast visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Nothing origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Throwable GET_VAR 'a: kotlin.Any declared in .testImplicitCast' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt index 9c2c32bbaed..2524d311956 100644 --- a/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt +++ b/compiler/testData/ir/irText/expressions/tryCatchWithImplicitCast.fir.txt @@ -2,7 +2,7 @@ FILE fqName: fileName:/tryCatchWithImplicitCast.kt FUN name:testImplicitCast visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.String GET_VAR 'a: kotlin.Any declared in .testImplicitCast' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt b/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt index 30b1adb05db..c3de50d3c44 100644 --- a/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt +++ b/compiler/testData/ir/irText/expressions/useImportedMember.fir.txt @@ -149,7 +149,7 @@ FILE fqName: fileName:/useImportedMember.kt VALUE_PARAMETER name:g index:0 type:kotlin.String FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String BLOCK_BODY - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -159,7 +159,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST Int type=kotlin.Int value=1 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="1" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -169,7 +169,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST Int type=kotlin.Int value=2 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="2" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -178,7 +178,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST Int type=kotlin.Int value=3 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="3" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -190,7 +190,7 @@ FILE fqName: fileName:/useImportedMember.kt SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.Int visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR ': .C declared in .C' type=.C origin=null value: CONST Int type=kotlin.Int value=5 - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -199,7 +199,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST Int type=kotlin.Int value=5 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="5" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -208,7 +208,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST Int type=kotlin.Int value=6 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="6" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -219,7 +219,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST String type=kotlin.String value="7" then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="7" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -228,7 +228,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST String type=kotlin.String value="8" then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="8" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -238,7 +238,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST Int type=kotlin.Int value=9 then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="9" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ @@ -247,7 +247,7 @@ FILE fqName: fileName:/useImportedMember.kt arg1: CONST String type=kotlin.String value="10" then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' CONST String type=kotlin.String value="10" - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ diff --git a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.fir.txt b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.fir.txt index 62d4d450106..cc4a0a0de43 100644 --- a/compiler/testData/ir/irText/expressions/varargWithImplicitCast.fir.txt +++ b/compiler/testData/ir/irText/expressions/varargWithImplicitCast.fir.txt @@ -2,7 +2,7 @@ FILE fqName: fileName:/varargWithImplicitCast.kt FUN name:testScalar visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.IntArray VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.IntArray origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.Int GET_VAR 'a: kotlin.Any declared in .testScalar' type=kotlin.Any origin=null @@ -14,7 +14,7 @@ FILE fqName: fileName:/varargWithImplicitCast.kt FUN name:testSpread visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.IntArray VALUE_PARAMETER name:a index:0 type:kotlin.Any BLOCK_BODY - WHEN type=kotlin.IntArray origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=kotlin.IntArray GET_VAR 'a: kotlin.Any declared in .testSpread' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt index a1cba47a581..18842a2d93a 100644 --- a/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt +++ b/compiler/testData/ir/irText/expressions/whenCoercedToUnit.fir.txt @@ -2,9 +2,9 @@ FILE fqName: fileName:/whenCoercedToUnit.kt FUN name:foo visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:x index:0 type:kotlin.Int BLOCK_BODY - BLOCK type=kotlin.Int origin=WHEN + BLOCK type=kotlin.Any? origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp0_subject type:kotlin.Int [val] - WHEN type=kotlin.Int origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp0_subject: kotlin.Int [val] declared in .foo' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt index 1940a72c661..4cba37b1108 100644 --- a/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt +++ b/compiler/testData/ir/irText/expressions/whileDoWhile.fir.txt @@ -61,7 +61,7 @@ FILE fqName: fileName:/whileDoWhile.kt BLOCK_BODY VAR name:a type:kotlin.Any? [val] CONST Null type=kotlin.Nothing? value=null - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.Boolean GET_VAR 'val a: kotlin.Any? [val] declared in .testSmartcastInCondition' type=kotlin.Any? origin=null diff --git a/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt b/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt index 40cf61d9c90..c63ffaa94e9 100644 --- a/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt +++ b/compiler/testData/ir/irText/lambdas/nonLocalReturn.fir.txt @@ -44,7 +44,7 @@ FILE fqName: fileName:/nonLocalReturn.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:it index:0 type:kotlin.Int BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'it: kotlin.Int declared in .testLrmFoo1.' type=kotlin.Int origin=null @@ -62,7 +62,7 @@ FILE fqName: fileName:/nonLocalReturn.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (it:kotlin.Int) returnType:kotlin.Unit VALUE_PARAMETER name:it index:0 type:kotlin.Int BLOCK_BODY - WHEN type=kotlin.Unit origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'it: kotlin.Int declared in .testLrmFoo2.' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt index 65d1bbec938..5d71d3b1943 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt @@ -13,7 +13,7 @@ FILE fqName: fileName:/coercionInLoop.kt condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null $this: GET_VAR 'val x: kotlin.collections.DoubleIterator [val] declared in .box' type=kotlin.collections.DoubleIterator origin=null body: BLOCK type=kotlin.Int origin=null - WHEN type=kotlin.String origin=IF + WHEN type=kotlin.Any? origin=IF BRANCH if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ $this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ diff --git a/compiler/testData/ir/irText/regressions/kt24114.fir.txt b/compiler/testData/ir/irText/regressions/kt24114.fir.txt index 56df4d12b33..37f32d53337 100644 --- a/compiler/testData/ir/irText/regressions/kt24114.fir.txt +++ b/compiler/testData/ir/irText/regressions/kt24114.fir.txt @@ -11,16 +11,16 @@ FILE fqName: fileName:/kt24114.kt BLOCK_BODY WHILE label=null origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Int origin=WHEN + body: BLOCK type=kotlin.Any? origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp0_subject type:kotlin.Int [val] - WHEN type=kotlin.Int origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp0_subject: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=1 - then: BLOCK type=kotlin.Int origin=WHEN + then: BLOCK type=kotlin.Any? origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp1_subject type:kotlin.Int [val] - WHEN type=kotlin.Int origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp1_subject: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null @@ -35,16 +35,16 @@ FILE fqName: fileName:/kt24114.kt BLOCK_BODY WHILE label=null origin=WHILE_LOOP condition: CONST Boolean type=kotlin.Boolean value=true - body: BLOCK type=kotlin.Int origin=WHEN + body: BLOCK type=kotlin.Any? origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp2_subject type:kotlin.Int [val] - WHEN type=kotlin.Int origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp2_subject: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null arg1: CONST Int type=kotlin.Int value=1 - then: BLOCK type=kotlin.Int origin=WHEN + then: BLOCK type=kotlin.Any? origin=WHEN VAR IR_TEMPORARY_VARIABLE name:tmp3_subject type:kotlin.Int [val] - WHEN type=kotlin.Int origin=WHEN + WHEN type=kotlin.Any? origin=WHEN BRANCH if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ arg0: GET_VAR 'val tmp3_subject: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null