diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot index a341c6384b3..d44d777bdba 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot @@ -127,7 +127,7 @@ digraph jumps_kt { } 51 [label="Variable declaration: lval y: R|kotlin/Int?|"]; 52 [label="Access variable R|/y|"]; - 53 [label="Function call: R|/y|.#()"]; + 53 [label="Function call: R|/y|.#()"]; 54 [label="Exit block"]; } 55 [label="Exit function test_2" style="filled" fillcolor=red]; diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.fir.txt b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.fir.txt index 8db5d31af95..9ab907ad6ef 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/jumps.fir.txt @@ -22,7 +22,7 @@ FILE: jumps.kt } } - R|/y|.#() + R|/y|.#() } public final fun test_3(x: R|kotlin/Int?|): R|kotlin/Unit| { while(Boolean(true)) { diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.fir.txt index cdae761ca29..491bc7d870b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/syntheticSmartCast.fir.txt @@ -36,7 +36,7 @@ FILE: test.kt lval bar: R|kotlin/CharSequence?| = R|/x|?.{ $subj$.R|/SomeClass.bar| } when () { !=(R|/bar|, Null(null)) -> { - R|/x|.R|/SomeClass.bar|.# + R|/x|.R|/SomeClass.bar|.# } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot index f1331c189c8..21b1cf18f46 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.dot @@ -202,7 +202,7 @@ digraph bangbang_kt { 78 [label="Exit when"]; } 79 [label="Access variable R|/a|"]; - 80 [label="Function call: R|/a|.#()"]; + 80 [label="Function call: R|/a|.#()"]; 81 [label="Exit block"]; } 82 [label="Exit function test_3" style="filled" fillcolor=red]; @@ -331,14 +331,14 @@ digraph bangbang_kt { color=blue 123 [label="Enter block"]; 124 [label="Access variable R|/a|"]; - 125 [label="Function call: R|/a|.#()"]; + 125 [label="Function call: R|/a|.#()"]; 126 [label="Exit block"]; } 127 [label="Exit when branch result"]; 128 [label="Exit when"]; } 129 [label="Access variable R|/a|"]; - 130 [label="Function call: R|/a|.#()"]; + 130 [label="Function call: R|/a|.#()"]; 131 [label="Exit block"]; } 132 [label="Exit function test_5" style="filled" fillcolor=red]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.fir.txt index 232de6dd6db..369063f6f10 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.fir.txt @@ -32,7 +32,7 @@ FILE: bangbang.kt } } - R|/a|.#() + R|/a|.#() } public final fun test_4(a: R|A?|, b: R|kotlin/Boolean|): R|kotlin/Unit| { when () { @@ -46,11 +46,11 @@ FILE: bangbang.kt public final fun test_5(a: R|A?|, b: R|kotlin/Boolean|): R|kotlin/Unit| { when () { R|/b| || R|/a|!!.R|/A.foo|() -> { - R|/a|.#() + R|/a|.#() } } - R|/a|.#() + R|/a|.#() } public final fun test_6(x: R|X|): R|kotlin/Unit| { R|/x|!!.R|/A.foo|() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanElvisBoundSmartcast.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanElvisBoundSmartcast.fir.txt index 2429c056d0f..f01f7c29253 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanElvisBoundSmartcast.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanElvisBoundSmartcast.fir.txt @@ -17,7 +17,7 @@ FILE: booleanElvisBoundSmartcast.kt R|/a|.R|/A.foo|() } else -> { - R|/a|.#() + R|/a|.#() } } @@ -25,7 +25,7 @@ FILE: booleanElvisBoundSmartcast.kt public final fun test_2(a: R|A?|): R|kotlin/Unit| { when () { R|/a|?.{ $subj$.R|/A.b| } ?: Boolean(true) -> { - R|/a|.#() + R|/a|.#() } else -> { R|/a|.R|/A.foo|() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot index bf4effb52bb..33450580c60 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.dot @@ -46,7 +46,7 @@ digraph equalsToBoolean_kt { color=blue 17 [label="Enter block"]; 18 [label="Access variable R|/b|"]; - 19 [label="Function call: R|/b|.#()"]; + 19 [label="Function call: R|/b|.#()"]; 20 [label="Exit block"]; } 21 [label="Exit when branch result"]; @@ -130,7 +130,7 @@ digraph equalsToBoolean_kt { color=blue 50 [label="Enter block"]; 51 [label="Access variable R|/b|"]; - 52 [label="Function call: R|/b|.#()"]; + 52 [label="Function call: R|/b|.#()"]; 53 [label="Exit block"]; } 54 [label="Exit when branch result"]; @@ -205,7 +205,7 @@ digraph equalsToBoolean_kt { color=blue 77 [label="Enter block"]; 78 [label="Access variable R|/b|"]; - 79 [label="Function call: R|/b|.#()"]; + 79 [label="Function call: R|/b|.#()"]; 80 [label="Exit block"]; } 81 [label="Exit when branch result"]; @@ -271,7 +271,7 @@ digraph equalsToBoolean_kt { color=blue 98 [label="Enter block"]; 99 [label="Access variable R|/b|"]; - 100 [label="Function call: R|/b|.#()"]; + 100 [label="Function call: R|/b|.#()"]; 101 [label="Exit block"]; } 102 [label="Exit when branch result"]; @@ -355,7 +355,7 @@ digraph equalsToBoolean_kt { color=blue 131 [label="Enter block"]; 132 [label="Access variable R|/b|"]; - 133 [label="Function call: R|/b|.#()"]; + 133 [label="Function call: R|/b|.#()"]; 134 [label="Exit block"]; } 135 [label="Exit when branch result"]; @@ -421,7 +421,7 @@ digraph equalsToBoolean_kt { color=blue 152 [label="Enter block"]; 153 [label="Access variable R|/b|"]; - 154 [label="Function call: R|/b|.#()"]; + 154 [label="Function call: R|/b|.#()"]; 155 [label="Exit block"]; } 156 [label="Exit when branch result"]; @@ -496,7 +496,7 @@ digraph equalsToBoolean_kt { color=blue 179 [label="Enter block"]; 180 [label="Access variable R|/b|"]; - 181 [label="Function call: R|/b|.#()"]; + 181 [label="Function call: R|/b|.#()"]; 182 [label="Exit block"]; } 183 [label="Exit when branch result"]; @@ -580,7 +580,7 @@ digraph equalsToBoolean_kt { color=blue 212 [label="Enter block"]; 213 [label="Access variable R|/b|"]; - 214 [label="Function call: R|/b|.#()"]; + 214 [label="Function call: R|/b|.#()"]; 215 [label="Exit block"]; } 216 [label="Exit when branch result"]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.fir.txt index dcb4d6ff4a2..d3cf7547700 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.fir.txt @@ -12,7 +12,7 @@ FILE: equalsToBoolean.kt R|/b|.R|kotlin/Boolean.not|() } else -> { - R|/b|.#() + R|/b|.#() } } @@ -20,7 +20,7 @@ FILE: equalsToBoolean.kt public final fun test_2(b: R|kotlin/Boolean?|): R|kotlin/Unit| { when () { !=(==(R|/b|, Boolean(true)), Boolean(true)) -> { - R|/b|.#() + R|/b|.#() } else -> { R|/b|.R|kotlin/Boolean.not|() @@ -31,7 +31,7 @@ FILE: equalsToBoolean.kt public final fun test_3(b: R|kotlin/Boolean?|): R|kotlin/Unit| { when () { ==(==(R|/b|, Boolean(true)), Boolean(false)) -> { - R|/b|.#() + R|/b|.#() } else -> { R|/b|.R|kotlin/Boolean.not|() @@ -45,7 +45,7 @@ FILE: equalsToBoolean.kt R|/b|.R|kotlin/Boolean.not|() } else -> { - R|/b|.#() + R|/b|.#() } } @@ -53,7 +53,7 @@ FILE: equalsToBoolean.kt public final fun test_5(b: R|kotlin/Boolean?|): R|kotlin/Unit| { when () { ==(!=(R|/b|, Boolean(true)), Boolean(true)) -> { - R|/b|.#() + R|/b|.#() } else -> { R|/b|.R|kotlin/Boolean.not|() @@ -67,7 +67,7 @@ FILE: equalsToBoolean.kt R|/b|.R|kotlin/Boolean.not|() } else -> { - R|/b|.#() + R|/b|.#() } } @@ -78,7 +78,7 @@ FILE: equalsToBoolean.kt R|/b|.R|kotlin/Boolean.not|() } else -> { - R|/b|.#() + R|/b|.#() } } @@ -86,7 +86,7 @@ FILE: equalsToBoolean.kt public final fun test_8(b: R|kotlin/Boolean?|): R|kotlin/Unit| { when () { !=(!=(R|/b|, Boolean(true)), Boolean(false)) -> { - R|/b|.#() + R|/b|.#() } else -> { R|/b|.R|kotlin/Boolean.not|() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot index ad72544a661..2a8c3150695 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.dot @@ -267,7 +267,7 @@ digraph jumpFromRhsOfOperator_kt { 101 [label="Exit ||"]; } 102 [label="Access variable R|/a|"]; - 103 [label="Function call: R|/a|.#()"]; + 103 [label="Function call: R|/a|.#()"]; 104 [label="Exit block"]; } 105 [label="Exit function test_5" style="filled" fillcolor=red]; @@ -309,7 +309,7 @@ digraph jumpFromRhsOfOperator_kt { 117 [label="Exit &&"]; } 118 [label="Access variable R|/a|"]; - 119 [label="Function call: R|/a|.#()"]; + 119 [label="Function call: R|/a|.#()"]; 120 [label="Exit block"]; } 121 [label="Exit function teat_6" style="filled" fillcolor=red]; @@ -364,14 +364,14 @@ digraph jumpFromRhsOfOperator_kt { color=blue 139 [label="Enter block"]; 140 [label="Access variable R|/a|"]; - 141 [label="Function call: R|/a|.#()"]; + 141 [label="Function call: R|/a|.#()"]; 142 [label="Exit block"]; } 143 [label="Exit when branch result"]; 144 [label="Exit when"]; } 145 [label="Access variable R|/a|"]; - 146 [label="Function call: R|/a|.#()"]; + 146 [label="Function call: R|/a|.#()"]; 147 [label="Exit block"]; } 148 [label="Exit function test_7" style="filled" fillcolor=red]; @@ -437,14 +437,14 @@ digraph jumpFromRhsOfOperator_kt { color=blue 166 [label="Enter block"]; 167 [label="Access variable R|/a|"]; - 168 [label="Function call: R|/a|.#()"]; + 168 [label="Function call: R|/a|.#()"]; 169 [label="Exit block"]; } 170 [label="Exit when branch result"]; 171 [label="Exit when"]; } 172 [label="Access variable R|/a|"]; - 173 [label="Function call: R|/a|.#()"]; + 173 [label="Function call: R|/a|.#()"]; 174 [label="Exit block"]; } 175 [label="Exit function test_8" style="filled" fillcolor=red]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.fir.txt index ee90ae4b50d..f0c7ae99b40 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.fir.txt @@ -31,27 +31,27 @@ FILE: jumpFromRhsOfOperator.kt } public final fun test_5(a: R|A?|): R|kotlin/Unit| { ==(R|/a|, Null(null)) || throw R|java/lang/Exception.Exception|() - R|/a|.#() + R|/a|.#() } public final fun teat_6(a: R|A?|): R|kotlin/Unit| { !=(R|/a|, Null(null)) && throw R|java/lang/Exception.Exception|() - R|/a|.#() + R|/a|.#() } public final fun test_7(a: R|A?|): R|kotlin/Unit| { when () { ==(R|/a|, Null(null)) || throw R|java/lang/Exception.Exception|() -> { - R|/a|.#() + R|/a|.#() } } - R|/a|.#() + R|/a|.#() } public final fun test_8(a: R|A?|): R|kotlin/Unit| { when () { !=(R|/a|, Null(null)) && throw R|java/lang/Exception.Exception|() -> { - R|/a|.#() + R|/a|.#() } } - R|/a|.#() + R|/a|.#() } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot index 38e0f7bdb2e..0fb3a59caad 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot @@ -675,7 +675,7 @@ digraph boundSmartcastsInBranches_kt { 275 [label="Access variable R|/x|"]; 276 [label="Access variable R|kotlin/String.length|"]; 277 [label="Access variable R|/y|"]; - 278 [label="Access variable #"]; + 278 [label="Access variable #"]; 279 [label="Access variable R|/z|"]; 280 [label="Access variable R|kotlin/String.length|"]; 281 [label="Exit block"]; @@ -700,11 +700,11 @@ digraph boundSmartcastsInBranches_kt { color=blue 292 [label="Enter block"]; 293 [label="Access variable R|/x|"]; - 294 [label="Access variable #"]; + 294 [label="Access variable #"]; 295 [label="Access variable R|/y|"]; 296 [label="Access variable R|kotlin/String.length|"]; 297 [label="Access variable R|/z|"]; - 298 [label="Access variable #"]; + 298 [label="Access variable #"]; 299 [label="Exit block"]; } 300 [label="Exit when branch result"]; @@ -729,7 +729,7 @@ digraph boundSmartcastsInBranches_kt { 311 [label="Access variable R|/x|"]; 312 [label="Access variable R|kotlin/String.length|"]; 313 [label="Access variable R|/y|"]; - 314 [label="Access variable #"]; + 314 [label="Access variable #"]; 315 [label="Access variable R|/z|"]; 316 [label="Access variable R|kotlin/String.length|"]; 317 [label="Exit block"]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.fir.txt index a30cce4290b..114d928377c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.fir.txt @@ -135,23 +135,23 @@ FILE: boundSmartcastsInBranches.kt when () { !=(R|/x|, Null(null)) -> { R|/x|.R|kotlin/String.length| - R|/y|.# + R|/y|.# R|/z|.R|kotlin/String.length| } } when () { !=(R|/y|, Null(null)) -> { - R|/x|.# + R|/x|.# R|/y|.R|kotlin/String.length| - R|/z|.# + R|/z|.# } } when () { !=(R|/z|, Null(null)) -> { R|/x|.R|kotlin/String.length| - R|/y|.# + R|/y|.# R|/z|.R|kotlin/String.length| } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot index 6ed56dd589d..fc1c14088bb 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.dot @@ -136,9 +136,9 @@ digraph equalsAndIdentity_kt { color=blue 50 [label="Enter block"]; 51 [label="Access variable R|/x|"]; - 52 [label="Function call: R|/x|.#()"]; + 52 [label="Function call: R|/x|.#()"]; 53 [label="Access variable R|/y|"]; - 54 [label="Function call: R|/y|.#()"]; + 54 [label="Function call: R|/y|.#()"]; 55 [label="Exit block"]; } 56 [label="Exit when branch result"]; @@ -161,9 +161,9 @@ digraph equalsAndIdentity_kt { color=blue 66 [label="Enter block"]; 67 [label="Access variable R|/x|"]; - 68 [label="Function call: R|/x|.#()"]; + 68 [label="Function call: R|/x|.#()"]; 69 [label="Access variable R|/y|"]; - 70 [label="Function call: R|/y|.#()"]; + 70 [label="Function call: R|/y|.#()"]; 71 [label="Exit block"]; } 72 [label="Exit when branch result"]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.fir.txt index f01b1510c72..90ff8875de7 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.fir.txt @@ -22,15 +22,15 @@ FILE: equalsAndIdentity.kt public final fun test_2(x: R|A?|, y: R|A?|): R|kotlin/Unit| { when () { ==(R|/x|, R|/y|) -> { - R|/x|.#() - R|/y|.#() + R|/x|.#() + R|/y|.#() } } when () { ===(R|/x|, R|/y|) -> { - R|/x|.#() - R|/y|.#() + R|/x|.#() + R|/y|.#() } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot index 62d5d5183b5..6fbd681984e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.dot @@ -239,7 +239,7 @@ digraph nullability_kt { color=blue 76 [label="Enter block"]; 77 [label="Access variable R|/x|"]; - 78 [label="Function call: R|/x|.#()"]; + 78 [label="Function call: R|/x|.#()"]; 79 [label="Exit block"]; } 80 [label="Exit when branch result"]; @@ -255,7 +255,7 @@ digraph nullability_kt { 87 [label="Exit when"]; } 88 [label="Access variable R|/x|"]; - 89 [label="Function call: R|/x|.#()"]; + 89 [label="Function call: R|/x|.#()"]; 90 [label="Exit block"]; } 91 [label="Exit function test_1" style="filled" fillcolor=red]; @@ -323,14 +323,14 @@ digraph nullability_kt { color=blue 109 [label="Enter block"]; 110 [label="Access variable R|/x|"]; - 111 [label="Function call: R|/x|.#()"]; + 111 [label="Function call: R|/x|.#()"]; 112 [label="Exit block"]; } 113 [label="Exit when branch result"]; 114 [label="Exit when"]; } 115 [label="Access variable R|/x|"]; - 116 [label="Function call: R|/x|.#()"]; + 116 [label="Function call: R|/x|.#()"]; 117 [label="Exit block"]; } 118 [label="Exit function test_2" style="filled" fillcolor=red]; @@ -492,11 +492,11 @@ digraph nullability_kt { 176 [label="Access variable R|/Q.data|"]; 177 [label="Access variable R|/q|"]; 178 [label="Access variable R|/Q.data|"]; - 179 [label="Access variable #"]; + 179 [label="Access variable #"]; 180 [label="Access variable R|/q|"]; 181 [label="Access variable R|/Q.data|"]; - 182 [label="Access variable #"]; - 183 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; + 182 [label="Access variable #"]; + 183 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; 184 [label="Exit block"]; } 185 [label="Exit when branch result"]; @@ -566,11 +566,11 @@ digraph nullability_kt { 208 [label="Access variable R|/Q.data|"]; 209 [label="Access variable R|/q|"]; 210 [label="Access variable R|/Q.data|"]; - 211 [label="Access variable #"]; + 211 [label="Access variable #"]; 212 [label="Access variable R|/q|"]; 213 [label="Access variable R|/Q.data|"]; - 214 [label="Access variable #"]; - 215 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; + 214 [label="Access variable #"]; + 215 [label="Function call: R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|()"]; 216 [label="Exit block"]; } 217 [label="Exit function test_6" style="filled" fillcolor=red]; @@ -640,11 +640,11 @@ digraph nullability_kt { 239 [label="Function call: R|/q|.R|/Q.fdata|()"]; 240 [label="Access variable R|/q|"]; 241 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 242 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 242 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; 243 [label="Access variable R|/q|"]; 244 [label="Function call: R|/q|.R|/Q.fdata|()"]; - 245 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; - 246 [label="Function call: R|/q|.R|/Q.fdata|().#().R|kotlin/Int.inc|()"]; + 245 [label="Function call: R|/q|.R|/Q.fdata|().#()"]; + 246 [label="Function call: R|/q|.R|/Q.fdata|().#().R|kotlin/Int.inc|()"]; 247 [label="Exit block"]; } 248 [label="Exit when branch result"]; @@ -769,7 +769,7 @@ digraph nullability_kt { 285 [label="Exit when"]; } 286 [label="Access variable R|/b|"]; - 287 [label="Function call: R|/b|.#()"]; + 287 [label="Function call: R|/b|.#()"]; subgraph cluster_66 { color=blue 288 [label="Enter when"]; @@ -794,7 +794,7 @@ digraph nullability_kt { 301 [label="Exit when"]; } 302 [label="Access variable R|/b|"]; - 303 [label="Function call: R|/b|.#()"]; + 303 [label="Function call: R|/b|.#()"]; subgraph cluster_69 { color=blue 304 [label="Enter when"]; @@ -819,7 +819,7 @@ digraph nullability_kt { 317 [label="Exit when"]; } 318 [label="Access variable R|/b|"]; - 319 [label="Function call: R|/b|.#()"]; + 319 [label="Function call: R|/b|.#()"]; subgraph cluster_72 { color=blue 320 [label="Enter when"]; @@ -844,7 +844,7 @@ digraph nullability_kt { 333 [label="Exit when"]; } 334 [label="Access variable R|/b|"]; - 335 [label="Function call: R|/b|.#()"]; + 335 [label="Function call: R|/b|.#()"]; 336 [label="Exit block"]; } 337 [label="Exit function test_9" style="filled" fillcolor=red]; @@ -940,14 +940,14 @@ digraph nullability_kt { color=blue 348 [label="Enter block"]; 349 [label="Access variable R|/b|"]; - 350 [label="Function call: R|/b|.#()"]; + 350 [label="Function call: R|/b|.#()"]; 351 [label="Exit block"]; } 352 [label="Exit when branch result"]; 353 [label="Exit when"]; } 354 [label="Access variable R|/b|"]; - 355 [label="Function call: R|/b|.#()"]; + 355 [label="Function call: R|/b|.#()"]; subgraph cluster_80 { color=blue 356 [label="Enter when"]; @@ -965,14 +965,14 @@ digraph nullability_kt { color=blue 364 [label="Enter block"]; 365 [label="Access variable R|/b|"]; - 366 [label="Function call: R|/b|.#()"]; + 366 [label="Function call: R|/b|.#()"]; 367 [label="Exit block"]; } 368 [label="Exit when branch result"]; 369 [label="Exit when"]; } 370 [label="Access variable R|/b|"]; - 371 [label="Function call: R|/b|.#()"]; + 371 [label="Function call: R|/b|.#()"]; subgraph cluster_83 { color=blue 372 [label="Enter when"]; @@ -990,14 +990,14 @@ digraph nullability_kt { color=blue 380 [label="Enter block"]; 381 [label="Access variable R|/b|"]; - 382 [label="Function call: R|/b|.#()"]; + 382 [label="Function call: R|/b|.#()"]; 383 [label="Exit block"]; } 384 [label="Exit when branch result"]; 385 [label="Exit when"]; } 386 [label="Access variable R|/b|"]; - 387 [label="Function call: R|/b|.#()"]; + 387 [label="Function call: R|/b|.#()"]; subgraph cluster_86 { color=blue 388 [label="Enter when"]; @@ -1015,14 +1015,14 @@ digraph nullability_kt { color=blue 396 [label="Enter block"]; 397 [label="Access variable R|/b|"]; - 398 [label="Function call: R|/b|.#()"]; + 398 [label="Function call: R|/b|.#()"]; 399 [label="Exit block"]; } 400 [label="Exit when branch result"]; 401 [label="Exit when"]; } 402 [label="Access variable R|/b|"]; - 403 [label="Function call: R|/b|.#()"]; + 403 [label="Function call: R|/b|.#()"]; 404 [label="Exit block"]; } 405 [label="Exit function test_10" style="filled" fillcolor=red]; @@ -1139,11 +1139,11 @@ digraph nullability_kt { 436 [label="Access variable R|/QImpl.data|"]; 437 [label="Access variable R|/q2|"]; 438 [label="Access variable R|/QImpl.data|"]; - 439 [label="Access variable #"]; + 439 [label="Access variable #"]; 440 [label="Access variable R|/q2|"]; 441 [label="Access variable R|/QImpl.data|"]; - 442 [label="Access variable #"]; - 443 [label="Function call: R|/q2|.R|/QImpl.data|.#.R|kotlin/Int.inc|()"]; + 442 [label="Access variable #"]; + 443 [label="Function call: R|/q2|.R|/QImpl.data|.#.R|kotlin/Int.inc|()"]; subgraph cluster_94 { color=blue 444 [label="Enter when"]; @@ -1280,11 +1280,11 @@ digraph nullability_kt { 490 [label="Access variable R|/QImplWithCustomGetter.data|"]; 491 [label="Access variable R|/q|"]; 492 [label="Access variable R|/QImplWithCustomGetter.data|"]; - 493 [label="Access variable #"]; + 493 [label="Access variable #"]; 494 [label="Access variable R|/q|"]; 495 [label="Access variable R|/QImplWithCustomGetter.data|"]; - 496 [label="Access variable #"]; - 497 [label="Function call: R|/q|.R|/QImplWithCustomGetter.data|.#.R|kotlin/Int.inc|()"]; + 496 [label="Access variable #"]; + 497 [label="Function call: R|/q|.R|/QImplWithCustomGetter.data|.#.R|kotlin/Int.inc|()"]; 498 [label="Exit block"]; } 499 [label="Exit when branch result"]; @@ -1363,11 +1363,11 @@ digraph nullability_kt { 524 [label="Access variable R|/QImplMutable.data|"]; 525 [label="Access variable R|/q|"]; 526 [label="Access variable R|/QImplMutable.data|"]; - 527 [label="Access variable #"]; + 527 [label="Access variable #"]; 528 [label="Access variable R|/q|"]; 529 [label="Access variable R|/QImplMutable.data|"]; - 530 [label="Access variable #"]; - 531 [label="Function call: R|/q|.R|/QImplMutable.data|.#.R|kotlin/Int.inc|()"]; + 530 [label="Access variable #"]; + 531 [label="Function call: R|/q|.R|/QImplMutable.data|.#.R|kotlin/Int.inc|()"]; 532 [label="Exit block"]; } 533 [label="Exit when branch result"]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.fir.txt index bb5a8c7168b..cfb6f6d0941 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.fir.txt @@ -67,23 +67,23 @@ FILE: nullability.kt R|/x|.R|/A.foo|() } else -> { - R|/x|.#() + R|/x|.#() } } - R|/x|.#() + R|/x|.#() } public final fun test_2(x: R|A?|): R|kotlin/Unit| { when () { ==(R|/x|, Null(null)) -> { - R|/x|.#() + R|/x|.#() } else -> { R|/x|.R|/A.foo|() } } - R|/x|.#() + R|/x|.#() } public final fun test_3(x: R|A?|): R|kotlin/Unit| { R|/x| ?: ^test_3 Unit @@ -102,8 +102,8 @@ FILE: nullability.kt when () { !=(R|/q|?.{ $subj$.R|/Q.data| }?.{ $subj$.R|/MyData.s| }?.{ $subj$.R|kotlin/Int.inc|() }, Null(null)) -> { R|/q|.R|/Q.data| - R|/q|.R|/Q.data|.# - R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|() + R|/q|.R|/Q.data|.# + R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|() } } @@ -111,15 +111,15 @@ FILE: nullability.kt public final fun test_6(q: R|Q?|): R|kotlin/Unit| { R|/q|?.{ $subj$.R|/Q.data| }?.{ $subj$.R|/MyData.s| }?.{ $subj$.R|kotlin/Int.inc|() } ?: ^test_6 Unit R|/q|.R|/Q.data| - R|/q|.R|/Q.data|.# - R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|() + R|/q|.R|/Q.data|.# + R|/q|.R|/Q.data|.#.R|kotlin/Int.inc|() } public final fun test_7(q: R|Q?|): R|kotlin/Unit| { when () { !=(R|/q|?.{ $subj$.R|/Q.fdata|() }?.{ $subj$.R|/MyData.fs|() }?.{ $subj$.R|kotlin/Int.inc|() }, Null(null)) -> { R|/q|.R|/Q.fdata|() - R|/q|.R|/Q.fdata|().#() - R|/q|.R|/Q.fdata|().#().R|kotlin/Int.inc|() + R|/q|.R|/Q.fdata|().#() + R|/q|.R|/Q.fdata|().#().R|kotlin/Int.inc|() } } @@ -139,58 +139,58 @@ FILE: nullability.kt } } - R|/b|.#() + R|/b|.#() when () { ===(R|/a|, R|/b|) -> { R|/b|.R|kotlin/Int.inc|() } } - R|/b|.#() + R|/b|.#() when () { ==(R|/b|, R|/a|) -> { R|/b|.R|kotlin/Int.inc|() } } - R|/b|.#() + R|/b|.#() when () { ===(R|/b|, R|/a|) -> { R|/b|.R|kotlin/Int.inc|() } } - R|/b|.#() + R|/b|.#() } public final fun test_10(a: R|kotlin/Int?|, b: R|kotlin/Int?|): R|kotlin/Unit| { when () { ==(R|/a|, R|/b|) -> { - R|/b|.#() + R|/b|.#() } } - R|/b|.#() + R|/b|.#() when () { ===(R|/a|, R|/b|) -> { - R|/b|.#() + R|/b|.#() } } - R|/b|.#() + R|/b|.#() when () { ==(R|/b|, R|/a|) -> { - R|/b|.#() + R|/b|.#() } } - R|/b|.#() + R|/b|.#() when () { ===(R|/b|, R|/a|) -> { - R|/b|.#() + R|/b|.#() } } - R|/b|.#() + R|/b|.#() } public final fun test_11(q: R|QImpl?|, q2: R|QImpl|): R|kotlin/Unit| { when () { @@ -199,8 +199,8 @@ FILE: nullability.kt R|/q|.R|/QImpl.data|.R|/MyData.s| R|/q|.R|/QImpl.data|.R|/MyData.s|.R|kotlin/Int.inc|() R|/q2|.R|/QImpl.data| - R|/q2|.R|/QImpl.data|.# - R|/q2|.R|/QImpl.data|.#.R|kotlin/Int.inc|() + R|/q2|.R|/QImpl.data|.# + R|/q2|.R|/QImpl.data|.#.R|kotlin/Int.inc|() when () { !=(R|/q2|.R|/QImpl.data|, Null(null)) -> { R|/q2|.R|/QImpl.data|.R|/MyData.s| @@ -216,8 +216,8 @@ FILE: nullability.kt when () { !=(R|/q|?.{ $subj$.R|/QImplWithCustomGetter.data| }?.{ $subj$.R|/MyData.s| }?.{ $subj$.R|kotlin/Int.inc|() }, Null(null)) -> { R|/q|.R|/QImplWithCustomGetter.data| - R|/q|.R|/QImplWithCustomGetter.data|.# - R|/q|.R|/QImplWithCustomGetter.data|.#.R|kotlin/Int.inc|() + R|/q|.R|/QImplWithCustomGetter.data|.# + R|/q|.R|/QImplWithCustomGetter.data|.#.R|kotlin/Int.inc|() } } @@ -226,8 +226,8 @@ FILE: nullability.kt when () { !=(R|/q|?.{ $subj$.R|/QImplMutable.data| }?.{ $subj$.R|/MyData.s| }?.{ $subj$.R|kotlin/Int.inc|() }, Null(null)) -> { R|/q|.R|/QImplMutable.data| - R|/q|.R|/QImplMutable.data|.# - R|/q|.R|/QImplMutable.data|.#.R|kotlin/Int.inc|() + R|/q|.R|/QImplMutable.data|.# + R|/q|.R|/QImplMutable.data|.#.R|kotlin/Int.inc|() } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt index 36f096e22e1..82cb9c6d713 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/orInWhenBranch.kt @@ -22,6 +22,6 @@ fun test_3(a: Any?, b: Boolean) { fun test_4(a: Any?, b: Boolean) { if (a is String || b) { - a.foo() // Should be Bad + a.foo() // Should be Bad } } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot index c9e473aa55b..684490a4478 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.dot @@ -54,7 +54,7 @@ digraph safeCallAndEqualityToBool_kt { color=blue 21 [label="Enter block"]; 22 [label="Access variable R|/s|"]; - 23 [label="Access variable #"]; + 23 [label="Access variable #"]; 24 [label="Exit block"]; } 25 [label="Exit when branch result"]; @@ -131,7 +131,7 @@ digraph safeCallAndEqualityToBool_kt { color=blue 49 [label="Enter block"]; 50 [label="Access variable R|/s|"]; - 51 [label="Access variable #"]; + 51 [label="Access variable #"]; 52 [label="Exit block"]; } 53 [label="Exit when branch result"]; @@ -217,7 +217,7 @@ digraph safeCallAndEqualityToBool_kt { color=blue 83 [label="Enter block"]; 84 [label="Access variable R|/s|"]; - 85 [label="Access variable #"]; + 85 [label="Access variable #"]; 86 [label="Exit block"]; } 87 [label="Exit when branch result"]; @@ -294,7 +294,7 @@ digraph safeCallAndEqualityToBool_kt { color=blue 111 [label="Enter block"]; 112 [label="Access variable R|/s|"]; - 113 [label="Access variable #"]; + 113 [label="Access variable #"]; 114 [label="Exit block"]; } 115 [label="Exit when branch result"]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.fir.txt index fae1740aaf5..b71dc4ee0aa 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.fir.txt @@ -8,7 +8,7 @@ FILE: safeCallAndEqualityToBool.kt R|/s|.R|kotlin/String.length| } else -> { - R|/s|.# + R|/s|.# } } @@ -19,7 +19,7 @@ FILE: safeCallAndEqualityToBool.kt R|/s|.R|kotlin/String.length| } else -> { - R|/s|.# + R|/s|.# } } @@ -27,7 +27,7 @@ FILE: safeCallAndEqualityToBool.kt public final fun test_3(s: R|kotlin/String?|): R|kotlin/Unit| { when () { !=(R|/s|?.{ $subj$.R|/check|() }, Boolean(true)) -> { - R|/s|.# + R|/s|.# } else -> { R|/s|.R|kotlin/String.length| @@ -38,7 +38,7 @@ FILE: safeCallAndEqualityToBool.kt public final fun test_4(s: R|kotlin/String?|): R|kotlin/Unit| { when () { !=(R|/s|?.{ $subj$.R|/check|() }, Boolean(false)) -> { - R|/s|.# + R|/s|.# } else -> { R|/s|.R|kotlin/String.length| diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot index 8d27fad946d..05851b67f5e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.dot @@ -53,7 +53,7 @@ digraph safeCalls_kt { 19 [label="Function call: $subj$.R|/foo|(...)"]; 20 [label="Exit safe call"]; 21 [label="Access variable R|/x|"]; - 22 [label="Access variable #"]; + 22 [label="Access variable #"]; 23 [label="Exit block"]; } 24 [label="Exit function test" style="filled" fillcolor=red]; @@ -208,7 +208,7 @@ digraph safeCalls_kt { 78 [label="Function call: $subj$.R|/A.bool|()"]; 79 [label="Exit safe call"]; 80 [label="Access variable R|/x|"]; - 81 [label="Function call: R|/x|.#()"]; + 81 [label="Function call: R|/x|.#()"]; 82 [label="Exit block"]; } 83 [label="Exit function test_4" style="filled" fillcolor=red]; @@ -272,7 +272,7 @@ digraph safeCalls_kt { 101 [label="Function call: $subj$.R|/boo|(...)"]; 102 [label="Exit safe call"]; 103 [label="Access variable R|/x|"]; - 104 [label="Function call: R|/x|.#()"]; + 104 [label="Function call: R|/x|.#()"]; 105 [label="Exit block"]; } 106 [label="Exit function test_5" style="filled" fillcolor=red]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.fir.txt index 93bfacb7409..6c8bfc399ee 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.fir.txt @@ -6,7 +6,7 @@ FILE: safeCalls.kt } public final fun test(x: R|kotlin/String?|): R|kotlin/Unit| { R|/x|?.{ $subj$.R|/foo|(==(R|/x|.R|kotlin/String.length|, Int(1))) } - R|/x|.# + R|/x|.# } public abstract interface A : R|kotlin/Any| { public abstract fun bar(a: R|A|): R|kotlin/String| @@ -28,7 +28,7 @@ FILE: safeCalls.kt } public final fun test_4(x: R|A?|): R|kotlin/Unit| { R|/x|?.{ $subj$.R|/A.id|() }?.{ $subj$.R|/A.bool|() } - R|/x|.#() + R|/x|.#() } public final fun R|kotlin/Any?|.boo(b: R|kotlin/Boolean|): R|kotlin/Unit| { } @@ -37,5 +37,5 @@ FILE: safeCalls.kt ^test_5 Unit } ) }?.{ $subj$.R|/boo|(R|/x|.R|/A.bool|()) } - R|/x|.#() + R|/x|.#() } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot index 584f6c6ab63..7ab5f2956dd 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.dot @@ -77,7 +77,7 @@ digraph delayedAssignment_kt { 32 [label="Exit when"]; } 33 [label="Access variable R|/a|"]; - 34 [label="Function call: R|/a|.#()"]; + 34 [label="Function call: R|/a|.#()"]; 35 [label="Exit block"]; } 36 [label="Exit function test" style="filled" fillcolor=red]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.fir.txt index 2204be47bd1..82ba2be0813 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.fir.txt @@ -20,5 +20,5 @@ FILE: delayedAssignment.kt } } - R|/a|.#() + R|/a|.#() } diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot index 6e88504047a..571bf9481a3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.dot @@ -103,7 +103,7 @@ digraph smartcastAfterReassignment_kt { 40 [label="Const: Null(null)"]; 41 [label="Assignment: R|/x|"]; 42 [label="Access variable R|/x|"]; - 43 [label="Access variable #"]; + 43 [label="Access variable #"]; 44 [label="Exit block"]; } 45 [label="Exit function test_3" style="filled" fillcolor=red]; diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.fir.txt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.fir.txt index f357bd5eb59..386fda33475 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/smartcastAfterReassignment.fir.txt @@ -19,5 +19,5 @@ FILE: smartcastAfterReassignment.kt R|/x| = String() R|/x|.R|kotlin/String.length| R|/x| = Null(null) - R|/x|.# + R|/x|.# } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.fir.txt index 53926b57e9e..6712ba24044 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/notIsNullOrEmpty.fir.txt @@ -10,7 +10,7 @@ FILE: notIsNullOrEmpty.kt public final fun test_2(s: R|kotlin/String?|): R|kotlin/Unit| { when () { R|/s|.R|kotlin/text/isNullOrEmpty|() -> { - R|/s|.# + R|/s|.# } else -> { R|/s|.R|kotlin/String.length| diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.fir.txt index 2b5157f85d7..d0e5aab78cb 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/eqNotEq.fir.txt @@ -29,7 +29,7 @@ FILE: eqNotEq.kt R|/x|.R|kotlin/String.length| } else -> { - R|/x|.# + R|/x|.# } } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.fir.txt index 6a2536102b0..354f0d58deb 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/returnsImplies/receivers.fir.txt @@ -33,7 +33,7 @@ FILE: receivers.kt this@R|special/anonymous|.R|/myRequireNotNull|() } ) - R|/x|.#() + R|/x|.#() } public final fun test_4(x: R|A?|): R|kotlin/Unit| { R|kotlin/with|(R|/x|, = with@fun R|A?|.(): R|kotlin/Unit| { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirForLoopChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirForLoopChecker.kt index 8ff228a26f4..c8f765a7787 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirForLoopChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirForLoopChecker.kt @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.fir.expressions.FirFunctionCall import org.jetbrains.kotlin.fir.expressions.FirWhileLoop import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference -import org.jetbrains.kotlin.fir.resolve.calls.InapplicableWrongReceiver +import org.jetbrains.kotlin.fir.resolve.calls.UnsafeCall import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError @@ -105,7 +105,7 @@ object FirForLoopChecker : FirBlockChecker() { is ConeInapplicableCandidateError -> { if (unsafeCallFactory != null || noneApplicableFactory != null) { diagnostic.candidate.diagnostics.filter { it.applicability == diagnostic.applicability }.forEach { - if (it is InapplicableWrongReceiver) { + if (it is UnsafeCall) { if (unsafeCallFactory != null) { reporter.reportOn( reportSource, unsafeCallFactory, context diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt index 8beccf8b439..194858646f0 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt @@ -84,40 +84,34 @@ private fun ConeKotlinType.isEffectivelyNotNull(): Boolean { private fun mapUnsafeCallError( diagnostic: ConeInapplicableCandidateError, source: FirSourceElement, - rootCause: ResolutionDiagnostic?, + rootCause: UnsafeCall, qualifiedAccessSource: FirSourceElement?, -): FirDiagnostic<*>? { - if (rootCause !is InapplicableWrongReceiver) return null - val actualType = rootCause.actualType ?: return null - val expectedType = rootCause.expectedType - if (actualType.isNullable && (expectedType == null || expectedType.isEffectivelyNotNull())) { - if (diagnostic.candidate.callInfo.isImplicitInvoke) { - return FirErrors.UNSAFE_IMPLICIT_INVOKE_CALL.on(source, actualType) - } +): FirDiagnostic<*> { + if (diagnostic.candidate.callInfo.isImplicitInvoke) { + return FirErrors.UNSAFE_IMPLICIT_INVOKE_CALL.on(source, rootCause.actualType) + } - val candidateFunction = diagnostic.candidate.symbol.fir as? FirSimpleFunction - val candidateFunctionName = candidateFunction?.name - val left = diagnostic.candidate.callInfo.explicitReceiver - val right = diagnostic.candidate.callInfo.argumentList.arguments.singleOrNull() - if (left != null && right != null && - source.elementType == KtNodeTypes.OPERATION_REFERENCE && - (candidateFunction?.isOperator == true || candidateFunction?.isInfix == true) - ) { - val operationToken = source.getChild(KtTokens.IDENTIFIER) - if (candidateFunction.isInfix && operationToken?.elementType == KtTokens.IDENTIFIER) { - return FirErrors.UNSAFE_INFIX_CALL.on(source, left, candidateFunctionName!!.asString(), right) - } - if (candidateFunction.isOperator && operationToken == null) { - return FirErrors.UNSAFE_OPERATOR_CALL.on(source, left, candidateFunctionName!!.asString(), right) - } + val candidateFunction = diagnostic.candidate.symbol.fir as? FirSimpleFunction + val candidateFunctionName = candidateFunction?.name + val left = diagnostic.candidate.callInfo.explicitReceiver + val right = diagnostic.candidate.callInfo.argumentList.arguments.singleOrNull() + if (left != null && right != null && + source.elementType == KtNodeTypes.OPERATION_REFERENCE && + (candidateFunction?.isOperator == true || candidateFunction?.isInfix == true) + ) { + val operationToken = source.getChild(KtTokens.IDENTIFIER) + if (candidateFunction.isInfix && operationToken?.elementType == KtTokens.IDENTIFIER) { + return FirErrors.UNSAFE_INFIX_CALL.on(source, left, candidateFunctionName!!.asString(), right) } - return if (source.kind == FirFakeSourceElementKind.ArrayAccessNameReference) { - FirErrors.UNSAFE_CALL.on(source, actualType) - } else { - FirErrors.UNSAFE_CALL.on(qualifiedAccessSource ?: source, actualType) + if (candidateFunction.isOperator && operationToken == null) { + return FirErrors.UNSAFE_OPERATOR_CALL.on(source, left, candidateFunctionName!!.asString(), right) } } - return null + return if (source.kind == FirFakeSourceElementKind.ArrayAccessNameReference) { + FirErrors.UNSAFE_CALL.on(source, rootCause.actualType) + } else { + FirErrors.UNSAFE_CALL.on(qualifiedAccessSource ?: source, rootCause.actualType) + } } private fun mapInapplicableCandidateError( @@ -127,8 +121,6 @@ private fun mapInapplicableCandidateError( ): List> { // TODO: Need to distinguish SMARTCAST_IMPOSSIBLE return diagnostic.candidate.diagnostics.filter { it.applicability == diagnostic.applicability }.mapNotNull { rootCause -> - mapUnsafeCallError(diagnostic, source, rootCause, qualifiedAccessSource)?.let { return@mapNotNull it } - when (rootCause) { is VarargArgumentOutsideParentheses -> FirErrors.VARARG_OUTSIDE_PARENTHESES.on( rootCause.argument.source ?: qualifiedAccessSource @@ -153,6 +145,7 @@ private fun mapInapplicableCandidateError( rootCause.argument.source ?: source, rootCause.argument.name.asString() ) + is UnsafeCall -> mapUnsafeCallError(diagnostic, source, rootCause, qualifiedAccessSource) else -> null } }.ifEmpty { listOf(FirErrors.INAPPLICABLE_CANDIDATE.on(source, diagnostic.candidate.symbol)) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index ecfb7d5616a..f8d609c9fff 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -400,7 +400,7 @@ private fun checkApplicabilityForArgumentType( val nullableExpectedType = expectedType.withNullability(ConeNullability.NULLABLE, context.session.typeContext) if (csBuilder.addSubtypeConstraintIfCompatible(argumentType, nullableExpectedType, position)) { - sink.reportDiagnostic(InapplicableWrongReceiver(expectedType, argumentType)) // TODO + sink.reportDiagnostic(UnsafeCall(argumentType)) // TODO } else { csBuilder.addSubtypeConstraint(argumentType, expectedType, position) sink.reportDiagnostic(InapplicableWrongReceiver(expectedType, argumentType)) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt index 000446bee01..d1649c64168 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt @@ -5,12 +5,12 @@ package org.jetbrains.kotlin.fir.resolve.calls -import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget import org.jetbrains.kotlin.fir.declarations.FirFunction import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirNamedArgumentExpression import org.jetbrains.kotlin.fir.types.ConeKotlinType +import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability.* @@ -67,6 +67,8 @@ class InapplicableWrongReceiver( val actualType: ConeKotlinType? = null, ) : ResolutionDiagnostic(INAPPLICABLE_WRONG_RECEIVER) +class UnsafeCall(val actualType: ConeKotlinType) : ResolutionDiagnostic(UNSAFE_CALL) + object LowerPriorityToPreserveCompatibilityDiagnostic : ResolutionDiagnostic(RESOLVED_NEED_PRESERVE_COMPATIBILITY) object CandidateChosenUsingOverloadResolutionByLambdaAnnotation : ResolutionDiagnostic(RESOLVED) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt index 327cfb992a4..d3609fc9e3f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt @@ -6,19 +6,22 @@ package org.jetbrains.kotlin.fir.resolve.calls import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.fir.* +import org.jetbrains.kotlin.fir.FirSymbolOwner +import org.jetbrains.kotlin.fir.FirVisibilityChecker import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier import org.jetbrains.kotlin.fir.references.FirSuperReference -import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.inference.* +import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.symbols.SyntheticSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol +import org.jetbrains.kotlin.fir.typeContext import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.visibilityChecker import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -106,7 +109,7 @@ object CheckDispatchReceiver : ResolutionStage() { val dispatchReceiverValueType = candidate.dispatchReceiverValue?.type ?: return if (!AbstractNullabilityChecker.isSubtypeOfAny(context.session.typeContext, dispatchReceiverValueType)) { - sink.yieldDiagnostic(InapplicableWrongReceiver(actualType = dispatchReceiverValueType)) + sink.yieldDiagnostic(UnsafeCall(dispatchReceiverValueType)) } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt index 66fcf59578e..1bd595d3a11 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt @@ -954,6 +954,7 @@ fun CandidateApplicability.toResolutionStatus(): ResolutionStatus = when (this) CandidateApplicability.RESOLVED_WITH_ERROR, CandidateApplicability.RESOLVED_NEED_PRESERVE_COMPATIBILITY -> ResolutionStatus.SUCCESS CandidateApplicability.INAPPLICABLE_WRONG_RECEIVER -> ResolutionStatus.RECEIVER_TYPE_ERROR + CandidateApplicability.UNSAFE_CALL -> ResolutionStatus.UNSAFE_CALL_ERROR else -> ResolutionStatus.OTHER_ERROR } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt index 2c7bc883869..72d6ba0bb2a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolutionOldInference.kt @@ -611,7 +611,7 @@ internal class PreviousResolutionError(candidateLevel: CandidateApplicability) : internal fun createPreviousResolveError(status: ResolutionStatus): PreviousResolutionError? { val level = when (status) { ResolutionStatus.SUCCESS, ResolutionStatus.INCOMPLETE_TYPE_INFERENCE -> return null - ResolutionStatus.UNSAFE_CALL_ERROR -> CandidateApplicability.MAY_THROW_RUNTIME_ERROR + ResolutionStatus.UNSAFE_CALL_ERROR -> CandidateApplicability.UNSAFE_CALL ResolutionStatus.ARGUMENTS_MAPPING_ERROR -> CandidateApplicability.INAPPLICABLE_ARGUMENTS_MAPPING_ERROR ResolutionStatus.RECEIVER_TYPE_ERROR -> CandidateApplicability.INAPPLICABLE_WRONG_RECEIVER else -> CandidateApplicability.INAPPLICABLE diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/tower/CandidateApplicability.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/tower/CandidateApplicability.kt index bc78dba1389..32c0a63006f 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/tower/CandidateApplicability.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/tower/CandidateApplicability.kt @@ -13,7 +13,8 @@ enum class CandidateApplicability { INAPPLICABLE, // arguments have wrong types IMPOSSIBLE_TO_GENERATE, // access to outer class from nested RUNTIME_ERROR, // problems with visibility - MAY_THROW_RUNTIME_ERROR, // unsafe call or unstable smart cast + UNSAFE_CALL, // receiver nullability doesn't match + MAY_THROW_RUNTIME_ERROR, // unstable smart cast CONVENTION_ERROR, // missing infix, operator etc RESOLVED_LOW_PRIORITY, RESOLVED_NEED_PRESERVE_COMPATIBILITY, // call resolved successfully, but using new features that changes resolve diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt index 6fc88d0a7df..6c17765699a 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/model/KotlinCallDiagnostics.kt @@ -170,7 +170,7 @@ class UnstableSmartCastDiagnosticError( class UnsafeCallError( val receiver: SimpleKotlinCallArgument, val isForImplicitInvoke: Boolean = false -) : KotlinCallDiagnostic(MAY_THROW_RUNTIME_ERROR) { +) : KotlinCallDiagnostic(UNSAFE_CALL) { override fun report(reporter: DiagnosticReporter) = reporter.onCallReceiver(receiver, this) } diff --git a/compiler/testData/diagnostics/tests/Nullability.fir.kt b/compiler/testData/diagnostics/tests/Nullability.fir.kt index 00edb39d0e7..0d16457de5f 100644 --- a/compiler/testData/diagnostics/tests/Nullability.fir.kt +++ b/compiler/testData/diagnostics/tests/Nullability.fir.kt @@ -38,13 +38,13 @@ fun test() { if (out != null && ins != null || out != null) { ins?.read(); - ins.read(); + ins.read(); out.println(); } if (out == null || out.println(0) == Unit) { out?.println(1) - out.println(1) + out.println(1) } else { out.println(2) @@ -66,11 +66,11 @@ fun test() { if (1 == 2 || out != null && out.println(1) == Unit) { out?.println(2); - out.println(2); + out.println(2); } else { out?.println(3) - out.println(3) + out.println(3) } out?.println() @@ -103,7 +103,7 @@ fun test() { if (out == null || out.println(0) == Unit) { out?.println(1) - out.println(1) + out.println(1) } else { out.println(2) @@ -114,12 +114,12 @@ fun test() { } else { out?.println(); - out.println(); + out.println(); } if (out == null || out.println() == Unit) { out?.println(); - out.println(); + out.println(); } else { out.println(); @@ -127,11 +127,11 @@ fun test() { if (1 == 2 || out != null && out.println(1) == Unit) { out?.println(2); - out.println(2); + out.println(2); } else { out?.println(3) - out.println(3) + out.println(3) } if (1 > 2) { @@ -149,7 +149,7 @@ fun test() { while (out2 == null) { out2?.println(); - out2.println(); + out2.println(); } out2.println() diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.fir.kt index ef72c1e2395..81330555a2f 100644 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.fir.kt +++ b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.fir.kt @@ -19,14 +19,14 @@ fun main(x: F, y: F, z: F, w: F, m: F) { val w1 = if (z != null) z else return val w2: F!! = if (w != null) w else return - y1.foo() - y2.foo() + y1.foo() + y2.foo() x1.foo() - x2.foo() + x2.foo() z1.foo() - z2.foo() + z2.foo() w1.foo() - w2.foo() + w2.foo() expectNN(m) expectNN(m!!) diff --git a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt index abd2550140a..2a24d9a4177 100644 --- a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt @@ -8,7 +8,7 @@ fun List.a() {} fun test1(i: Int?) { 1.a() - i.a() + i.a() } fun test2(c: Collection) { @@ -19,7 +19,7 @@ fun Int.foo() {} fun test3(s: String?) { "".foo() - s.foo() + s.foo() "".foo(1) s.foo("a") } @@ -52,5 +52,5 @@ fun test7(l: List) { } fun test8(l: List?) { - l.b() + l.b() } diff --git a/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt index b5582d032e6..19ab29f9bf5 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/expressionsBoundsViolation.fir.kt @@ -13,7 +13,7 @@ fun bar(x: F) { foo1(x) foo1(x) - x.foo2() + x.foo2() x.foo2() } diff --git a/compiler/testData/diagnostics/tests/generics/nullability/functionalBound.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/functionalBound.fir.kt index 08d44428c98..f456eea3bd5 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/functionalBound.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/functionalBound.fir.kt @@ -1,6 +1,6 @@ fun Unit)?> foo(x: E, y: T) { if (x != null) { - y(x) + y(x) } if (y != null) { diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.fir.kt index b00a969aac8..5295ff253a8 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCastRefinedClass.fir.kt @@ -1,6 +1,6 @@ fun foo(x: T) { if (x is String?) { - x.length + x.length if (x != null) { x.length diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt index e31f09c7d92..a69eea7da2f 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCasts.fir.kt @@ -24,7 +24,7 @@ fun foo(x: T) { x?.bar1() } - x.length + x.length if (x is String) { x.length diff --git a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt index b60da381b9f..ced57f85d58 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt @@ -23,7 +23,7 @@ fun T.foo() { this?.bar1() } - length + length if (this is String) { length diff --git a/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.fir.kt index de78b5e4e64..46aafea8786 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/tpInBounds.fir.kt @@ -8,7 +8,7 @@ class A { x.bar() if (1 == 1) { - y.bar() + y.bar() } x?.bar() diff --git a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt index dd30e3ef6da..4add13feaa1 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt @@ -7,7 +7,7 @@ fun CharSequence?.bar2() {} fun T.bar3() {} fun foo(x: T) { - x.length + x.length x?.length if (1 == 1) { @@ -21,7 +21,7 @@ fun foo(x: T) { x?.bar1() x?.bar2() - x.bar3() + x.bar3() x?.let { it.length } } diff --git a/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt index e5b427e5149..c24e96f737d 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt557.fir.kt @@ -8,5 +8,5 @@ fun Array.length() : Int { } fun test(array : Array?) { - array?.sure>().length() + array?.sure>().length() } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt index b47186d0eeb..2902fef2d90 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/implicitInvokeAfterSafeCall.fir.kt @@ -80,7 +80,7 @@ operator fun Foo6.invoke(x: Int) {} fun main(x: Bar6?) { x?.value(1) - x?.value.invoke(1) + x?.value.invoke(1) } // Test case 7: top-level generic invoke and invoke with compatible additional dispatch recevier @@ -108,7 +108,7 @@ operator fun Foo8.invoke(x: Int) {} fun main(x: Bar8?) { x?.value(1) - x?.value.invoke(1) + x?.value.invoke(1) } // Test case 9: additional receiver, generic invoke with pure type perameter receiver diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt index 822774ec9a7..4fbeeccf8cb 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt @@ -12,7 +12,7 @@ fun test(a: A) { with("") { a.x() - (a.x)() + (a.x)() if (a.x != null) { a.x() // todo (a.x)() diff --git a/compiler/testData/diagnostics/tests/typealias/kt15734.fir.kt b/compiler/testData/diagnostics/tests/typealias/kt15734.fir.kt index b7a667b24da..4f4b986100a 100644 --- a/compiler/testData/diagnostics/tests/typealias/kt15734.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/kt15734.fir.kt @@ -15,5 +15,5 @@ val test5: List = TODO() val test6: () -> List = TODO() fun test(x: TNString) { - x.hashCode() + x.hashCode() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt index 61e34280411..31050be60fe 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/restrictSuspension/outerYield_1_3.fir.kt @@ -87,7 +87,7 @@ fun test() { this@with.yield("") yield2("") - this@with.yield2("") + this@with.yield2("") } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt index 0c74591b5f3..da5939c25c9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt @@ -103,8 +103,8 @@ fun case_7() { // TESTCASE NUMBER: 8 fun case_8(x: TypealiasNullableString) { - if (x !== null === null && x != null != null) x.get(0) - if (x !== null != null && x != null === null) x.get(0) + if (x !== null === null && x != null != null) x.get(0) + if (x !== null != null && x != null === null) x.get(0) } // TESTCASE NUMBER: 9 @@ -169,11 +169,11 @@ fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndire else if ((y === null !== null) is Boolean) x else if (y === null != null) x.equals(null) else if (y === null != null) x.propT - else if (y === null != null) x.propAny + else if (y === null != null) x.propAny else if (y === null != null) x.propNullableT else if (y === null != null) x.propNullableAny else if (y === null != null) x.funT() - else if (y === null != null) x.funAny() + else if (y === null != null) x.funAny() else if (y === null != null) x.funNullableT() else if (y === null != null) x.funNullableAny() else "-1" @@ -256,7 +256,7 @@ fun case_16() { if (x != null !is Boolean !is Boolean !is Boolean !is Boolean !is Boolean) { x - x.java + x.java } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt index 3efe850ab52..678c046f809 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt @@ -14,7 +14,7 @@ fun case_1(x: Class?) { fun case_2() { var x: Class? = 10 x!! - x(if (true) {x=null;0} else 0, x) + x(if (true) {x=null;0} else 0, x) x x.fun_1() } @@ -23,7 +23,7 @@ fun case_2() { fun case_3() { var x: Class? = Class() x!! - val y = x[if (true) {x=null;0} else 0, x[0]] + val y = x[if (true) {x=null;0} else 0, x[0]] x x.fun_1() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt index 2f8844df640..2edb2787f86 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt @@ -20,7 +20,7 @@ inline fun case_1(x: T) { inline fun case_2(x: T) { x as K x - x.equals(x) + x.equals(x) } /* @@ -49,7 +49,7 @@ inline fun case_4(x: T?) { inline fun case_5(x: T) { if (x is K?) { x - x.equals(x) + x.equals(x) } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt index 17a2d9ccf94..1d2f7ad379d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt @@ -41,9 +41,9 @@ fun case_3() { fun case_4() { var x: Class? = Class() x!! - val y = x[if (true) {x=null;0} else 0, x[0]] + val y = x[if (true) {x=null;0} else 0, x[0]] x - x[0].inv() + x[0].inv() } /* @@ -54,7 +54,7 @@ fun case_4() { fun case_5() { var x: Class? = Class() x!! - x(if (true) {x=null;0} else 0, x) + x(if (true) {x=null;0} else 0, x) x.fun_1() } @@ -75,7 +75,7 @@ fun case_6() { fun case_7() { var x: Class? = Class() x!! - x(if (true) {x=null;0} else 0)(x) + x(if (true) {x=null;0} else 0)(x) x.fun_1() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt index 8f65710a4cc..5badd939ed2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt @@ -50,14 +50,14 @@ fun case_4(x: Class?, y: Any) { fun case_5(x: Class?, y: String?) { x?.prop_12 = y ?: return y - y.toUpperCase() + y.toUpperCase() } // TESTCASE NUMBER: 6 fun case_6(x: Class?, y: String?) { x?.prop_9 = y !is String && throw Exception() y - y.toUpperCase() + y.toUpperCase() } /* @@ -68,7 +68,7 @@ fun case_6(x: Class?, y: String?) { fun case_7(x: Class?, y: String?) { x?.prop_12 = y!! y - y.toUpperCase() + y.toUpperCase() } /* @@ -79,5 +79,5 @@ fun case_7(x: Class?, y: String?) { fun case_8(x: Class?, y: String?) { x?.prop_12 = if (y === null) throw Exception() else "" y - y.toUpperCase() + y.toUpperCase() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt index 97149066ff2..c21b755c31c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt @@ -20,7 +20,7 @@ fun case_1(x: Any) { fun case_2(x: Any?) { if (x is Int || x is Float?) { ?")!>x - ?")!>x.toByte() + ?")!>x.toByte() } } @@ -31,7 +31,7 @@ fun case_2(x: Any?) { fun case_3(x: Any?) { if (x is Int? || x is Float) { ?")!>x - ?")!>x.toByte() + ?")!>x.toByte() } } @@ -75,7 +75,7 @@ fun case_6(x: T) { fun case_7(x: T) { if (x is Int? || x is Float?) { ? & T")!>x - ? & T")!>x.toByte() + ? & T")!>x.toByte() } } @@ -86,7 +86,7 @@ fun case_7(x: T) { inline fun case_8(x: T) { if (x is Int? || x is Float?) { ? & T")!>x - ? & T")!>x.toByte() + ? & T")!>x.toByte() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt index 30061b6d5fa..6e518b89218 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt @@ -8,7 +8,7 @@ fun case_1(x: T?, y: K?) { y as K val z = x ?: y - x.equals(10) + x.equals(10) z z.equals(10) } @@ -18,5 +18,5 @@ inline fun case_2(y: K?) { y as K y - y.equals(10) + y.equals(10) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt index f03092b521a..484f872b425 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt @@ -8,31 +8,31 @@ fun case_1(x: T) { if (y != x) { x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() - x.apply { equals(null) } + x.apply { equals(null) } x.apply { propT } - x.apply { propAny } + x.apply { propAny } x.apply { propNullableT } x.apply { propNullableAny } x.apply { funT() } - x.apply { funAny() } + x.apply { funAny() } x.apply { funNullableT() } - x.apply { funNullableAny(); x.equals(null) } - x.also { it.equals(null) } + x.apply { funNullableAny(); x.equals(null) } + x.also { it.equals(null) } x.also { it.propT } - x.also { it.propAny } + x.also { it.propAny } x.also { it.propNullableT } x.also { it.propNullableAny } x.also { it.funT() } - x.also { it.funAny() } + x.also { it.funAny() } x.also { it.funNullableT() } x.also { it.funNullableAny() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt index e7c9655bddf..4b2cdeb9831 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt @@ -244,13 +244,13 @@ fun case_18(x: T, f: Boolean) { while (f) { if (false || false || false || x == nullableNothingProperty) break x - x.equals(null) + x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -261,23 +261,23 @@ fun case_19(map: MutableMap, y: Nothing?) { for ((k, v) in map) { if (k !== implicitNullableNothingProperty && true && v != y) else { break } k - k.equals(null) + k.equals(null) k.propT - k.propAny + k.propAny k.propNullableT k.propNullableAny k.funT() - k.funAny() + k.funAny() k.funNullableT() k.funNullableAny() v - v.equals(null) + v.equals(null) v.propT - v.propAny + v.propAny v.propNullableT v.propNullableAny v.funT() - v.funAny() + v.funAny() v.funNullableT() v.funNullableAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt index 8afba637062..7bce4c1a7f0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt @@ -142,11 +142,11 @@ fun case_8(x: TypealiasNullableString) { x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } @@ -225,11 +225,11 @@ fun case_12(x: TypealiasNullableString, y: TypealiasNullableString, z1: Nothing? x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } else "-1" @@ -859,11 +859,11 @@ fun case_47(x: TypealiasNullableString, y: TypealiasNullableString, z: Nothing?) x x.equals(null) x.propT - x.propAny + x.propAny x.propNullableT x.propNullableAny x.funT() - x.funAny() + x.funAny() x.funNullableT() x.funNullableAny() } else "-1" @@ -1296,11 +1296,11 @@ fun case_71(t: Any?) { if (t is Interface2?) { if (t != z2) { t - t.itest1() - t.itest2() - t.itest() + t.itest1() + t.itest2() + t.itest() - t.let { it.itest1(); it.itest2() } + t.let { it.itest1(); it.itest2() } } } } @@ -1318,11 +1318,11 @@ fun case_72(t: Any?, z1: Nothing?) { if (t is Interface1? && t != z1 ?: z2 && t is Interface2?) { t - t.itest1() - t.itest2() - t.itest() + t.itest1() + t.itest2() + t.itest() - t.let { it.itest1(); it.itest2() } + t.let { it.itest1(); it.itest2() } } } @@ -1341,11 +1341,11 @@ fun case_73(t: Any?) { if (t is ClassLevel2? && t is Interface1?) { if (t !is Interface3?) {} else if (false) { if (t != `null`) { - t.itest2() - t.itest1() - t.itest() - t.test1() - t.test2() + t.itest2() + t.itest1() + t.itest() + t.test1() + t.test2() t } } @@ -1366,11 +1366,11 @@ fun case_74(t: Any?) { if (t == implicitNullableNothingProperty || t === implicitNullableNothingProperty || t !is Interface1?) else { if (t is ClassLevel2?) { if (t is Interface3?) { - t.itest2() - t.itest1() - t.itest() - t.test1() - t.test2() + t.itest2() + t.itest1() + t.itest() + t.test1() + t.test2() t } } @@ -1389,11 +1389,11 @@ fun case_75(t: Any?, z: Nothing?) { if (t !is ClassLevel2? || t !is ClassLevel1?) else { if (t === ((((((z)))))) || t !is Interface1?) else { if (t !is Interface2? || t !is Interface3?) {} else { - t.itest2() - t.itest1() - t.itest() - t.test1() - t.test2() + t.itest2() + t.itest1() + t.itest() + t.test1() + t.test2() t } }