Original type is taken into account when intersecting possible types in resolve #KT-10232 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-11-30 17:36:12 +03:00
committed by Stanislav Erokhin
parent db2521ee67
commit fe04cc513b
5 changed files with 39 additions and 2 deletions
@@ -0,0 +1,15 @@
// Type inference failed after smart cast
interface A<T>
interface B<T> : A<T>
fun <T> foo(b: A<T>) = b
fun <T> test(a: A<T>) {
if (a is Any) {
// Error:(9, 9) Kotlin: Type inference failed: fun <T> foo(b: A<T>): kotlin.Unit
// cannot be applied to (A<T>)
foo(a)
}
foo(a) // ok
}