[FIR] finally CFG exit node jump edges should match enter node edges
Jump edge targets are maintained globally within the CFG builder and are added indiscriminately to `finally` exit nodes. This means that a `finally` exit node could have a jump edge added which doesn't match how the `finally` block was entered. Make sure edges are only added to the exit node if they also exist on the enter node. #KT-60723 Fixed
This commit is contained in:
+6
@@ -30861,6 +30861,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithJump.kt")
|
||||
public void testCastInTryWithJump() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithJump.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithoutCatch.kt")
|
||||
public void testCastInTryWithoutCatch() throws Exception {
|
||||
|
||||
+6
@@ -30861,6 +30861,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithJump.kt")
|
||||
public void testCastInTryWithJump() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithJump.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithoutCatch.kt")
|
||||
public void testCastInTryWithoutCatch() throws Exception {
|
||||
|
||||
+6
@@ -30861,6 +30861,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithJump.kt")
|
||||
public void testCastInTryWithJump() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithJump.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithoutCatch.kt")
|
||||
public void testCastInTryWithoutCatch() throws Exception {
|
||||
|
||||
+6
@@ -30975,6 +30975,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithJump.kt")
|
||||
public void testCastInTryWithJump() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithJump.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithoutCatch.kt")
|
||||
public void testCastInTryWithoutCatch() throws Exception {
|
||||
|
||||
+5
-3
@@ -981,19 +981,21 @@ class ControlFlowGraphBuilder {
|
||||
addEdge(exitNode, nextFinally, label = UncaughtExceptionPath, propagateDeadness = false)
|
||||
}
|
||||
|
||||
// Make sure only incoming edge labels are matched when exiting
|
||||
val incomingEdges = enterNode.previousNodes.map { it.edgeTo(enterNode).label }.toSet()
|
||||
val nextFinallyOrExitLevel = nextFinally?.level ?: nextExitLevel
|
||||
// /-----------v
|
||||
// f@ { try { return@f } finally { b }; c }
|
||||
// \-----^
|
||||
exitNode.addReturnEdges(exitTargetsForReturn.values, nextFinallyOrExitLevel)
|
||||
exitNode.addReturnEdges(exitTargetsForReturn.values.filter { it in incomingEdges }, nextFinallyOrExitLevel)
|
||||
// /-----------v
|
||||
// f@ while (x) { try { continue@f } finally { b }; c }
|
||||
// ^------------------------------------/
|
||||
exitNode.addReturnEdges(loopConditionEnterNodes.values, nextFinallyOrExitLevel)
|
||||
exitNode.addReturnEdges(loopConditionEnterNodes.values.filter { it in incomingEdges }, nextFinallyOrExitLevel)
|
||||
// /-----------v
|
||||
// f@ while (x) { try { break@f } finally { b }; c }
|
||||
// \-----^
|
||||
exitNode.addReturnEdges(loopExitNodes.values, nextFinallyOrExitLevel)
|
||||
exitNode.addReturnEdges(loopExitNodes.values.filter { it in incomingEdges }, nextFinallyOrExitLevel)
|
||||
return exitNode
|
||||
}
|
||||
|
||||
|
||||
+808
@@ -0,0 +1,808 @@
|
||||
digraph castInTryWithJump_fir_kt {
|
||||
graph [nodesep=3]
|
||||
node [shape=box penwidth=2]
|
||||
edge [penwidth=2]
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter class A" style="filled" fillcolor=red];
|
||||
1 [label="Exit class A" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1} [color=green];
|
||||
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
2 [label="Enter function aaa" style="filled" fillcolor=red];
|
||||
3 [label="Exit function aaa" style="filled" fillcolor=red];
|
||||
}
|
||||
2 -> {3};
|
||||
|
||||
subgraph cluster_2 {
|
||||
color=red
|
||||
4 [label="Enter class B" style="filled" fillcolor=red];
|
||||
5 [label="Exit class B" style="filled" fillcolor=red];
|
||||
}
|
||||
4 -> {5} [color=green];
|
||||
|
||||
subgraph cluster_3 {
|
||||
color=red
|
||||
6 [label="Enter function bbb" style="filled" fillcolor=red];
|
||||
7 [label="Exit function bbb" style="filled" fillcolor=red];
|
||||
}
|
||||
6 -> {7};
|
||||
|
||||
subgraph cluster_4 {
|
||||
color=red
|
||||
8 [label="Enter class C" style="filled" fillcolor=red];
|
||||
9 [label="Exit class C" style="filled" fillcolor=red];
|
||||
}
|
||||
8 -> {9} [color=green];
|
||||
|
||||
subgraph cluster_5 {
|
||||
color=red
|
||||
10 [label="Enter function ccc" style="filled" fillcolor=red];
|
||||
11 [label="Exit function ccc" style="filled" fillcolor=red];
|
||||
}
|
||||
10 -> {11};
|
||||
|
||||
subgraph cluster_6 {
|
||||
color=red
|
||||
12 [label="Enter function breakInTry_withNestedFinally" style="filled" fillcolor=red];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
13 [label="Enter block"];
|
||||
14 [label="Const: Null(null)"];
|
||||
15 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
16 [label="Enter while loop"];
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
17 [label="Enter loop condition"];
|
||||
18 [label="Const: Boolean(true)"];
|
||||
19 [label="Exit loop condition"];
|
||||
}
|
||||
subgraph cluster_10 {
|
||||
color=blue
|
||||
20 [label="Enter loop block"];
|
||||
subgraph cluster_11 {
|
||||
color=blue
|
||||
21 [label="Enter block"];
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
22 [label="Try expression enter"];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
23 [label="Try main block enter"];
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
24 [label="Enter block"];
|
||||
25 [label="Access variable R|<local>/x|"];
|
||||
26 [label="Type operator: (R|<local>/x| as R|A|)"];
|
||||
27 [label="Jump: break@@@[Boolean(true)] "];
|
||||
28 [label="Stub" style="filled" fillcolor=gray];
|
||||
29 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
30 [label="Try main block exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
31 [label="Enter finally"];
|
||||
subgraph cluster_16 {
|
||||
color=blue
|
||||
32 [label="Enter block"];
|
||||
subgraph cluster_17 {
|
||||
color=blue
|
||||
33 [label="Try expression enter"];
|
||||
subgraph cluster_18 {
|
||||
color=blue
|
||||
34 [label="Try main block enter"];
|
||||
subgraph cluster_19 {
|
||||
color=blue
|
||||
35 [label="Enter block"];
|
||||
36 [label="Access variable R|<local>/x|"];
|
||||
37 [label="Type operator: (R|<local>/x| as R|B|)"];
|
||||
38 [label="Exit block"];
|
||||
}
|
||||
39 [label="Try main block exit"];
|
||||
}
|
||||
subgraph cluster_20 {
|
||||
color=blue
|
||||
40 [label="Enter finally"];
|
||||
subgraph cluster_21 {
|
||||
color=blue
|
||||
41 [label="Enter block"];
|
||||
42 [label="Access variable R|<local>/x|"];
|
||||
43 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
44 [label="Access variable R|<local>/x|"];
|
||||
45 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
46 [label="Exit block"];
|
||||
}
|
||||
47 [label="Exit finally"];
|
||||
}
|
||||
48 [label="Try expression exit"];
|
||||
}
|
||||
49 [label="Access variable R|<local>/x|"];
|
||||
50 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
51 [label="Access variable R|<local>/x|"];
|
||||
52 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
53 [label="Exit block"];
|
||||
}
|
||||
54 [label="Exit finally"];
|
||||
}
|
||||
55 [label="Try expression exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
56 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
|
||||
57 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=gray];
|
||||
58 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
|
||||
59 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=gray];
|
||||
60 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
61 [label="Exit loop block" style="filled" fillcolor=gray];
|
||||
}
|
||||
62 [label="Exit while loop"];
|
||||
}
|
||||
63 [label="Access variable R|<local>/x|"];
|
||||
64 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
65 [label="Access variable R|<local>/x|"];
|
||||
66 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
67 [label="Exit block"];
|
||||
}
|
||||
68 [label="Exit function breakInTry_withNestedFinally" style="filled" fillcolor=red];
|
||||
}
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
19 -> {62} [style=dotted];
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
22 -> {31} [label="onUncaughtException"];
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
25 -> {31} [label="onUncaughtException"];
|
||||
26 -> {27};
|
||||
26 -> {31} [label="onUncaughtException"];
|
||||
27 -> {31} [label="break"];
|
||||
27 -> {28} [style=dotted];
|
||||
28 -> {29} [style=dotted];
|
||||
29 -> {30} [style=dotted];
|
||||
30 -> {31} [style=dotted];
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
33 -> {40} [label="onUncaughtException"];
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
36 -> {40} [label="onUncaughtException"];
|
||||
37 -> {38};
|
||||
37 -> {40} [label="onUncaughtException"];
|
||||
38 -> {39};
|
||||
39 -> {40};
|
||||
40 -> {41};
|
||||
41 -> {42};
|
||||
42 -> {43};
|
||||
43 -> {44};
|
||||
44 -> {45};
|
||||
45 -> {46};
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
48 -> {49};
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {52};
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {62} [label="break"];
|
||||
54 -> {55} [style=dotted];
|
||||
55 -> {56} [style=dotted];
|
||||
56 -> {57} [style=dotted];
|
||||
57 -> {58} [style=dotted];
|
||||
58 -> {59} [style=dotted];
|
||||
59 -> {60} [style=dotted];
|
||||
60 -> {61} [style=dotted];
|
||||
61 -> {17} [color=green style=dotted];
|
||||
62 -> {63};
|
||||
63 -> {64};
|
||||
64 -> {65};
|
||||
65 -> {66};
|
||||
66 -> {67};
|
||||
67 -> {68};
|
||||
|
||||
subgraph cluster_22 {
|
||||
color=red
|
||||
69 [label="Enter function returnInCatch" style="filled" fillcolor=red];
|
||||
subgraph cluster_23 {
|
||||
color=blue
|
||||
70 [label="Enter block"];
|
||||
71 [label="Const: Null(null)"];
|
||||
72 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
|
||||
subgraph cluster_24 {
|
||||
color=blue
|
||||
73 [label="Try expression enter"];
|
||||
subgraph cluster_25 {
|
||||
color=blue
|
||||
74 [label="Try main block enter"];
|
||||
subgraph cluster_26 {
|
||||
color=blue
|
||||
75 [label="Enter block"];
|
||||
76 [label="Access variable R|<local>/x|"];
|
||||
77 [label="Type operator: (R|<local>/x| as R|A|)"];
|
||||
78 [label="Exit block"];
|
||||
}
|
||||
79 [label="Try main block exit"];
|
||||
}
|
||||
subgraph cluster_27 {
|
||||
color=blue
|
||||
80 [label="Catch enter"];
|
||||
81 [label="Variable declaration: e: R|kotlin/Exception|"];
|
||||
subgraph cluster_28 {
|
||||
color=blue
|
||||
82 [label="Enter block"];
|
||||
83 [label="Access variable R|<local>/x|"];
|
||||
84 [label="Type operator: (R|<local>/x| as R|B|)"];
|
||||
85 [label="Jump: ^returnInCatch Unit"];
|
||||
86 [label="Stub" style="filled" fillcolor=gray];
|
||||
87 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
88 [label="Catch exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
subgraph cluster_29 {
|
||||
color=blue
|
||||
89 [label="Enter finally"];
|
||||
subgraph cluster_30 {
|
||||
color=blue
|
||||
90 [label="Enter block"];
|
||||
91 [label="Access variable R|<local>/x|"];
|
||||
92 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
93 [label="Access variable R|<local>/x|"];
|
||||
94 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
95 [label="Exit block"];
|
||||
}
|
||||
96 [label="Exit finally"];
|
||||
}
|
||||
97 [label="Try expression exit"];
|
||||
}
|
||||
98 [label="Access variable R|<local>/x|"];
|
||||
99 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
100 [label="Access variable R|<local>/x|"];
|
||||
101 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
102 [label="Exit block"];
|
||||
}
|
||||
103 [label="Exit function returnInCatch" style="filled" fillcolor=red];
|
||||
}
|
||||
69 -> {70};
|
||||
70 -> {71};
|
||||
71 -> {72};
|
||||
72 -> {73};
|
||||
73 -> {74 80};
|
||||
73 -> {89} [label="onUncaughtException"];
|
||||
74 -> {75};
|
||||
75 -> {76};
|
||||
76 -> {77 80};
|
||||
76 -> {89} [label="onUncaughtException"];
|
||||
77 -> {78 80};
|
||||
77 -> {89} [label="onUncaughtException"];
|
||||
78 -> {79};
|
||||
79 -> {80 89};
|
||||
80 -> {81};
|
||||
80 -> {89} [label="onUncaughtException"];
|
||||
81 -> {82};
|
||||
82 -> {83};
|
||||
83 -> {84};
|
||||
83 -> {89} [label="onUncaughtException"];
|
||||
84 -> {85};
|
||||
84 -> {89} [label="onUncaughtException"];
|
||||
85 -> {89} [label="return@/returnInCatch"];
|
||||
85 -> {86} [style=dotted];
|
||||
86 -> {87} [style=dotted];
|
||||
87 -> {88} [style=dotted];
|
||||
88 -> {89} [style=dotted];
|
||||
89 -> {90};
|
||||
90 -> {91};
|
||||
91 -> {92};
|
||||
92 -> {93};
|
||||
93 -> {94};
|
||||
94 -> {95};
|
||||
95 -> {96};
|
||||
96 -> {97};
|
||||
96 -> {103} [label="return@/returnInCatch"];
|
||||
97 -> {98};
|
||||
98 -> {99};
|
||||
99 -> {100};
|
||||
100 -> {101};
|
||||
101 -> {102};
|
||||
102 -> {103};
|
||||
|
||||
subgraph cluster_31 {
|
||||
color=red
|
||||
104 [label="Enter function returnInCatch_insideFinally" style="filled" fillcolor=red];
|
||||
subgraph cluster_32 {
|
||||
color=blue
|
||||
105 [label="Enter block"];
|
||||
106 [label="Const: Null(null)"];
|
||||
107 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
|
||||
subgraph cluster_33 {
|
||||
color=blue
|
||||
108 [label="Try expression enter"];
|
||||
subgraph cluster_34 {
|
||||
color=blue
|
||||
109 [label="Try main block enter"];
|
||||
subgraph cluster_35 {
|
||||
color=blue
|
||||
110 [label="Enter block"];
|
||||
111 [label="Access variable R|<local>/x|"];
|
||||
112 [label="Type operator: (R|<local>/x| as R|C|)"];
|
||||
113 [label="Exit block"];
|
||||
}
|
||||
114 [label="Try main block exit"];
|
||||
}
|
||||
subgraph cluster_36 {
|
||||
color=blue
|
||||
115 [label="Enter finally"];
|
||||
subgraph cluster_37 {
|
||||
color=blue
|
||||
116 [label="Enter block"];
|
||||
subgraph cluster_38 {
|
||||
color=blue
|
||||
117 [label="Try expression enter"];
|
||||
subgraph cluster_39 {
|
||||
color=blue
|
||||
118 [label="Try main block enter"];
|
||||
subgraph cluster_40 {
|
||||
color=blue
|
||||
119 [label="Enter block"];
|
||||
120 [label="Access variable R|<local>/x|"];
|
||||
121 [label="Type operator: (R|<local>/x| as R|A|)"];
|
||||
122 [label="Exit block"];
|
||||
}
|
||||
123 [label="Try main block exit"];
|
||||
}
|
||||
subgraph cluster_41 {
|
||||
color=blue
|
||||
124 [label="Catch enter"];
|
||||
125 [label="Variable declaration: e: R|kotlin/Exception|"];
|
||||
subgraph cluster_42 {
|
||||
color=blue
|
||||
126 [label="Enter block"];
|
||||
127 [label="Access variable R|<local>/x|"];
|
||||
128 [label="Type operator: (R|<local>/x| as R|B|)"];
|
||||
129 [label="Jump: ^returnInCatch_insideFinally Unit"];
|
||||
130 [label="Stub" style="filled" fillcolor=gray];
|
||||
131 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
132 [label="Catch exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
subgraph cluster_43 {
|
||||
color=blue
|
||||
133 [label="Enter finally"];
|
||||
subgraph cluster_44 {
|
||||
color=blue
|
||||
134 [label="Enter block"];
|
||||
135 [label="Access variable R|<local>/x|"];
|
||||
136 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
137 [label="Access variable R|<local>/x|"];
|
||||
138 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
139 [label="Access variable R|<local>/x|"];
|
||||
140 [label="Function call: R|<local>/x|.<Unresolved name: ccc>#()" style="filled" fillcolor=yellow];
|
||||
141 [label="Exit block"];
|
||||
}
|
||||
142 [label="Exit finally"];
|
||||
}
|
||||
143 [label="Try expression exit"];
|
||||
}
|
||||
144 [label="Access variable R|<local>/x|"];
|
||||
145 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
146 [label="Access variable R|<local>/x|"];
|
||||
147 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
148 [label="Access variable R|<local>/x|"];
|
||||
149 [label="Function call: R|<local>/x|.<Unresolved name: ccc>#()" style="filled" fillcolor=yellow];
|
||||
150 [label="Exit block"];
|
||||
}
|
||||
151 [label="Exit finally"];
|
||||
}
|
||||
152 [label="Try expression exit"];
|
||||
}
|
||||
153 [label="Access variable R|<local>/x|"];
|
||||
154 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
155 [label="Access variable R|<local>/x|"];
|
||||
156 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
157 [label="Access variable R|<local>/x|"];
|
||||
158 [label="Function call: R|<local>/x|.<Unresolved name: ccc>#()" style="filled" fillcolor=yellow];
|
||||
159 [label="Exit block"];
|
||||
}
|
||||
160 [label="Exit function returnInCatch_insideFinally" style="filled" fillcolor=red];
|
||||
}
|
||||
104 -> {105};
|
||||
105 -> {106};
|
||||
106 -> {107};
|
||||
107 -> {108};
|
||||
108 -> {109};
|
||||
108 -> {115} [label="onUncaughtException"];
|
||||
109 -> {110};
|
||||
110 -> {111};
|
||||
111 -> {112};
|
||||
111 -> {115} [label="onUncaughtException"];
|
||||
112 -> {113};
|
||||
112 -> {115} [label="onUncaughtException"];
|
||||
113 -> {114};
|
||||
114 -> {115};
|
||||
115 -> {116};
|
||||
116 -> {117};
|
||||
117 -> {118 124};
|
||||
117 -> {133} [label="onUncaughtException"];
|
||||
118 -> {119};
|
||||
119 -> {120};
|
||||
120 -> {121 124};
|
||||
120 -> {133} [label="onUncaughtException"];
|
||||
121 -> {122 124};
|
||||
121 -> {133} [label="onUncaughtException"];
|
||||
122 -> {123};
|
||||
123 -> {124 133};
|
||||
124 -> {125};
|
||||
124 -> {133} [label="onUncaughtException"];
|
||||
125 -> {126};
|
||||
126 -> {127};
|
||||
127 -> {128};
|
||||
127 -> {133} [label="onUncaughtException"];
|
||||
128 -> {129};
|
||||
128 -> {133} [label="onUncaughtException"];
|
||||
129 -> {133} [label="return@/returnInCatch_insideFinally"];
|
||||
129 -> {130} [style=dotted];
|
||||
130 -> {131} [style=dotted];
|
||||
131 -> {132} [style=dotted];
|
||||
132 -> {133} [style=dotted];
|
||||
133 -> {134};
|
||||
134 -> {135};
|
||||
135 -> {136};
|
||||
136 -> {137};
|
||||
137 -> {138};
|
||||
138 -> {139};
|
||||
139 -> {140};
|
||||
140 -> {141};
|
||||
141 -> {142};
|
||||
142 -> {143};
|
||||
142 -> {160} [label="return@/returnInCatch_insideFinally"];
|
||||
143 -> {144};
|
||||
144 -> {145};
|
||||
145 -> {146};
|
||||
146 -> {147};
|
||||
147 -> {148};
|
||||
148 -> {149};
|
||||
149 -> {150};
|
||||
150 -> {151};
|
||||
151 -> {152};
|
||||
152 -> {153};
|
||||
153 -> {154};
|
||||
154 -> {155};
|
||||
155 -> {156};
|
||||
156 -> {157};
|
||||
157 -> {158};
|
||||
158 -> {159};
|
||||
159 -> {160};
|
||||
|
||||
subgraph cluster_45 {
|
||||
color=red
|
||||
161 [label="Enter function breakInCatch" style="filled" fillcolor=red];
|
||||
subgraph cluster_46 {
|
||||
color=blue
|
||||
162 [label="Enter block"];
|
||||
163 [label="Const: Null(null)"];
|
||||
164 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
|
||||
subgraph cluster_47 {
|
||||
color=blue
|
||||
165 [label="Enter while loop"];
|
||||
subgraph cluster_48 {
|
||||
color=blue
|
||||
166 [label="Enter loop condition"];
|
||||
167 [label="Const: Boolean(true)"];
|
||||
168 [label="Exit loop condition"];
|
||||
}
|
||||
subgraph cluster_49 {
|
||||
color=blue
|
||||
169 [label="Enter loop block"];
|
||||
subgraph cluster_50 {
|
||||
color=blue
|
||||
170 [label="Enter block"];
|
||||
subgraph cluster_51 {
|
||||
color=blue
|
||||
171 [label="Try expression enter"];
|
||||
subgraph cluster_52 {
|
||||
color=blue
|
||||
172 [label="Try main block enter"];
|
||||
subgraph cluster_53 {
|
||||
color=blue
|
||||
173 [label="Enter block"];
|
||||
174 [label="Access variable R|<local>/x|"];
|
||||
175 [label="Type operator: (R|<local>/x| as R|A|)"];
|
||||
176 [label="Exit block"];
|
||||
}
|
||||
177 [label="Try main block exit"];
|
||||
}
|
||||
subgraph cluster_54 {
|
||||
color=blue
|
||||
178 [label="Catch enter"];
|
||||
179 [label="Variable declaration: e: R|kotlin/Exception|"];
|
||||
subgraph cluster_55 {
|
||||
color=blue
|
||||
180 [label="Enter block"];
|
||||
181 [label="Access variable R|<local>/x|"];
|
||||
182 [label="Type operator: (R|<local>/x| as R|B|)"];
|
||||
183 [label="Jump: break@@@[Boolean(true)] "];
|
||||
184 [label="Stub" style="filled" fillcolor=gray];
|
||||
185 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
186 [label="Catch exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
subgraph cluster_56 {
|
||||
color=blue
|
||||
187 [label="Enter finally"];
|
||||
subgraph cluster_57 {
|
||||
color=blue
|
||||
188 [label="Enter block"];
|
||||
189 [label="Access variable R|<local>/x|"];
|
||||
190 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
191 [label="Access variable R|<local>/x|"];
|
||||
192 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
193 [label="Exit block"];
|
||||
}
|
||||
194 [label="Exit finally"];
|
||||
}
|
||||
195 [label="Try expression exit"];
|
||||
}
|
||||
196 [label="Access variable R|<local>/x|"];
|
||||
197 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
198 [label="Access variable R|<local>/x|"];
|
||||
199 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
200 [label="Exit block"];
|
||||
}
|
||||
201 [label="Exit loop block"];
|
||||
}
|
||||
202 [label="Exit while loop"];
|
||||
}
|
||||
203 [label="Access variable R|<local>/x|"];
|
||||
204 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
205 [label="Access variable R|<local>/x|"];
|
||||
206 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
207 [label="Exit block"];
|
||||
}
|
||||
208 [label="Exit function breakInCatch" style="filled" fillcolor=red];
|
||||
}
|
||||
161 -> {162};
|
||||
162 -> {163};
|
||||
163 -> {164};
|
||||
164 -> {165};
|
||||
165 -> {166};
|
||||
166 -> {167};
|
||||
167 -> {168};
|
||||
168 -> {169};
|
||||
168 -> {202} [style=dotted];
|
||||
169 -> {170};
|
||||
170 -> {171};
|
||||
171 -> {172 178};
|
||||
171 -> {187} [label="onUncaughtException"];
|
||||
172 -> {173};
|
||||
173 -> {174};
|
||||
174 -> {175 178};
|
||||
174 -> {187} [label="onUncaughtException"];
|
||||
175 -> {176 178};
|
||||
175 -> {187} [label="onUncaughtException"];
|
||||
176 -> {177};
|
||||
177 -> {178 187};
|
||||
178 -> {179};
|
||||
178 -> {187} [label="onUncaughtException"];
|
||||
179 -> {180};
|
||||
180 -> {181};
|
||||
181 -> {182};
|
||||
181 -> {187} [label="onUncaughtException"];
|
||||
182 -> {183};
|
||||
182 -> {187} [label="onUncaughtException"];
|
||||
183 -> {187} [label="break"];
|
||||
183 -> {184} [style=dotted];
|
||||
184 -> {185} [style=dotted];
|
||||
185 -> {186} [style=dotted];
|
||||
186 -> {187} [style=dotted];
|
||||
187 -> {188};
|
||||
188 -> {189};
|
||||
189 -> {190};
|
||||
190 -> {191};
|
||||
191 -> {192};
|
||||
192 -> {193};
|
||||
193 -> {194};
|
||||
194 -> {195};
|
||||
194 -> {202} [label="break"];
|
||||
195 -> {196};
|
||||
196 -> {197};
|
||||
197 -> {198};
|
||||
198 -> {199};
|
||||
199 -> {200};
|
||||
200 -> {201};
|
||||
201 -> {166} [color=green style=dashed];
|
||||
202 -> {203};
|
||||
203 -> {204};
|
||||
204 -> {205};
|
||||
205 -> {206};
|
||||
206 -> {207};
|
||||
207 -> {208};
|
||||
|
||||
subgraph cluster_58 {
|
||||
color=red
|
||||
209 [label="Enter function returnInFinally_insideTry_nonLocal" style="filled" fillcolor=red];
|
||||
subgraph cluster_59 {
|
||||
color=blue
|
||||
210 [label="Enter block"];
|
||||
211 [label="Const: Null(null)"];
|
||||
212 [label="Variable declaration: lvar x: R|kotlin/Any?|"];
|
||||
213 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_60 {
|
||||
color=blue
|
||||
214 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_61 {
|
||||
color=blue
|
||||
215 [label="Enter block"];
|
||||
subgraph cluster_62 {
|
||||
color=blue
|
||||
216 [label="Try expression enter"];
|
||||
subgraph cluster_63 {
|
||||
color=blue
|
||||
217 [label="Try main block enter"];
|
||||
subgraph cluster_64 {
|
||||
color=blue
|
||||
218 [label="Enter block"];
|
||||
219 [label="Access variable R|<local>/x|"];
|
||||
220 [label="Type operator: (R|<local>/x| as R|B|)"];
|
||||
subgraph cluster_65 {
|
||||
color=blue
|
||||
221 [label="Try expression enter"];
|
||||
subgraph cluster_66 {
|
||||
color=blue
|
||||
222 [label="Try main block enter"];
|
||||
subgraph cluster_67 {
|
||||
color=blue
|
||||
223 [label="Enter block"];
|
||||
224 [label="Access variable R|<local>/x|"];
|
||||
225 [label="Smart cast: R|<local>/x|"];
|
||||
226 [label="Type operator: (R|<local>/x| as R|A|)"];
|
||||
227 [label="Exit block"];
|
||||
}
|
||||
228 [label="Try main block exit"];
|
||||
}
|
||||
subgraph cluster_68 {
|
||||
color=blue
|
||||
229 [label="Enter finally"];
|
||||
subgraph cluster_69 {
|
||||
color=blue
|
||||
230 [label="Enter block"];
|
||||
231 [label="Access variable R|<local>/x|"];
|
||||
232 [label="Smart cast: R|<local>/x|"];
|
||||
233 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
234 [label="Access variable R|<local>/x|"];
|
||||
235 [label="Smart cast: R|<local>/x|"];
|
||||
236 [label="Function call: R|<local>/x|.R|/B.bbb|()" style="filled" fillcolor=yellow];
|
||||
237 [label="Jump: ^returnInFinally_insideTry_nonLocal Unit"];
|
||||
238 [label="Stub" style="filled" fillcolor=gray];
|
||||
239 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
240 [label="Exit finally" style="filled" fillcolor=gray];
|
||||
}
|
||||
241 [label="Try expression exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
242 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
243 [label="Try main block exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
subgraph cluster_70 {
|
||||
color=blue
|
||||
244 [label="Enter finally"];
|
||||
subgraph cluster_71 {
|
||||
color=blue
|
||||
245 [label="Enter block"];
|
||||
246 [label="Access variable R|<local>/x|"];
|
||||
247 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=yellow];
|
||||
248 [label="Access variable R|<local>/x|"];
|
||||
249 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=yellow];
|
||||
250 [label="Exit block"];
|
||||
}
|
||||
251 [label="Exit finally"];
|
||||
}
|
||||
252 [label="Try expression exit" style="filled" fillcolor=gray];
|
||||
}
|
||||
253 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
|
||||
254 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=gray];
|
||||
255 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
|
||||
256 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=gray];
|
||||
257 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
258 [label="Exit function <anonymous>" style="filled" fillcolor=gray];
|
||||
}
|
||||
259 [label="Postponed exit from lambda" style="filled" fillcolor=gray];
|
||||
260 [label="Function call: R|kotlin/run<Inapplicable(INAPPLICABLE): kotlin/run>#|<<ERROR TYPE REF: Cannot infer argument for type parameter R>>(...)" style="filled" fillcolor=gray];
|
||||
261 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
|
||||
262 [label="Function call: R|<local>/x|.<Unresolved name: aaa>#()" style="filled" fillcolor=gray];
|
||||
263 [label="Access variable R|<local>/x|" style="filled" fillcolor=gray];
|
||||
264 [label="Function call: R|<local>/x|.<Unresolved name: bbb>#()" style="filled" fillcolor=gray];
|
||||
265 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
266 [label="Exit function returnInFinally_insideTry_nonLocal" style="filled" fillcolor=red];
|
||||
}
|
||||
209 -> {210};
|
||||
210 -> {211};
|
||||
211 -> {212};
|
||||
212 -> {213};
|
||||
213 -> {214};
|
||||
213 -> {259 260} [style=dotted];
|
||||
213 -> {214} [style=dashed];
|
||||
214 -> {215};
|
||||
215 -> {216};
|
||||
216 -> {217};
|
||||
216 -> {244} [label="onUncaughtException"];
|
||||
217 -> {218};
|
||||
218 -> {219};
|
||||
219 -> {220};
|
||||
219 -> {244} [label="onUncaughtException"];
|
||||
220 -> {221};
|
||||
220 -> {244} [label="onUncaughtException"];
|
||||
221 -> {222};
|
||||
221 -> {229} [label="onUncaughtException"];
|
||||
222 -> {223};
|
||||
223 -> {224};
|
||||
224 -> {225};
|
||||
224 -> {229} [label="onUncaughtException"];
|
||||
225 -> {226};
|
||||
226 -> {227};
|
||||
226 -> {229} [label="onUncaughtException"];
|
||||
227 -> {228};
|
||||
228 -> {229};
|
||||
229 -> {230};
|
||||
230 -> {231};
|
||||
231 -> {232};
|
||||
231 -> {244} [label="onUncaughtException"];
|
||||
232 -> {233};
|
||||
233 -> {234};
|
||||
233 -> {244} [label="onUncaughtException"];
|
||||
234 -> {235};
|
||||
234 -> {244} [label="onUncaughtException"];
|
||||
235 -> {236};
|
||||
236 -> {237};
|
||||
236 -> {244} [label="onUncaughtException"];
|
||||
237 -> {244} [label="return@/returnInFinally_insideTry_nonLocal"];
|
||||
237 -> {238} [style=dotted];
|
||||
238 -> {239} [style=dotted];
|
||||
239 -> {240} [style=dotted];
|
||||
240 -> {244} [style=dotted label="onUncaughtException"];
|
||||
240 -> {241} [style=dotted];
|
||||
241 -> {242} [style=dotted];
|
||||
242 -> {243} [style=dotted];
|
||||
243 -> {244} [style=dotted];
|
||||
244 -> {245};
|
||||
245 -> {246};
|
||||
246 -> {247};
|
||||
247 -> {248};
|
||||
248 -> {249};
|
||||
249 -> {250};
|
||||
250 -> {251};
|
||||
251 -> {266} [label="return@/returnInFinally_insideTry_nonLocal"];
|
||||
251 -> {252} [style=dotted];
|
||||
252 -> {253} [style=dotted];
|
||||
253 -> {254} [style=dotted];
|
||||
254 -> {255} [style=dotted];
|
||||
255 -> {256} [style=dotted];
|
||||
256 -> {257} [style=dotted];
|
||||
257 -> {258} [style=dotted];
|
||||
258 -> {259} [style=dotted];
|
||||
259 -> {260} [style=dotted];
|
||||
260 -> {261} [style=dotted];
|
||||
261 -> {262} [style=dotted];
|
||||
262 -> {263} [style=dotted];
|
||||
263 -> {264} [style=dotted];
|
||||
264 -> {265} [style=dotted];
|
||||
265 -> {266} [style=dotted];
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
// DUMP_CFG
|
||||
|
||||
interface A {
|
||||
fun aaa()
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun bbb()
|
||||
}
|
||||
|
||||
interface C {
|
||||
fun ccc()
|
||||
}
|
||||
|
||||
fun breakInTry_withNestedFinally() {
|
||||
var x: Any? = null
|
||||
while (true) {
|
||||
try {
|
||||
x as A
|
||||
break
|
||||
} finally {
|
||||
try {
|
||||
x as B
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be ok
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be ok
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be ok
|
||||
}
|
||||
|
||||
fun returnInCatch() {
|
||||
var x: Any? = null
|
||||
try {
|
||||
x as A
|
||||
} catch (e: Exception) {
|
||||
x as B
|
||||
return
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
|
||||
fun returnInCatch_insideFinally() {
|
||||
var x: Any? = null
|
||||
try {
|
||||
x as C
|
||||
} finally {
|
||||
try {
|
||||
x as A
|
||||
} catch (e: Exception) {
|
||||
x as B
|
||||
return
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>ccc<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>ccc<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>ccc<!>() // should be ok
|
||||
}
|
||||
|
||||
fun breakInCatch() {
|
||||
var x: Any? = null
|
||||
while (true) {
|
||||
try {
|
||||
x as A
|
||||
} catch (e: Exception) {
|
||||
x as B
|
||||
break
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be ok
|
||||
}
|
||||
|
||||
fun returnInFinally_insideTry_nonLocal() {
|
||||
var x: Any? = null
|
||||
run {
|
||||
try {
|
||||
x as B
|
||||
try {
|
||||
x as A
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.bbb() // should be ok
|
||||
return
|
||||
}
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
// DUMP_CFG
|
||||
|
||||
interface A {
|
||||
fun aaa()
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun bbb()
|
||||
}
|
||||
|
||||
interface C {
|
||||
fun ccc()
|
||||
}
|
||||
|
||||
fun breakInTry_withNestedFinally() {
|
||||
var x: Any? = null
|
||||
while (true) {
|
||||
try {
|
||||
x as A
|
||||
break
|
||||
} finally {
|
||||
try {
|
||||
x as B
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be ok
|
||||
}
|
||||
<!UNREACHABLE_CODE!>x.<!UNRESOLVED_REFERENCE!>aaa<!>()<!> // should be error
|
||||
<!UNREACHABLE_CODE!>x.<!UNRESOLVED_REFERENCE!>bbb<!>()<!> // should be ok
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be ok
|
||||
}
|
||||
|
||||
fun returnInCatch() {
|
||||
var x: Any? = null
|
||||
try {
|
||||
x as A
|
||||
} catch (e: Exception) {
|
||||
x as B
|
||||
return
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
|
||||
fun returnInCatch_insideFinally() {
|
||||
var x: Any? = null
|
||||
try {
|
||||
x as C
|
||||
} finally {
|
||||
try {
|
||||
x as A
|
||||
} catch (e: Exception) {
|
||||
x as B
|
||||
return
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>ccc<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>ccc<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>ccc<!>() // should be ok
|
||||
}
|
||||
|
||||
fun breakInCatch() {
|
||||
var x: Any? = null
|
||||
while (true) {
|
||||
try {
|
||||
x as A
|
||||
} catch (e: Exception) {
|
||||
x as B
|
||||
break
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be ok
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be ok
|
||||
}
|
||||
|
||||
fun returnInFinally_insideTry_nonLocal() {
|
||||
var x: Any? = null
|
||||
run {
|
||||
try {
|
||||
x as B
|
||||
try {
|
||||
x as A
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.bbb() // should be ok
|
||||
return
|
||||
}
|
||||
} finally {
|
||||
x.<!UNRESOLVED_REFERENCE!>aaa<!>() // should be error
|
||||
x.<!UNRESOLVED_REFERENCE!>bbb<!>() // should be error
|
||||
}
|
||||
<!UNREACHABLE_CODE!>x.<!UNRESOLVED_REFERENCE!>aaa<!>()<!> // should be error
|
||||
<!UNREACHABLE_CODE!>x.<!UNRESOLVED_REFERENCE!>bbb<!>()<!> // should be error
|
||||
}
|
||||
<!UNREACHABLE_CODE!>x.<!UNRESOLVED_REFERENCE!>aaa<!>()<!> // should be error
|
||||
<!UNREACHABLE_CODE!>x.<!UNRESOLVED_REFERENCE!>bbb<!>()<!> // should be error
|
||||
}
|
||||
Generated
+6
@@ -32001,6 +32001,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithJump.kt")
|
||||
public void testCastInTryWithJump() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/castchecks/castInTryWithJump.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castInTryWithoutCatch.kt")
|
||||
public void testCastInTryWithoutCatch() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user