Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/regressions/kt35844.kt
T
Denis Zharkov 7255ee0a5b 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
2020-01-14 17:35:24 +03:00

18 lines
269 B
Kotlin
Vendored

// 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()
}