[FIR] Implement new bound smartcast algorithm

#KT-36055 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-02-10 17:14:58 +03:00
parent 40f907ec2f
commit 6735cc8937
103 changed files with 2197 additions and 309 deletions
@@ -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<!>
}
@@ -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
}
@@ -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
}