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:
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user