Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/kt201.kt
T
2013-12-11 19:53:50 +04:00

9 lines
235 B
Kotlin

// KT-201 Allow to call extension with nullable receiver with a '.'
fun <T : Any> T?.npe() : T = if (this == null) throw NullPointerException() else <!DEBUG_INFO_AUTOCAST!>this<!>
fun foo() {
val i : Int? = 1
i.npe() // error!
}