Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/kt10232.kt
T
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00

16 lines
346 B
Kotlin
Vendored

// 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 (<!USELESS_IS_CHECK!>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
}