[FE] Always infer upper types to intersection types in K2...

...and always use old algorithm for K1

^KT-51221
This commit is contained in:
Dmitriy Novozhilov
2022-11-28 17:54:55 +02:00
committed by Space Team
parent d50c072af0
commit ac7fddaad5
15 changed files with 42 additions and 25 deletions
@@ -13,7 +13,7 @@ fun <T: A> emptyNullableListOfA(): List<T>? = null
fun testExclExcl() {
<!INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION("T; a/A, kotlin/Int; final class and interface")!>doList<!>(emptyNullableListOfA()!!) //should be an error here
val l: List<Int> = <!INITIALIZER_TYPE_MISMATCH, NEW_INFERENCE_ERROR!>id(emptyNullableListOfA()!!)<!>
val l: List<Int> = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.List<a.A & kotlin.Int>")!>id(emptyNullableListOfA()!!)<!>
doList(strangeNullableList { doInt(it) }!!) //lambda should be analyzed (at completion phase)
}