Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/cast/AsInsideIn.kt
T
Dmitriy Novozhilov d01b6ef900 Revert "[NI] Support @OnlyInputTypes annotation. #KT-29307 fixed"
This reverts commit 90628112
With that annotation there is complex bug that breaks build of Kotlin compiler
2019-03-18 18:53:38 +03:00

21 lines
514 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// See also KT-10386
interface A
class B : A
fun foo1(list: List<A>, arg: B?): Boolean {
// Type mismatch
return arg <!OI;TYPE_INFERENCE_ONLY_INPUT_TYPES!>in<!> list // resolved to extension
}
fun foo2(list: List<A>, arg: B?): Boolean {
// FAKE: no cast needed
return arg as A? in list
}
fun foo3(list: List<A>, arg: B?): Boolean {
// No warning but KNPE risk
return arg!! in list
}
// But
fun foo4(list: List<A>, arg: B): Boolean {
// Ok
return arg in list
}