[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
@@ -5,7 +5,7 @@ public class X {
public fun fn(): Int {
if (y != null)
// With non-default getter smartcast is not possible
return y.length
return y.<!INAPPLICABLE_CANDIDATE!>length<!>
else
return 0
}
@@ -7,5 +7,5 @@ infix fun Int.bar(i: Int) = i
fun test() {
val p = A()
// For open value properties, smart casts should not work
if (p.foo is Int) p.foo bar 11
if (p.foo is Int) p.foo <!INAPPLICABLE_CANDIDATE!>bar<!> 11
}
@@ -4,10 +4,10 @@ public class X {
public fun fn(): Int {
if (x != null)
// Smartcast is not possible for variable properties
return x.length
return x.<!INAPPLICABLE_CANDIDATE!>length<!>
else if (y != null)
// Even if they are private
return y.length
return y.<!INAPPLICABLE_CANDIDATE!>length<!>
else
return 0
}