FIR DFA: fork flow everywhere
In theory, forking persistent flows should be cheap because of object reuse, so the proposal here is to start from scratch and prove redundancy of forks on a case-by-case basis. Something something better safe than sorry. ^KT-28333 tag fixed-in-k2 ^KT-28489 tag fixed-in-k2
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ fun calc(x: String?, y: String?): Int {
|
||||
// x is not null in condition but we do not see it yet
|
||||
} while (x.length > 0)
|
||||
// y is nullable because of break
|
||||
y.length
|
||||
y<!UNSAFE_CALL!>.<!>length
|
||||
// x is not null, at least in theory
|
||||
return x.length
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -7,5 +7,5 @@ fun test(foo: Foo?) {
|
||||
// Unnecessary
|
||||
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length
|
||||
}
|
||||
foo.bar<!UNNECESSARY_SAFE_CALL!>?.<!>length
|
||||
foo.bar?.length
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ fun foo(y: String?) {
|
||||
if (x != null) {
|
||||
with(y?.let { x = null; it }) {
|
||||
this<!UNSAFE_CALL!>.<!>length
|
||||
x<!UNSAFE_CALL!>.<!>length
|
||||
<!SMARTCAST_IMPOSSIBLE!>x<!>.length
|
||||
}
|
||||
x<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user