From f83cedd244e647ba7d666ff4c364193a3c9ebfb1 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 11 Mar 2020 12:02:35 +0300 Subject: [PATCH] [FIR] Don't render call arguments in cfg dump --- .../dfa/cfg/ControlFlowGraphRenderer.kt | 16 ++++++++------- .../resolve/testData/resolve/cfg/complex.dot | 2 +- .../resolve/testData/resolve/cfg/jumps.dot | 2 +- .../resolve/cfg/lambdaAsReturnOfLambda.dot | 4 ++-- .../resolve/testData/resolve/cfg/lambdas.dot | 6 +++--- .../resolve/testData/resolve/cfg/loops.dot | 4 ++-- .../testData/resolve/cfg/postponedLambdas.dot | 2 +- .../resolve/cfg/propertiesAndInitBlocks.dot | 4 ++-- .../resolve/cfg/returnValuesFromLambda.dot | 6 +++--- .../resolve/testData/resolve/cfg/simple.dot | 2 +- .../fir/resolve/testData/resolve/cfg/when.dot | 4 ++-- .../resolve/exhaustiveWhenAndDNNType.dot | 6 +++--- .../smartcasts/controlStructures/returns.dot | 2 +- .../smartcastFromArgument.dot | 10 +--------- .../smartcasts/lambdas/inPlaceLambdas.dot | 6 +++--- .../receivers/implicitReceivers.dot | 6 +++--- .../smartcasts/safeCalls/safeCalls.dot | 14 ++++++------- .../resolve/smartcasts/smartcastToNothing.dot | 2 +- .../contracts/callsInPlace.dot | 20 +++++++++---------- .../contracts/conditionalEffects.dot | 14 ++++++------- .../delegates/delegateWithAnonymousObject.dot | 12 +++++------ .../smartcasts/tryWithLambdaInside.dot | 4 ++-- .../org/jetbrains/kotlin/fir/FirRenderer.kt | 14 +++++++++---- 23 files changed, 81 insertions(+), 81 deletions(-) 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 c20015db3bb..8247beca432 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 @@ -132,6 +132,8 @@ class FirControlFlowGraphRenderVisitor( } } +private object CfgRenderMode : FirRenderer.RenderMode(renderLambdaBodies = false, renderCallArguments = false) + private fun CFGNode<*>.render(): String = buildString { append( @@ -157,26 +159,26 @@ private fun CFGNode<*>.render(): String = is LoopConditionExitNode -> "Exit loop condition" is LoopExitNode -> "Exit ${fir.type()}loop" - is QualifiedAccessNode -> "Access variable ${fir.calleeReference.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}" + is QualifiedAccessNode -> "Access variable ${fir.calleeReference.render(CfgRenderMode)}" is OperatorCallNode -> "Operator ${fir.operation.operator}" is ComparisonExpressionNode -> "Comparison ${fir.operation.operator}" - is TypeOperatorCallNode -> "Type operator: \"${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}\"" + is TypeOperatorCallNode -> "Type operator: \"${fir.render(CfgRenderMode)}\"" is JumpNode -> "Jump: ${fir.render()}" is StubNode -> "Stub" - is CheckNotNullCallNode -> "Check not null: ${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}" + is CheckNotNullCallNode -> "Check not null: ${fir.render(CfgRenderMode)}" is ConstExpressionNode -> "Const: ${fir.render()}" is VariableDeclarationNode -> "Variable declaration: ${buildString { FirRenderer( this, - FirRenderer.RenderMode.DontRenderLambdaBodies + CfgRenderMode ).visitCallableDeclaration(fir) }}" - is VariableAssignmentNode -> "Assignmenet: ${fir.lValue.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}" - is FunctionCallNode -> "Function call: ${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}" - is ThrowExceptionNode -> "Throw: ${fir.render(FirRenderer.RenderMode.DontRenderLambdaBodies)}" + is VariableAssignmentNode -> "Assignmenet: ${fir.lValue.render(CfgRenderMode)}" + is FunctionCallNode -> "Function call: ${fir.render(CfgRenderMode)}" + is ThrowExceptionNode -> "Throw: ${fir.render(CfgRenderMode)}" is TryExpressionEnterNode -> "Try expression enter" is TryMainBlockEnterNode -> "Try main block enter" diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.dot b/compiler/fir/resolve/testData/resolve/cfg/complex.dot index b29a3b17c42..56d68612d84 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.dot @@ -72,7 +72,7 @@ digraph complex_kt { 27 [label="Enter block"]; 28 [label="Access variable R|/cause|"]; 29 [label="Access variable R|/closeException|"]; - 30 [label="Function call: R|/cause|.R|/addSuppressed|(R|/closeException|)"]; + 30 [label="Function call: R|/cause|.R|/addSuppressed|(...)"]; 31 [label="Exit block"]; } 32 [label="Catch exit"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot index 314c20949a4..c4f0d152b82 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot @@ -343,7 +343,7 @@ digraph jumps_kt { 117 [label="Exit function anonymousFunction"]; } 118 [label="Postponed exit from lambda"]; - 119 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| )"]; + 119 [label="Function call: R|/run|(...)"]; 120 [label="Exit function test_6" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/lambdaAsReturnOfLambda.dot b/compiler/fir/resolve/testData/resolve/cfg/lambdaAsReturnOfLambda.dot index 907950d521d..6f396847070 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/lambdaAsReturnOfLambda.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/lambdaAsReturnOfLambda.dot @@ -23,7 +23,7 @@ digraph lambdaAsReturnOfLambda_kt { color=red 4 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; 5 [label="Access variable R|/foo|"]; - 6 [label="Function call: R|/bar|(R|/foo|)"]; + 6 [label="Function call: R|/bar|(...)"]; 7 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } @@ -44,7 +44,7 @@ digraph lambdaAsReturnOfLambda_kt { 10 [label="Enter property" style="filled" fillcolor=red]; 11 [label="Postponed enter to lambda"]; 12 [label="Postponed exit from lambda"]; - 13 [label="Function call: R|/run| kotlin/Unit|>( = run@fun (): R|(kotlin/String) -> kotlin/Unit|)"]; + 13 [label="Function call: R|/run| kotlin/Unit|>(...)"]; 14 [label="Exit property" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot index 13fee34480a..021c13c61ea 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot @@ -40,7 +40,7 @@ digraph lambdas_kt { 16 [label="Exit function anonymousFunction"]; } 17 [label="Postponed exit from lambda"]; - 18 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| )"]; + 18 [label="Function call: R|/run|(...)"]; 19 [label="Exit block"]; } 20 [label="Exit when branch result"]; @@ -154,7 +154,7 @@ digraph lambdas_kt { 53 [label="Exit function anonymousFunction"]; } 54 [label="Postponed exit from lambda"]; - 55 [label="Function call: R|/getInt|( = getInt@fun (): R|kotlin/Unit| )"]; + 55 [label="Function call: R|/getInt|(...)"]; 56 [label="Jump: ^test_3 R|/getInt|( = getInt@fun (): R|kotlin/Unit| { ^test_3 Int(1) } @@ -192,7 +192,7 @@ digraph lambdas_kt { 65 [label="Exit function anonymousFunction"]; } 66 [label="Postponed exit from lambda"]; - 67 [label="Function call: R|/getInt|(block = getInt@fun (): R|kotlin/Unit| )"]; + 67 [label="Function call: R|/getInt|(...)"]; 68 [label="Jump: ^test_4 R|/getInt|(block = getInt@fun (): R|kotlin/Unit| { ^test_4 Int(1) } diff --git a/compiler/fir/resolve/testData/resolve/cfg/loops.dot b/compiler/fir/resolve/testData/resolve/cfg/loops.dot index 2046410a83f..a2cd4892335 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/loops.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/loops.dot @@ -104,8 +104,8 @@ digraph loops_kt { 32 [label="Enter function testFor" style="filled" fillcolor=red]; 33 [label="Const: Int(0)"]; 34 [label="Const: Int(5)"]; - 35 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(Int(5))"]; - 36 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(Int(5)).R|kotlin/ranges/IntProgression.iterator|()"]; + 35 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)"]; + 36 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()"]; 37 [label="Variable declaration: lval : R|kotlin/collections/IntIterator|"]; subgraph cluster_11 { color=blue diff --git a/compiler/fir/resolve/testData/resolve/cfg/postponedLambdas.dot b/compiler/fir/resolve/testData/resolve/cfg/postponedLambdas.dot index 034e2c5853c..6bada39bebc 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/postponedLambdas.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/postponedLambdas.dot @@ -24,7 +24,7 @@ digraph postponedLambdas_kt { } 8 [label="Postponed exit from lambda"]; 9 [label="Access variable R|/b|"]; - 10 [label="Function call: R|/foo|(vararg(R|/a|, foo@fun (): R|kotlin/String| , R|/b|))"]; + 10 [label="Function call: R|/foo|(...)"]; 11 [label="Exit function test" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot b/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot index f95d2c345ce..b4027c688a4 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot @@ -73,7 +73,7 @@ digraph propertiesAndInitBlocks_kt { 20 [label="Enter function foo" style="filled" fillcolor=red]; 21 [label="Const: Int(1)"]; 22 [label="Const: Int(1)"]; - 23 [label="Function call: Int(1).R|kotlin/Int.plus|(Int(1))"]; + 23 [label="Function call: Int(1).R|kotlin/Int.plus|(...)"]; 24 [label="Variable declaration: lval c: R|kotlin/Int|"]; 25 [label="Function call: R|java/lang/Exception.Exception|()"]; 26 [label="Throw: throw R|java/lang/Exception.Exception|()"]; @@ -128,7 +128,7 @@ digraph propertiesAndInitBlocks_kt { 41 [label="Exit function anonymousFunction"]; } 42 [label="Postponed exit from lambda"]; - 43 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| )"]; + 43 [label="Function call: R|/run|(...)"]; 44 [label="Exit property" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/returnValuesFromLambda.dot b/compiler/fir/resolve/testData/resolve/cfg/returnValuesFromLambda.dot index 0402cdd9ca5..df08ff099d3 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/returnValuesFromLambda.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/returnValuesFromLambda.dot @@ -52,7 +52,7 @@ digraph returnValuesFromLambda_kt { 21 [label="Exit function anonymousFunction"]; } 22 [label="Postponed exit from lambda"]; - 23 [label="Function call: R|kotlin/run|( = run@fun (): R|A| )"]; + 23 [label="Function call: R|kotlin/run|(...)"]; 24 [label="Variable declaration: lval x: R|A|"]; 25 [label="Exit function test_1" style="filled" fillcolor=red]; } @@ -94,7 +94,7 @@ digraph returnValuesFromLambda_kt { 32 [label="Exit function anonymousFunction"]; } 33 [label="Postponed exit from lambda"]; - 34 [label="Function call: R|kotlin/run|( = run@fun (): R|C| )"]; + 34 [label="Function call: R|kotlin/run|(...)"]; 35 [label="Variable declaration: lval x: R|C|"]; 36 [label="Exit function test_2" style="filled" fillcolor=red]; } @@ -124,7 +124,7 @@ digraph returnValuesFromLambda_kt { 42 [label="Exit function anonymousFunction" style="filled" fillcolor=gray]; } 43 [label="Postponed exit from lambda"]; - 44 [label="Function call: R|kotlin/run|( = run@fun (): R|kotlin/Nothing| )"]; + 44 [label="Function call: R|kotlin/run|(...)"]; 45 [label="Stub" style="filled" fillcolor=gray]; 46 [label="Variable declaration: lval x: R|kotlin/Nothing|" style="filled" fillcolor=gray]; 47 [label="Exit function test_3" style="filled" fillcolor=red]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/simple.dot b/compiler/fir/resolve/testData/resolve/cfg/simple.dot index 96fcdc6904e..0b0073d13fc 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/simple.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/simple.dot @@ -18,7 +18,7 @@ digraph simple_kt { 4 [label="Variable declaration: lval x: R|kotlin/Int|"]; 5 [label="Access variable R|/x|"]; 6 [label="Const: Int(1)"]; - 7 [label="Function call: R|/x|.R|kotlin/Int.plus|(Int(1))"]; + 7 [label="Function call: R|/x|.R|kotlin/Int.plus|(...)"]; 8 [label="Variable declaration: lval y: R|kotlin/Int|"]; 9 [label="Function call: R|/foo|()"]; 10 [label="Exit function test" style="filled" fillcolor=red]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/when.dot b/compiler/fir/resolve/testData/resolve/cfg/when.dot index 5ea3512e3fa..a920592ffaf 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/when.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/when.dot @@ -22,7 +22,7 @@ digraph when_kt { 7 [label="Enter when branch condition "]; 8 [label="Access variable R|/x|"]; 9 [label="Const: Int(2)"]; - 10 [label="Function call: R|/x|.R|kotlin/Int.rem|(Int(2))"]; + 10 [label="Function call: R|/x|.R|kotlin/Int.rem|(...)"]; 11 [label="Const: Int(0)"]; 12 [label="Operator =="]; 13 [label="Exit when branch condition"]; @@ -32,7 +32,7 @@ digraph when_kt { 14 [label="Enter when branch condition "]; 15 [label="Const: Int(1)"]; 16 [label="Const: Int(1)"]; - 17 [label="Function call: Int(1).R|kotlin/Int.minus|(Int(1))"]; + 17 [label="Function call: Int(1).R|kotlin/Int.minus|(...)"]; 18 [label="Const: Int(0)"]; 19 [label="Operator =="]; 20 [label="Exit when branch condition"]; diff --git a/compiler/fir/resolve/testData/resolve/exhaustiveWhenAndDNNType.dot b/compiler/fir/resolve/testData/resolve/exhaustiveWhenAndDNNType.dot index 9beaa058696..c7fc59de8eb 100644 --- a/compiler/fir/resolve/testData/resolve/exhaustiveWhenAndDNNType.dot +++ b/compiler/fir/resolve/testData/resolve/exhaustiveWhenAndDNNType.dot @@ -87,7 +87,7 @@ digraph exhaustiveWhenAndDNNType_kt { } 35 [label="Variable declaration: lval b: R|B|"]; 36 [label="Access variable R|/b|"]; - 37 [label="Function call: R|/takeB|(R|/b|)"]; + 37 [label="Function call: R|/takeB|(...)"]; 38 [label="Exit function test_1" style="filled" fillcolor=red]; } @@ -164,7 +164,7 @@ digraph exhaustiveWhenAndDNNType_kt { } 64 [label="Variable declaration: lval b: R|B|"]; 65 [label="Access variable R|/b|"]; - 66 [label="Function call: R|/takeB|(R|/b|)"]; + 66 [label="Function call: R|/takeB|(...)"]; 67 [label="Exit function test_2" style="filled" fillcolor=red]; } @@ -240,7 +240,7 @@ digraph exhaustiveWhenAndDNNType_kt { } 92 [label="Variable declaration: lval b: R|B|"]; 93 [label="Access variable R|/b|"]; - 94 [label="Function call: R|/takeB|(R|/b|)"]; + 94 [label="Function call: R|/takeB|(...)"]; 95 [label="Exit function test_3" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/returns.dot b/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/returns.dot index 5df5c156d97..21ca24889da 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/returns.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/returns.dot @@ -427,7 +427,7 @@ digraph returns_kt { 161 [label="Variable declaration: lval length: R|kotlin/Int|"]; 162 [label="Postponed enter to lambda"]; 163 [label="Postponed exit from lambda"]; - 164 [label="Function call: R|/runHigherOrder|( = runHigherOrder@fun (): R|kotlin/Int|)"]; + 164 [label="Function call: R|/runHigherOrder|(...)"]; 165 [label="Exit function test_4" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot b/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot index e404400c0fe..470c51c7d6f 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.dot @@ -72,15 +72,7 @@ digraph smartcastFromArgument_kt { 30 [label="Exit when branch result" style="filled" fillcolor=gray]; 31 [label="Exit when"]; } - 32 [label="Function call: R|/takeA|(when (lval : R|A?| = (R|/a| as? R|A|)) { - ==($subj$, Null(null)) -> { - ^test Unit - } - else -> { - R|/| - } -} -)"]; + 32 [label="Function call: R|/takeA|(...)"]; 33 [label="Exit when branch condition"]; } 34 [label="Synthetic else branch"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot b/compiler/fir/resolve/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot index e633b9ad171..d800bef4058 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/lambdas/inPlaceLambdas.dot @@ -56,7 +56,7 @@ digraph inPlaceLambdas_kt { 20 [label="Exit function anonymousFunction"]; } 21 [label="Postponed exit from lambda"]; - 22 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| )"]; + 22 [label="Function call: R|/run|(...)"]; 23 [label="Exit block"]; } 24 [label="Exit when branch result"]; @@ -99,7 +99,7 @@ digraph inPlaceLambdas_kt { 32 [label="Exit function anonymousFunction"]; } 33 [label="Postponed exit from lambda"]; - 34 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| )"]; + 34 [label="Function call: R|/run|(...)"]; 35 [label="Access variable R|/x|"]; 36 [label="Function call: R|/x|.R|/B.bar|()"]; 37 [label="Exit function test_2" style="filled" fillcolor=red]; @@ -147,7 +147,7 @@ digraph inPlaceLambdas_kt { 53 [label="Exit function anonymousFunction"]; } 54 [label="Postponed exit from lambda"]; - 55 [label="Function call: R|/run|( = run@fun (): R|kotlin/Unit| )"]; + 55 [label="Function call: R|/run|(...)"]; 56 [label="Access variable R|/x|"]; 57 [label="Function call: R|/x|.R|/B.bar|()"]; 58 [label="Exit block"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.dot b/compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.dot index 347705c39f8..9c537c81e2e 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.dot @@ -215,18 +215,18 @@ digraph implicitReceivers_kt { 79 [label="Exit function anonymousFunction"]; } 80 [label="Postponed exit from lambda"]; - 81 [label="Function call: R|kotlin/with|(R|/c|, = wc@fun R|kotlin/Any|.(): R|kotlin/Unit| )"]; + 81 [label="Function call: R|kotlin/with|(...)"]; 82 [label="Access variable this@R|special/anonymous|"]; 83 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; 84 [label="Function call: this@R|special/anonymous|.R|/A.foo|()"]; 85 [label="Exit function anonymousFunction"]; } 86 [label="Postponed exit from lambda"]; - 87 [label="Function call: R|kotlin/with|(R|/b|, = wb@fun R|kotlin/Any|.(): R|kotlin/Unit| )"]; + 87 [label="Function call: R|kotlin/with|(...)"]; 88 [label="Exit function anonymousFunction"]; } 89 [label="Postponed exit from lambda"]; - 90 [label="Function call: R|kotlin/with|(R|/a|, = wa@fun R|kotlin/Any|.(): R|kotlin/Unit| )"]; + 90 [label="Function call: R|kotlin/with|(...)"]; 91 [label="Exit function test_3" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCalls.dot b/compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCalls.dot index 62e2b62227c..debbaddf34b 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCalls.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/safeCalls/safeCalls.dot @@ -35,7 +35,7 @@ digraph safeCalls_kt { 11 [label="Access variable R|kotlin/String.length|"]; 12 [label="Const: Int(1)"]; 13 [label="Operator =="]; - 14 [label="Function call: R|/x|?.R|/foo|(==(R|/x|.R|kotlin/String.length|, Int(1)))"]; + 14 [label="Function call: R|/x|?.R|/foo|(...)"]; 15 [label="Exit safe call"]; 16 [label="Access variable R|/x|"]; 17 [label="Access variable #"]; @@ -85,7 +85,7 @@ digraph safeCalls_kt { 27 [label="Type operator: (R|/x| as? R|A|)"]; 28 [label="Enter safe call"]; 29 [label="Access variable R|/x|"]; - 30 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(R|/x|)"]; + 30 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(...)"]; 31 [label="Exit safe call"]; 32 [label="Exit function test_2" style="filled" fillcolor=red]; } @@ -105,17 +105,17 @@ digraph safeCalls_kt { 35 [label="Type operator: (R|/x| as? R|A|)"]; 36 [label="Enter safe call"]; 37 [label="Access variable R|/x|"]; - 38 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(R|/x|)"]; + 38 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(...)"]; 39 [label="Exit safe call"]; 40 [label="Enter safe call"]; 41 [label="Access variable R|/x|"]; 42 [label="Function call: R|/x|.R|/A.bool|()"]; - 43 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(R|/x|)?.R|/foo|(R|/x|.R|/A.bool|())"]; + 43 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(...)?.R|/foo|(...)"]; 44 [label="Exit safe call"]; 45 [label="Enter safe call"]; 46 [label="Postponed enter to lambda"]; 47 [label="Postponed exit from lambda"]; - 48 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(R|/x|)?.R|/foo|(R|/x|.R|/A.bool|())?.R|/let|( = let@fun (): R|kotlin/Unit|)"]; + 48 [label="Function call: (R|/x| as? R|A|)?.R|/A.bar|(...)?.R|/foo|(...)?.R|/let|(...)"]; 49 [label="Exit safe call"]; 50 [label="Access variable R|/x|"]; 51 [label="Function call: R|/x|.#()"]; @@ -202,12 +202,12 @@ digraph safeCalls_kt { 77 [label="Exit function anonymousFunction" style="filled" fillcolor=gray]; } 78 [label="Postponed exit from lambda"]; - 79 [label="Function call: R|/x|?.R|kotlin/let|( = let@fun (it: R|A|): R|kotlin/Nothing| )"]; + 79 [label="Function call: R|/x|?.R|kotlin/let|(...)"]; 80 [label="Exit safe call"]; 81 [label="Enter safe call"]; 82 [label="Access variable R|/x|"]; 83 [label="Function call: R|/x|.R|/A.bool|()"]; - 84 [label="Function call: R|/x|?.R|kotlin/let|( = let@fun (it: R|A|): R|kotlin/Nothing| )?.R|/boo|(R|/x|.R|/A.bool|())"]; + 84 [label="Function call: R|/x|?.R|kotlin/let|(...)?.R|/boo|(...)"]; 85 [label="Exit safe call"]; 86 [label="Access variable R|/x|"]; 87 [label="Function call: R|/x|.#()"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/smartcastToNothing.dot b/compiler/fir/resolve/testData/resolve/smartcasts/smartcastToNothing.dot index 22a49c71ac6..c8a2765b083 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/smartcastToNothing.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/smartcastToNothing.dot @@ -215,7 +215,7 @@ digraph smartcastToNothing_kt { 87 [label="Exit function anonymousFunction"]; } 88 [label="Postponed exit from lambda"]; - 89 [label="Function call: R|/s|?.R|kotlin/let|( = let@fun (it: R|A|): R|kotlin/Int| )"]; + 89 [label="Function call: R|/s|?.R|kotlin/let|(...)"]; 90 [label="Exit safe call"]; 91 [label="Exit function test_0" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/contracts/callsInPlace.dot b/compiler/fir/resolve/testData/resolveWithStdlib/contracts/callsInPlace.dot index 85360b862b7..9e6121337f4 100644 --- a/compiler/fir/resolve/testData/resolveWithStdlib/contracts/callsInPlace.dot +++ b/compiler/fir/resolve/testData/resolveWithStdlib/contracts/callsInPlace.dot @@ -16,7 +16,7 @@ digraph callsInPlace_kt { 6 [label="Exit function anonymousFunction"]; } 7 [label="Postponed exit from lambda"]; - 8 [label="Function call: R|kotlin/run|( = run@fun (): R|kotlin/Unit| )"]; + 8 [label="Function call: R|kotlin/run|(...)"]; 9 [label="Access variable R|/x|"]; 10 [label="Function call: R|/x|.R|kotlin/Int.inc|()"]; 11 [label="Exit function test" style="filled" fillcolor=red]; @@ -47,7 +47,7 @@ digraph callsInPlace_kt { 17 [label="Exit function anonymousFunction"]; } 18 [label="Postponed exit from lambda"]; - 19 [label="Function call: R|kotlin/repeat|(Int(10), = repeat@fun (it: R|kotlin/Int|): R|kotlin/Unit| )"]; + 19 [label="Function call: R|kotlin/repeat|(...)"]; 20 [label="Exit function test_2" style="filled" fillcolor=red]; } @@ -74,7 +74,7 @@ digraph callsInPlace_kt { } 26 [label="Postponed exit from lambda"]; 27 [label="Const: Int(10)"]; - 28 [label="Function call: R|kotlin/repeat|(action = repeat@fun (it: R|kotlin/Int|): R|kotlin/Unit| , times = Int(10))"]; + 28 [label="Function call: R|kotlin/repeat|(...)"]; 29 [label="Exit function test_3" style="filled" fillcolor=red]; } @@ -100,12 +100,12 @@ digraph callsInPlace_kt { 34 [label="Const: String(test_4)"]; 35 [label="Access variable R|/it|"]; 36 [label="Const: Int(0)"]; - 37 [label="Function call: R|/it|.R|kotlin/Int.compareTo|(Int(0))"]; + 37 [label="Function call: R|/it|.R|kotlin/Int.compareTo|(...)"]; 38 [label="Comparison >"]; 39 [label="Exit function anonymousFunction"]; } 40 [label="Postponed exit from lambda"]; - 41 [label="Function call: Int(1).R|kotlin/takeUnless|( = takeUnless@fun (it: R|kotlin/Int|): R|kotlin/Boolean| )"]; + 41 [label="Function call: Int(1).R|kotlin/takeUnless|(...)"]; 42 [label="Exit function test_4" style="filled" fillcolor=red]; } @@ -134,12 +134,12 @@ digraph callsInPlace_kt { 47 [label="Const: String(test_5)"]; 48 [label="Access variable R|/it|"]; 49 [label="Const: Int(0)"]; - 50 [label="Function call: R|/it|.R|kotlin/Int.compareTo|(Int(0))"]; + 50 [label="Function call: R|/it|.R|kotlin/Int.compareTo|(...)"]; 51 [label="Comparison >"]; 52 [label="Exit function anonymousFunction"]; } 53 [label="Postponed exit from lambda"]; - 54 [label="Function call: Int(1).R|kotlin/takeUnless|(predicate = takeUnless@fun (it: R|kotlin/Int|): R|kotlin/Boolean| )"]; + 54 [label="Function call: Int(1).R|kotlin/takeUnless|(...)"]; 55 [label="Exit function test_5" style="filled" fillcolor=red]; } @@ -188,7 +188,7 @@ digraph callsInPlace_kt { 69 [label="Exit function anonymousFunction"]; } 70 [label="Postponed exit from lambda"]; - 71 [label="Function call: R|/myRun|(myRun@fun (): R|kotlin/Unit| , = myRun@fun (): R|kotlin/Unit| )"]; + 71 [label="Function call: R|/myRun|(...)"]; 72 [label="Exit function test_6" style="filled" fillcolor=red]; } @@ -228,7 +228,7 @@ digraph callsInPlace_kt { 82 [label="Exit function anonymousFunction"]; } 83 [label="Postponed exit from lambda"]; - 84 [label="Function call: R|/myRun|(block2 = myRun@fun (): R|kotlin/Unit| , block1 = myRun@fun (): R|kotlin/Unit| )"]; + 84 [label="Function call: R|/myRun|(...)"]; 85 [label="Exit function test_7" style="filled" fillcolor=red]; } @@ -264,7 +264,7 @@ digraph callsInPlace_kt { 89 [label="Enter function test_8" style="filled" fillcolor=red]; 90 [label="Postponed enter to lambda"]; 91 [label="Postponed exit from lambda"]; - 92 [label="Function call: R|/myDummyRun|( = myDummyRun@fun (): R|kotlin/Unit|)"]; + 92 [label="Function call: R|/myDummyRun|(...)"]; 93 [label="Exit function test_8" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/contracts/conditionalEffects.dot b/compiler/fir/resolve/testData/resolveWithStdlib/contracts/conditionalEffects.dot index d14a1e32316..0f7ef7cbfbe 100644 --- a/compiler/fir/resolve/testData/resolveWithStdlib/contracts/conditionalEffects.dot +++ b/compiler/fir/resolve/testData/resolveWithStdlib/contracts/conditionalEffects.dot @@ -8,7 +8,7 @@ digraph conditionalEffects_kt { 0 [label="Enter function test_1" style="filled" fillcolor=red]; 1 [label="Access variable R|/x|"]; 2 [label="Type operator: (R|/x| is R|kotlin/Int|)"]; - 3 [label="Function call: R|kotlin/require|((R|/x| is R|kotlin/Int|))"]; + 3 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_1 { color=blue 4 [label="Enter contract"]; @@ -36,7 +36,7 @@ digraph conditionalEffects_kt { color=red 11 [label="Enter function test_2" style="filled" fillcolor=red]; 12 [label="Access variable R|/x|"]; - 13 [label="Function call: R|kotlin/requireNotNull|(R|/x|)"]; + 13 [label="Function call: R|kotlin/requireNotNull|(...)"]; subgraph cluster_3 { color=blue 14 [label="Enter contract"]; @@ -67,7 +67,7 @@ digraph conditionalEffects_kt { 23 [label="Access variable R|/x|"]; 24 [label="Const: Null(null)"]; 25 [label="Operator !="]; - 26 [label="Function call: R|kotlin/require|(!=(R|/x|, Null(null)))"]; + 26 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_5 { color=blue 27 [label="Enter contract"]; @@ -109,7 +109,7 @@ digraph conditionalEffects_kt { 43 [label="Operator !="]; 44 [label="Exit &&"]; } - 45 [label="Function call: R|kotlin/require|((R|/x| is R|kotlin/String|) && !=(R|/y|, Null(null)))"]; + 45 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_8 { color=blue 46 [label="Enter contract"]; @@ -193,7 +193,7 @@ digraph conditionalEffects_kt { 76 [label="Enter block"]; 77 [label="Access variable R|/x|"]; 78 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 79 [label="Function call: R|kotlin/require|((R|/x| is R|kotlin/String|))"]; + 79 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_16 { color=blue 80 [label="Enter contract"]; @@ -266,7 +266,7 @@ digraph conditionalEffects_kt { 100 [label="Enter block"]; 101 [label="Access variable R|/x|"]; 102 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 103 [label="Function call: R|kotlin/require|((R|/x| is R|kotlin/String|))"]; + 103 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_22 { color=blue 104 [label="Enter contract"]; @@ -285,7 +285,7 @@ digraph conditionalEffects_kt { 113 [label="Enter block"]; 114 [label="Access variable R|/x|"]; 115 [label="Type operator: (R|/x| is R|kotlin/String|)"]; - 116 [label="Function call: R|kotlin/require|((R|/x| is R|kotlin/String|))"]; + 116 [label="Function call: R|kotlin/require|(...)"]; subgraph cluster_24 { color=blue 117 [label="Enter contract"]; diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot b/compiler/fir/resolve/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot index 75e3d8b1c35..1961f1325da 100644 --- a/compiler/fir/resolve/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot +++ b/compiler/fir/resolve/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.dot @@ -90,7 +90,7 @@ digraph delegateWithAnonymousObject_kt { 24 [label="Enter function setValue" style="filled" fillcolor=red]; 25 [label="Function call: R|/IssueListView.IssueListView|()"]; 26 [label="Access variable R|/value|"]; - 27 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|/value|)"]; + 27 [label="Function call: R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(...)"]; 28 [label="Jump: ^setValue R|/IssueListView.IssueListView|().R|/IssueListView.updateFrom|(R|/value|)"]; 29 [label="Stub" style="filled" fillcolor=gray]; 30 [label="Exit function setValue" style="filled" fillcolor=red]; @@ -109,7 +109,7 @@ digraph delegateWithAnonymousObject_kt { 31 [label="Enter function getter" style="filled" fillcolor=red]; 32 [label="Access variable D|/IssuesListUserProfile.issueListView|"]; 33 [label="Access variable this@R|/IssuesListUserProfile|"]; - 34 [label="Function call: D|/IssuesListUserProfile.issueListView|.R|FakeOverride|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"]; + 34 [label="Function call: D|/IssuesListUserProfile.issueListView|.R|FakeOverride|(...)"]; 35 [label="Jump: ^ D|/IssuesListUserProfile.issueListView|.R|FakeOverride|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"]; 36 [label="Stub" style="filled" fillcolor=gray]; 37 [label="Exit function getter" style="filled" fillcolor=red]; @@ -129,7 +129,7 @@ digraph delegateWithAnonymousObject_kt { 39 [label="Access variable D|/IssuesListUserProfile.issueListView|"]; 40 [label="Access variable this@R|/IssuesListUserProfile|"]; 41 [label="Access variable R|/issueListView|"]; - 42 [label="Function call: D|/IssuesListUserProfile.issueListView|.R|FakeOverride|(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|, R|/issueListView|)"]; + 42 [label="Function call: D|/IssuesListUserProfile.issueListView|.R|FakeOverride|(...)"]; 43 [label="Exit function setter" style="filled" fillcolor=red]; } @@ -144,14 +144,14 @@ digraph delegateWithAnonymousObject_kt { 44 [label="Enter property" style="filled" fillcolor=red]; 45 [label="Postponed enter to lambda"]; 46 [label="Postponed exit from lambda"]; - 47 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|( = delegate@fun (): R|kotlin/properties/ReadWriteProperty|)"]; + 47 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...)"]; 48 [label="Access variable this@R|/IssuesListUserProfile|"]; 49 [label="Access variable this@R|/IssuesListUserProfile|"]; 50 [label="Access variable this@R|/IssuesListUserProfile|"]; - 51 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|( = delegate@fun (): R|kotlin/properties/ReadWriteProperty|).#(this@R|/IssuesListUserProfile|, ::R|/IssuesListUserProfile.issueListView|)"]; + 51 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...).#(...)"]; 52 [label="Postponed enter to lambda"]; 53 [label="Postponed exit from lambda"]; - 54 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|( = delegate@fun (): R|kotlin/properties/ReadWriteProperty|)"]; + 54 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|(...)"]; 55 [label="Exit property" style="filled" fillcolor=red]; } diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.dot b/compiler/fir/resolve/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.dot index 9fa1c223b3c..4827f1c9054 100644 --- a/compiler/fir/resolve/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.dot +++ b/compiler/fir/resolve/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.dot @@ -47,7 +47,7 @@ digraph tryWithLambdaInside_kt { 15 [label="Exit function anonymousFunction"]; } 16 [label="Postponed exit from lambda"]; - 17 [label="Function call: R|/list|.R|kotlin/collections/filter|( = filter@fun (it: R|kotlin/Boolean|): R|kotlin/Boolean| )"]; + 17 [label="Function call: R|/list|.R|kotlin/collections/filter|(...)"]; 18 [label="Exit block"]; } 19 [label="Try main block exit"]; @@ -116,7 +116,7 @@ finally { 32 [label="Access variable R|/list|"]; 33 [label="Postponed enter to lambda"]; 34 [label="Postponed exit from lambda"]; - 35 [label="Function call: R|/list|.R|/notInPlaceFilter|( = notInPlaceFilter@fun (it: R|kotlin/Boolean|): R|kotlin/Boolean|)"]; + 35 [label="Function call: R|/list|.R|/notInPlaceFilter|(...)"]; 36 [label="Exit block"]; } 37 [label="Try main block exit"]; diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt index 4ed8b7dbac6..81bd3f9aa1f 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt @@ -42,8 +42,8 @@ fun FirElement.render(mode: FirRenderer.RenderMode = FirRenderer.RenderMode.Norm buildString { this@render.accept(FirRenderer(this, mode)) } class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderMode.Normal) : FirVisitorVoid() { - enum class RenderMode { - Normal, DontRenderLambdaBodies + abstract class RenderMode(val renderLambdaBodies: Boolean, val renderCallArguments: Boolean) { + object Normal : RenderMode(renderLambdaBodies = true, renderCallArguments = true) } private val printer = Printer(builder) @@ -427,7 +427,7 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM if (anonymousFunction.invocationKind != null) { print(" ") } - if (mode != RenderMode.DontRenderLambdaBodies) { + if (mode.renderLambdaBodies) { anonymousFunction.body?.renderBody() } } @@ -677,7 +677,13 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM override fun visitCall(call: FirCall) { print("(") - call.arguments.renderSeparated() + if (mode.renderCallArguments) { + call.arguments.renderSeparated() + } else { + if (call.arguments.isNotEmpty()) { + print("...") + } + } print(")") }