Files
kotlin-fork/compiler/testData/ir/irText/expressions/bangbang.kt
T
Dmitry Petrov 7170439517 IR: '!!' is generated as 'CHECK_NOT_NULL' intrinsic
```
fun <T : Any> CHECK_NOT_NULL(x: T?): x =
  if (x != null) x else throw NullPointerException(...)
```

This allows to compile both Kotlin/JVM and Kotlin/JS effectively.
2019-08-14 11:16:10 +03:00

11 lines
205 B
Kotlin
Vendored

fun test1(a: Any?) = a!!
fun test2(a: Any?) = a?.hashCode()!!
fun <X> test3(a: X) = a!!
fun useString(s: String) {}
fun <X> test4(a: X) {
if (a is String?) a!!
if (a is String?) useString(a!!)
}