Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/kt282.fir.kt
T
Jinseong Jeon e72ddbcbfe FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00

20 lines
408 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// KT-282 Nullability in extension functions and in binary calls
class Set {
operator fun contains(x : Int) : Boolean = true
}
operator fun Set?.plus(x : Int) : Int = 1
operator fun Int?.contains(x : Int) : Boolean = false
fun f(): Unit {
var set : Set? = null
val i : Int? = null
i <!NONE_APPLICABLE!>+<!> 1
set + 1
1 <!UNSAFE_CALL!>in<!> set
1 in 2
}