From 59205cac1352f1708c60bc6a031bf18ec8c14074 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 28 Aug 2019 10:51:23 +0300 Subject: [PATCH] [FIR] Tests. Add orthogonal edge routing for cfg dumps --- compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot | 2 ++ .../resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/complex.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/initBlock.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/jumps.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/lambdas.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/loops.dot | 2 ++ .../resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/simple.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot | 2 ++ compiler/fir/resolve/testData/resolve/cfg/when.dot | 2 ++ .../resolve/testData/resolve/smartcasts/booleanOperators.dot | 2 ++ .../fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot | 2 ++ compiler/fir/resolve/testData/resolve/smartcasts/casts.dot | 2 ++ compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot | 2 ++ .../resolve/testData/resolve/smartcasts/equalsAndIdentity.dot | 2 ++ .../fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot | 2 ++ .../fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot | 2 ++ .../fir/resolve/testData/resolve/smartcasts/nullability.dot | 2 ++ compiler/fir/resolve/testData/resolve/smartcasts/returns.dot | 2 ++ compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot | 2 ++ compiler/fir/resolve/testData/resolve/smartcasts/when.dot | 2 ++ .../org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt | 2 ++ 23 files changed, 46 insertions(+) diff --git a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot index 7fea088dedf..e075ccfc50c 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/binaryOperations.dot @@ -1,4 +1,6 @@ digraph binaryOperations_kt { +graph [splines=ortho] + subgraph test_1 { 0 [shape=box label="Enter function test_1"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot index bcf4b4b593c..d59ed88cc37 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/booleanOperatorsWithConsts.dot @@ -1,4 +1,6 @@ digraph booleanOperatorsWithConsts_kt { +graph [splines=ortho] + subgraph test_1 { 0 [shape=box label="Enter function test_1"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.dot b/compiler/fir/resolve/testData/resolve/cfg/complex.dot index e1ed1f663e8..b94c93f4888 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.dot @@ -1,4 +1,6 @@ digraph complex_kt { +graph [splines=ortho] + subgraph fetchPluginReleaseDate { 0 [shape=box label="Enter function fetchPluginReleaseDate"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot b/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot index 5ca8190728c..e88c7ea4110 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/initBlock.dot @@ -1,4 +1,6 @@ digraph initBlock_kt { +graph [splines=ortho] + subgraph { 0 [shape=box label="Enter function "]; 1 [shape=box label="Exit function "]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot index 097c59e714c..b48a721f457 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/jumps.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/jumps.dot @@ -1,4 +1,6 @@ digraph jumps_kt { +graph [splines=ortho] + subgraph test_1 { 0 [shape=box label="Enter function test_1"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot index 1ef4de5b134..a176169badd 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/lambdas.dot @@ -1,4 +1,6 @@ digraph lambdas_kt { +graph [splines=ortho] + subgraph run { 0 [shape=box label="Enter function run"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/loops.dot b/compiler/fir/resolve/testData/resolve/cfg/loops.dot index 01083fbb028..2c00a6a8439 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/loops.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/loops.dot @@ -1,4 +1,6 @@ digraph loops_kt { +graph [splines=ortho] + subgraph testWhile { 0 [shape=box label="Enter function testWhile"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot b/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot index 9781dad7df5..3df4ade76a9 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/propertiesAndInitBlocks.dot @@ -1,4 +1,6 @@ digraph propertiesAndInitBlocks_kt { +graph [splines=ortho] + subgraph run { 0 [shape=box label="Enter function run"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/simple.dot b/compiler/fir/resolve/testData/resolve/cfg/simple.dot index a2ce1eefec7..089d912a8db 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/simple.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/simple.dot @@ -1,4 +1,6 @@ digraph simple_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot index e4511921d9f..f218dc83b25 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/tryCatch.dot @@ -1,4 +1,6 @@ digraph tryCatch_kt { +graph [splines=ortho] + subgraph test_1 { 0 [shape=box label="Enter function test_1"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/cfg/when.dot b/compiler/fir/resolve/testData/resolve/cfg/when.dot index 9ddee9505b2..bb1d94798f3 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/when.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/when.dot @@ -1,4 +1,6 @@ digraph when_kt { +graph [splines=ortho] + subgraph test_1 { 0 [shape=box label="Enter function test_1"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot index 7de232c8a2e..8c851faacca 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/booleanOperators.dot @@ -1,4 +1,6 @@ digraph booleanOperators_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot index 5b1ee533d32..19802381db6 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/boundSmartcasts.dot @@ -1,4 +1,6 @@ digraph boundSmartcasts_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot b/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot index e6eebd5e0a4..f216406466a 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/casts.dot @@ -1,4 +1,6 @@ digraph casts_kt { +graph [splines=ortho] + subgraph test_1 { 0 [shape=box label="Enter function test_1"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot index fd65318b582..7ce69a7bb45 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/elvis.dot @@ -1,4 +1,6 @@ digraph elvis_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot index 8e0be6a0f66..789e5a92e62 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/equalsAndIdentity.dot @@ -1,4 +1,6 @@ digraph equalsAndIdentity_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot b/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot index 7cd2da2c0a2..acc2eeadb53 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/equalsToBoolean.dot @@ -1,4 +1,6 @@ digraph equalsToBoolean_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot index cd3eff80c1a..86e5a6f986d 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/inPlaceLambdas.dot @@ -1,4 +1,6 @@ digraph inPlaceLambdas_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot index 93fb2c41321..6c8516e9b4a 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/nullability.dot @@ -1,4 +1,6 @@ digraph nullability_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot b/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot index b2caca4095e..8917b48bc47 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/returns.dot @@ -1,4 +1,6 @@ digraph returns_kt { +graph [splines=ortho] + subgraph test_0 { 0 [shape=box label="Enter function test_0"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot index 84c328c194d..b5f3da8b8aa 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/simpleIf.dot @@ -1,4 +1,6 @@ digraph simpleIf_kt { +graph [splines=ortho] + subgraph test_1 { 0 [shape=box label="Enter function test_1"]; 1 [shape=box label="Enter block"]; diff --git a/compiler/fir/resolve/testData/resolve/smartcasts/when.dot b/compiler/fir/resolve/testData/resolve/smartcasts/when.dot index 7a0bacee690..8bd588084b6 100644 --- a/compiler/fir/resolve/testData/resolve/smartcasts/when.dot +++ b/compiler/fir/resolve/testData/resolve/smartcasts/when.dot @@ -1,4 +1,6 @@ digraph when_kt { +graph [splines=ortho] + subgraph foo { 0 [shape=box label="Enter function foo"]; 1 [shape=box label="Exit function foo"]; diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt index b0dba9dd573..18ab3463d37 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirCfgBuildingTest.kt @@ -60,6 +60,8 @@ abstract class AbstractFirCfgBuildingTest : AbstractFirResolveTestCase() { override fun visitFile(file: FirFile) { dotBuilder.appendln("digraph ${file.name.replace(".", "_")} {") + .appendln("graph [splines=ortho]") + .appendln() super.visitFile(file) dotBuilder.appendln("}") }