Files
kotlin-fork/compiler/testData/diagnostics/tests/nullabilityAndAutoCasts/kt2336.kt
T
Svetlana Isakova cc3f450132 added test for obsolete task
#KT-2336 Fixed
2013-12-11 19:53:52 +04:00

11 lines
477 B
Kotlin

fun main(args: Array<String>) {
val b: Boolean? = null
if (b != null) {
if (!<!DEBUG_INFO_AUTOCAST!>b<!>) {} // OK
if (<!DEBUG_INFO_AUTOCAST!>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_AUTOCAST!>b<!>) // OK
}
}
fun foo(a: Boolean) = a