NI: Fix smart-cast related regression

See the test and the issue for the clarification
After the change 7898922066
the expected type for "a" in expression "foo(a)" is A<E & B<*>>
But we have the original type A<E> and smart-casted enriched type A<B<*>>
(non of them is a subtype of A<E & B<*>>)
and fail in checkTypeInternal when checking types in during completion

^KT-35844 Fixed
This commit is contained in:
Denis Zharkov
2020-01-10 18:20:44 +03:00
parent 02d9f258d1
commit 7255ee0a5b
6 changed files with 62 additions and 1 deletions
@@ -0,0 +1,17 @@
// SKIP_TXT
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +NewInference
class A<X>
class B<T> {
fun b(): T = TODO()
}
fun <Y> foo(c: A<Y>): Y = TODO()
fun <E> main(a: A<E>) {
a as A<B<*>>
foo(a).b()
}
@@ -0,0 +1,17 @@
// SKIP_TXT
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !LANGUAGE: +NewInference
class A<X>
class B<T> {
fun b(): T = TODO()
}
fun <Y> foo(c: A<Y>): Y = TODO()
fun <E> main(a: A<E>) {
a <!UNCHECKED_CAST!>as A<B<*>><!>
foo(<!DEBUG_INFO_SMARTCAST!>a<!>).b()
}