[FIR] Only track assignment nodes for uncaught exception edges in CFG
UncaughtExceptionPath edges are used to influence smart-casting within catch and finally blocks. Previously these edges were added from every node which could throw an exception. But only assignment nodes influence smart-casts by resetting inference back to some less specific type. Therefore, instead of tracking every possible node which could throw an exception - even though almost every statement node can - only add edges from assignment nodes to catch and finally blocks. This fixes many missing exception cases and also reduces the total number of incoming edges to catch and finally blocks. #KT-56872 Fixed
This commit is contained in:
@@ -97,13 +97,11 @@ digraph initializationInTry_kt {
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
19 -> {26} [label="onUncaughtException"];
|
||||
20 -> {21};
|
||||
20 -> {26} [label="onUncaughtException"];
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
22 -> {26} [label="onUncaughtException"];
|
||||
23 -> {24};
|
||||
23 -> {26} [label="onUncaughtException"];
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
@@ -167,11 +165,10 @@ digraph initializationInTry_kt {
|
||||
40 -> {41};
|
||||
41 -> {42};
|
||||
42 -> {43};
|
||||
42 -> {48} [label="onUncaughtException"];
|
||||
43 -> {44};
|
||||
44 -> {45};
|
||||
44 -> {48} [label="onUncaughtException"];
|
||||
45 -> {46};
|
||||
45 -> {48} [label="onUncaughtException"];
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
48 -> {49};
|
||||
|
||||
@@ -151,7 +151,7 @@ digraph complex_kt {
|
||||
23 -> {24 29};
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27 29};
|
||||
26 -> {27};
|
||||
27 -> {28};
|
||||
28 -> {29 38};
|
||||
29 -> {30};
|
||||
|
||||
+2
-2
@@ -184,12 +184,12 @@ digraph inplaceLambdaInControlFlowExpressions_kt {
|
||||
45 -> {46} [style=dashed];
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
48 -> {49 55};
|
||||
48 -> {49};
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {52} [color=green];
|
||||
51 -> {61} [color=red];
|
||||
52 -> {53 55};
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {55 61};
|
||||
55 -> {56};
|
||||
|
||||
+1
-1
@@ -333,7 +333,7 @@ digraph postponedLambdaInReturn_kt {
|
||||
88 -> {89};
|
||||
89 -> {90};
|
||||
90 -> {91} [color=green];
|
||||
91 -> {92 96};
|
||||
91 -> {92};
|
||||
92 -> {109};
|
||||
92 -> {93} [style=dotted];
|
||||
93 -> {94} [style=dotted];
|
||||
|
||||
@@ -228,11 +228,11 @@ digraph tryCatch_kt {
|
||||
subgraph cluster_32 {
|
||||
color=blue
|
||||
86 [label="Catch enter"];
|
||||
87 [label="Variable declaration: e: R|kotlin/RuntimeException|"];
|
||||
87 [label="Variable declaration: e: R|kotlin/Exception|"];
|
||||
subgraph cluster_33 {
|
||||
color=blue
|
||||
88 [label="Enter block"];
|
||||
89 [label="Jump: break@@@[Boolean(true)] "];
|
||||
89 [label="Jump: continue@@@[Boolean(true)] "];
|
||||
90 [label="Stub" style="filled" fillcolor=gray];
|
||||
91 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
@@ -241,11 +241,11 @@ digraph tryCatch_kt {
|
||||
subgraph cluster_34 {
|
||||
color=blue
|
||||
93 [label="Catch enter"];
|
||||
94 [label="Variable declaration: e: R|kotlin/Exception|"];
|
||||
94 [label="Variable declaration: e: R|kotlin/RuntimeException|"];
|
||||
subgraph cluster_35 {
|
||||
color=blue
|
||||
95 [label="Enter block"];
|
||||
96 [label="Jump: continue@@@[Boolean(true)] "];
|
||||
96 [label="Jump: break@@@[Boolean(true)] "];
|
||||
97 [label="Stub" style="filled" fillcolor=gray];
|
||||
98 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
@@ -297,7 +297,7 @@ digraph tryCatch_kt {
|
||||
71 -> {72};
|
||||
72 -> {73};
|
||||
73 -> {74};
|
||||
74 -> {75 86 93};
|
||||
74 -> {75};
|
||||
75 -> {76 77};
|
||||
76 -> {83};
|
||||
77 -> {78};
|
||||
@@ -313,7 +313,7 @@ digraph tryCatch_kt {
|
||||
86 -> {87};
|
||||
87 -> {88};
|
||||
88 -> {89};
|
||||
89 -> {105};
|
||||
89 -> {49} [color=green style=dashed];
|
||||
89 -> {90} [style=dotted];
|
||||
90 -> {91} [style=dotted];
|
||||
91 -> {92} [style=dotted];
|
||||
@@ -321,7 +321,7 @@ digraph tryCatch_kt {
|
||||
93 -> {94};
|
||||
94 -> {95};
|
||||
95 -> {96};
|
||||
96 -> {49} [color=green style=dashed];
|
||||
96 -> {105};
|
||||
96 -> {97} [style=dotted];
|
||||
97 -> {98} [style=dotted];
|
||||
98 -> {99} [style=dotted];
|
||||
|
||||
+1
-4
@@ -70,7 +70,6 @@ digraph variableInitializedInTryBlock_kt {
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
8 -> {23} [label="onUncaughtException"];
|
||||
9 -> {10 13};
|
||||
10 -> {11};
|
||||
11 -> {23} [label="return@/test"];
|
||||
@@ -80,13 +79,11 @@ digraph variableInitializedInTryBlock_kt {
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
16 -> {23} [label="onUncaughtException"];
|
||||
17 -> {18};
|
||||
17 -> {23} [label="onUncaughtException"];
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
19 -> {23} [label="onUncaughtException"];
|
||||
20 -> {21};
|
||||
20 -> {23} [label="onUncaughtException"];
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
|
||||
Reference in New Issue
Block a user