Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/kt282.kt
T
Dmitry Savvinov 816d89e393 [NI] Improved testdata after changes in applicabilities
This commits introduces testdata changes, where NI behaviour strictly
improved, after several previous fixes.

For some tests, just WITH_NEW_INFERENCE directive was added. It
indicates, that some of previous commits first introduced error in that
test, and then some other commit fixed it (netting no overall testdata
change). It is preferrably to keep those annotations until we will
migrate to NI completely, to prevent unexpected regressions.
2017-12-07 12:49:56 +03:00

20 lines
491 B
Kotlin
Vendored

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