[NI] Continue resolution after unstable smart cast on receiver
The old inference cosideres candidates with unstable smartcast on receiver unsuccessful, therefore another one may be selected. KT-36264
This commit is contained in:
@@ -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(<!OI;SMARTCAST_IMPOSSIBLE!>arg.first<!>)
|
||||
list.remove(<!NI;SMARTCAST_IMPOSSIBLE, 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(<!OI;SMARTCAST_IMPOSSIBLE!>arg.first<!>)
|
||||
list.remove(<!NI;SMARTCAST_IMPOSSIBLE, SMARTCAST_IMPOSSIBLE!>arg.first<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
fun create(): Map<String, String> = null!!
|
||||
|
||||
operator fun <K, V> Map<K, V>.iterator(): Iterator<Map.Entry<K, V>> = null!!
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
fun create(): Map<String, String> = null!!
|
||||
|
||||
operator fun <K, V> Map<K, V>.iterator(): Iterator<Map.Entry<K, V>> = null!!
|
||||
@@ -13,7 +15,7 @@ class MyClass {
|
||||
m = create()
|
||||
// See KT-7428
|
||||
for ((k, v) in <!SMARTCAST_IMPOSSIBLE!>m<!>)
|
||||
res += (k.length + v.length)
|
||||
res <!NI;OVERLOAD_RESOLUTION_AMBIGUITY!>+=<!> (<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>k<!>.<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>length<!> <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>+<!> <!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>v<!>.<!NI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>length<!>)
|
||||
return res
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user