FIR: report UNSAFE_CALL on dot when possible
This commit is contained in:
-7
@@ -1,7 +0,0 @@
|
||||
// KT-9051: Allow smart cast for captured variables if they are not modified
|
||||
|
||||
fun foo(y: String?) {
|
||||
var x: String? = null
|
||||
y?.let { x = it }
|
||||
x.<!UNSAFE_CALL!>length<!> // Smart cast is not possible
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// KT-9051: Allow smart cast for captured variables if they are not modified
|
||||
|
||||
fun foo(y: String?) {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun bar(z: String?) = z
|
||||
fun foo(y: String?) {
|
||||
var x: String? = ""
|
||||
if (x != null) {
|
||||
bar(y?.let { x = null; it }).<!UNSAFE_CALL!>length<!>
|
||||
bar(y?.let { x = null; it })<!UNSAFE_CALL!>.<!>length
|
||||
x.length // Smart cast is not possible
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ fun foo(y: String?) {
|
||||
var x: String? = ""
|
||||
if (x != null) {
|
||||
with(y?.let { x = null; it }) {
|
||||
this.<!UNSAFE_CALL!>length<!>
|
||||
this<!UNSAFE_CALL!>.<!>length
|
||||
x.length
|
||||
}
|
||||
x.length
|
||||
|
||||
Reference in New Issue
Block a user