diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.dot b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.dot new file mode 100644 index 00000000000..e53c22cbeab --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.dot @@ -0,0 +1,118 @@ +digraph secondaryConstructorCfg_kt { + graph [nodesep=3] + node [shape=box penwidth=2] + edge [penwidth=2] + + subgraph cluster_0 { + color=red + 0 [label="Enter function " style="filled" fillcolor=red]; + 2 [label="Delegated constructor call: super()"]; + 1 [label="Exit function " style="filled" fillcolor=red]; + } + 0 -> {2}; + 2 -> {1}; + + subgraph cluster_1 { + color=red + 20 [label="Enter function " style="filled" fillcolor=red]; + 22 [label="Access variable R|/p0|"]; + 23 [label="Delegated constructor call: this(...)"]; + subgraph cluster_2 { + color=blue + 24 [label="Enter block"]; + 25 [label="Access variable R|/p1|"]; + 26 [label="Assignment: R|/B.p3|"]; + 27 [label="Exit block"]; + } + 21 [label="Exit function " style="filled" fillcolor=red style="filled" fillcolor=gray]; + } + 20 -> {22}; + 22 -> {23}; + 23 -> {24}; + 24 -> {25}; + 25 -> {26}; + 26 -> {27}; + + subgraph cluster_3 { + color=red + 37 [label="Enter class B" style="filled" fillcolor=red]; + subgraph cluster_4 { + color=blue + 16 [label="Enter function setter" style="filled" fillcolor=red]; + 17 [label="Exit function setter" style="filled" fillcolor=red]; + } + subgraph cluster_5 { + color=blue + 14 [label="Enter function getter" style="filled" fillcolor=red]; + 15 [label="Exit function getter" style="filled" fillcolor=red]; + } + subgraph cluster_6 { + color=blue + 8 [label="Enter function getter" style="filled" fillcolor=red]; + 9 [label="Exit function getter" style="filled" fillcolor=red]; + } + subgraph cluster_7 { + color=blue + 3 [label="Enter function getter" style="filled" fillcolor=red]; + 4 [label="Exit function getter" style="filled" fillcolor=red]; + } + subgraph cluster_8 { + color=blue + 5 [label="Enter property" style="filled" fillcolor=red]; + 7 [label="Access variable R|/p0|"]; + 6 [label="Exit property" style="filled" fillcolor=red]; + } + subgraph cluster_9 { + color=blue + 10 [label="Enter property" style="filled" fillcolor=red]; + 12 [label="Access variable R|/p0|"]; + 13 [label="Access variable R|kotlin/String.length|"]; + 11 [label="Exit property" style="filled" fillcolor=red]; + } + subgraph cluster_10 { + color=blue + 18 [label="Enter property" style="filled" fillcolor=red]; + 19 [label="Exit property" style="filled" fillcolor=red]; + } + subgraph cluster_11 { + color=blue + 28 [label="Enter init block" style="filled" fillcolor=red]; + subgraph cluster_12 { + color=blue + 30 [label="Enter block"]; + 31 [label="Access variable R|/p0|"]; + 32 [label="Access variable R|kotlin/String.length|"]; + 33 [label="Assignment: R|/B.p1|"]; + 34 [label="Const: String()"]; + 35 [label="Assignment: R|/B.p3|"]; + 36 [label="Exit block"]; + } + 29 [label="Exit init block" style="filled" fillcolor=red]; + } + 38 [label="Exit class B" style="filled" fillcolor=red]; + } + 37 -> {5} [color=green]; + 5 -> {7}; + 6 -> {10} [color=green]; + 7 -> {6}; + 3 -> {4}; + 10 -> {12}; + 11 -> {18} [color=green]; + 12 -> {13}; + 13 -> {11}; + 8 -> {9}; + 18 -> {19}; + 19 -> {28} [color=green]; + 14 -> {15}; + 16 -> {17}; + 28 -> {30}; + 29 -> {38} [color=green]; + 30 -> {31}; + 31 -> {32}; + 32 -> {33}; + 33 -> {34}; + 34 -> {35}; + 35 -> {36}; + 36 -> {29}; + +} diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt new file mode 100644 index 00000000000..db5f72a53cd --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt @@ -0,0 +1,13 @@ +// !DUMP_CFG +class B(p0: String) { + val p1 = p0 + val p2: Int = p0.length + var p3: String + constructor(p0: String, p1: String) : this(p0) { + p3 = p1 + } + init { + p1 = p0.length + p3 = "" + } +} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.txt b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.txt new file mode 100644 index 00000000000..69ddee4ffbc --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.txt @@ -0,0 +1,27 @@ +FILE: secondaryConstructorCfg.kt + public final class B : R|kotlin/Any| { + public constructor(p0: R|kotlin/String|): R|B| { + super() + } + + public final val p1: R|kotlin/String| = R|/p0| + public get(): R|kotlin/String| + + public final val p2: R|kotlin/Int| = R|/p0|.R|kotlin/String.length| + public get(): R|kotlin/Int| + + public final var p3: R|kotlin/String| + public get(): R|kotlin/String| + public set(value: R|kotlin/String|): R|kotlin/Unit| + + public constructor(p0: R|kotlin/String|, p1: R|kotlin/String|): R|B| { + this(R|/p0|) + this@R|/B|.R|/B.p3| = R|/p1| + } + + init { + this@R|/B|.R|/B.p1| = R|/p0|.R|kotlin/String.length| + this@R|/B|.R|/B.p3| = String() + } + + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 4e204484fa4..495134e8a53 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -1693,6 +1693,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); } + + @TestMetadata("secondaryConstructorCfg.kt") + public void testSecondaryConstructorCfg() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt"); + } } @TestMetadata("compiler/fir/analysis-tests/testData/resolve/properties") diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index af18df6d98b..7f8cc01e0ae 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -1693,6 +1693,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos public void testSafeCallInvoke() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt"); } + + @TestMetadata("secondaryConstructorCfg.kt") + public void testSecondaryConstructorCfg() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt"); + } } @TestMetadata("compiler/fir/analysis-tests/testData/resolve/properties")