[NI] Don't stop on a candidate with unstable smartcast error

#KT-36847 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2020-02-20 03:08:29 +03:00
parent 162a2d5851
commit 83824d0ba6
7 changed files with 86 additions and 100 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ class Cls {
fun test(s: String) {
if (s.ext is B)
take(<!NI;SMARTCAST_IMPOSSIBLE, SMARTCAST_IMPOSSIBLE!>s.ext<!>)
take(<!OI;SMARTCAST_IMPOSSIBLE!>s.ext<!>)
}
}
@@ -18,7 +18,7 @@ fun foo(list: StringList, arg: Unstable) {
list.remove(arg.first)
if (arg.first?.isEmpty() ?: false) {
// Should be still resolved to extension, without smart cast or smart cast impossible
list.remove(<!NI;SMARTCAST_IMPOSSIBLE, SMARTCAST_IMPOSSIBLE!>arg.first<!>)
list.remove(<!OI;SMARTCAST_IMPOSSIBLE!>arg.first<!>)
}
}
@@ -36,6 +36,6 @@ fun bar(list: BooleanList, arg: UnstableBoolean) {
list.remove(arg.first)
if (arg.first ?: false) {
// Should be still resolved to extension, without smart cast or smart cast impossible
list.remove(<!NI;SMARTCAST_IMPOSSIBLE, SMARTCAST_IMPOSSIBLE!>arg.first<!>)
list.remove(<!OI;SMARTCAST_IMPOSSIBLE!>arg.first<!>)
}
}
@@ -9,5 +9,5 @@ fun main() {
var y: Number? = null
y = 2
{ y = 1 }
Test.foo(<!SMARTCAST_IMPOSSIBLE, SMARTCAST_IMPOSSIBLE!>y<!>)
Test.foo(y)
}