[FIR] Update smartcast tests
This commit is contained in:
+95
@@ -312,4 +312,99 @@ digraph smartcastToNothing_kt {
|
||||
106 -> {95} [color=red];
|
||||
106 -> {96} [color=green];
|
||||
|
||||
subgraph cluster_26 {
|
||||
color=red
|
||||
107 [label="Enter function test_1" style="filled" fillcolor=red];
|
||||
subgraph cluster_27 {
|
||||
color=blue
|
||||
108 [label="Enter block"];
|
||||
subgraph cluster_28 {
|
||||
color=blue
|
||||
109 [label="Enter when"];
|
||||
subgraph cluster_29 {
|
||||
color=blue
|
||||
110 [label="Enter when branch condition "];
|
||||
111 [label="Access variable R|<local>/a|"];
|
||||
112 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing?|)"];
|
||||
113 [label="Exit when branch condition"];
|
||||
}
|
||||
114 [label="Synthetic else branch"];
|
||||
115 [label="Enter when branch result"];
|
||||
subgraph cluster_30 {
|
||||
color=blue
|
||||
116 [label="Enter block"];
|
||||
117 [label="Access variable R|<local>/a|"];
|
||||
118 [label="Enter safe call"];
|
||||
119 [label="Access variable R|kotlin/String.length|"];
|
||||
120 [label="Exit safe call"];
|
||||
121 [label="Variable declaration: lval b: R|kotlin/Int?|"];
|
||||
122 [label="Exit block"];
|
||||
}
|
||||
123 [label="Exit when branch result"];
|
||||
124 [label="Exit when"];
|
||||
}
|
||||
subgraph cluster_31 {
|
||||
color=blue
|
||||
125 [label="Enter when"];
|
||||
subgraph cluster_32 {
|
||||
color=blue
|
||||
126 [label="Enter when branch condition "];
|
||||
127 [label="Access variable R|<local>/a|"];
|
||||
128 [label="Type operator: (R|<local>/a| is R|kotlin/Nothing|)"];
|
||||
129 [label="Exit when branch condition"];
|
||||
}
|
||||
130 [label="Synthetic else branch"];
|
||||
131 [label="Enter when branch result"];
|
||||
subgraph cluster_33 {
|
||||
color=blue
|
||||
132 [label="Enter block"];
|
||||
133 [label="Access variable R|<local>/a|"];
|
||||
134 [label="Stub" style="filled" fillcolor=gray];
|
||||
135 [label="Access variable R|kotlin/String.length|" style="filled" fillcolor=gray];
|
||||
136 [label="Variable declaration: lval b: R|kotlin/Int|" style="filled" fillcolor=gray];
|
||||
137 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
138 [label="Exit when branch result" style="filled" fillcolor=gray];
|
||||
139 [label="Exit when"];
|
||||
}
|
||||
140 [label="Exit block"];
|
||||
}
|
||||
141 [label="Exit function test_1" style="filled" fillcolor=red];
|
||||
}
|
||||
107 -> {108};
|
||||
108 -> {109};
|
||||
109 -> {110};
|
||||
110 -> {111};
|
||||
111 -> {112};
|
||||
112 -> {113};
|
||||
113 -> {115 114};
|
||||
114 -> {124};
|
||||
115 -> {116};
|
||||
116 -> {117};
|
||||
117 -> {118 120};
|
||||
118 -> {119};
|
||||
119 -> {120};
|
||||
120 -> {121};
|
||||
121 -> {122};
|
||||
122 -> {123};
|
||||
123 -> {124};
|
||||
124 -> {125};
|
||||
125 -> {126};
|
||||
126 -> {127};
|
||||
127 -> {128};
|
||||
128 -> {129};
|
||||
129 -> {131 130};
|
||||
130 -> {139};
|
||||
131 -> {132};
|
||||
132 -> {133};
|
||||
133 -> {141} [label=onUncaughtException];
|
||||
133 -> {134} [style=dotted];
|
||||
134 -> {135} [style=dotted];
|
||||
135 -> {136} [style=dotted];
|
||||
136 -> {137} [style=dotted];
|
||||
137 -> {138} [style=dotted];
|
||||
138 -> {139} [style=dotted];
|
||||
139 -> {140};
|
||||
140 -> {141};
|
||||
|
||||
}
|
||||
|
||||
+14
@@ -50,3 +50,17 @@ FILE: smartcastToNothing.kt
|
||||
}
|
||||
) }
|
||||
}
|
||||
public final fun test_1(a: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
(R|<local>/a| is R|kotlin/Nothing?|) -> {
|
||||
lval b: R|kotlin/Int?| = R|<local>/a|?.{ $subj$.R|kotlin/String.length| }
|
||||
}
|
||||
}
|
||||
|
||||
when () {
|
||||
(R|<local>/a| is R|kotlin/Nothing|) -> {
|
||||
lval b: R|kotlin/Int| = R|<local>/a|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
@@ -22,3 +22,13 @@ fun test_0(results: List<Nothing>) {
|
||||
}
|
||||
s?.let { it.a }
|
||||
}
|
||||
|
||||
fun test_1(a: String?) {
|
||||
if (a is Nothing?) {
|
||||
val b = a?.length
|
||||
}
|
||||
|
||||
if (a is Nothing) {
|
||||
val b = a.length
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user