[FIR] Implement new bound smartcast algorithm
#KT-36055 Fixed
This commit is contained in:
@@ -6,5 +6,5 @@ public fun foo(p: String?): Int {
|
||||
if (x()) break
|
||||
}
|
||||
// p is nullable because it's possible loop body is not executed at all
|
||||
return p.length
|
||||
return p.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
}
|
||||
@@ -7,5 +7,5 @@ public fun foo(p: String?): Int {
|
||||
if (x()) break
|
||||
}
|
||||
// Smart cast should not work in this case, see KT-6284
|
||||
return p.length
|
||||
return p.<!INAPPLICABLE_CANDIDATE!>length<!>
|
||||
}
|
||||
Vendored
+2
-2
@@ -8,7 +8,7 @@ fun foo() {
|
||||
|
||||
}
|
||||
// TODO: this testdata fixates undesired behavior (it should be an unsafe call)
|
||||
x.<!UNRESOLVED_REFERENCE!>length<!> // 'x' is unsoundly smartcasted here
|
||||
x.length // 'x' is unsoundly smartcasted here
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
@@ -19,5 +19,5 @@ fun bar() {
|
||||
|
||||
}
|
||||
// TODO: this testdata fixates undesired behavior (it should be an unsafe call)
|
||||
x.<!UNRESOLVED_REFERENCE!>size<!> // 'x' is unsoundly smartcasted here
|
||||
x.size // 'x' is unsoundly smartcasted here
|
||||
}
|
||||
compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakBefore.fir.kt
Vendored
+2
-2
@@ -7,7 +7,7 @@ fun foo() {
|
||||
break
|
||||
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>length<!> // 'x' is unsoundly smartcasted here
|
||||
x.length // 'x' is unsoundly smartcasted here
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
@@ -17,5 +17,5 @@ fun bar() {
|
||||
break
|
||||
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>size<!> // 'x' is unsoundly smartcasted here
|
||||
x.size // 'x' is unsoundly smartcasted here
|
||||
}
|
||||
Reference in New Issue
Block a user