Files
kotlin-fork/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt.txt
T
Dmitriy Novozhilov b454fcc1e0 [FIR] Save IR dumps to .ir.txt files instead of .txt in tests
This is needed to avoid clashes between different dumps from different
  handlers
2021-10-12 17:26:36 +03:00

34 lines
663 B
Plaintext
Vendored

fun test1(x: String?): Int {
return when {
EQEQ(arg0 = x, arg1 = null) -> 0
else -> x.<get-length>()
}
}
fun <T : CharSequence?> test2(x: T): Int {
return when {
EQEQ(arg0 = x, arg1 = null) -> 0
else -> x.<get-length>()
}
}
inline fun <reified T : CharSequence?> test3(x: Any): Int {
return when {
x !is T -> 0
else -> x /*as T */.<get-length>()
}
}
inline fun <reified T : CharSequence> test4(x: Any?): Int {
return when {
x !is T -> 0
else -> x /*as T */.<get-length>()
}
}
fun <T : S?, S : Any?> test5(x: T, fn: Function1<S, Unit>) {
when {
EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x)
}
}