Files
kotlin-fork/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2336.kt
T
2014-10-01 18:52:52 +04:00

11 lines
480 B
Kotlin

fun main(args: Array<String>) {
val b: Boolean? = null
if (b != null) {
if (!<!DEBUG_INFO_SMARTCAST!>b<!>) {} // OK
if (<!DEBUG_INFO_SMARTCAST!>b<!>) {} // Error: Condition must be of type jet.Boolean, but is of type jet.Boolean?
if (b<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>) {} // WARN: Unnecessary non-null assertion (!!) on a non-null receiver of type jet.Boolean?
foo(<!DEBUG_INFO_SMARTCAST!>b<!>) // OK
}
}
fun foo(a: Boolean) = a