7170439517
``` 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.
11 lines
205 B
Kotlin
Vendored
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!!)
|
|
} |