Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/regressions/kt2286.fir.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

28 lines
682 B
Kotlin
Vendored

// KT-2286 Improve error message for nullability check failure for extension methods
package n
abstract class Buggy {
abstract val coll : Collection<Int>
fun getThree(): Int? {
return coll.find{ it > 3 } // works fine
}
val anotherThree : Int
get() = <!TYPE_MISMATCH!>coll.find{ it > 3 }<!> // does not work here
val yetAnotherThree : Int
get() = <!TYPE_MISMATCH!>coll.find({ v:Int -> v > 3 })<!> // neither here
val extendedGetter : Int
get() {
return <!TYPE_MISMATCH!>coll.find{ it > 3 }<!> // not even here!
}
}
//from library
fun <T: Any> Iterable<T>.find(predicate: (T) -> Boolean) : T? {}