Files
kotlin-fork/compiler/testData/ir/irText/expressions/implicitCastToNonNull.kt
T
Denis.Zharkov 1e0d9f4075 FIR2IR: Do not add implicit casts for types with different nullability
For smart casts, elvises, etc., there are no implicit casts in psi2fir
in changed test data
2021-01-29 10:50:22 +03:00

16 lines
402 B
Kotlin
Vendored

// FIR_IDENTICAL
fun test1(x: String?) =
if (x == null) 0 else x.length
fun <T : CharSequence?> test2(x: T) =
if (x == null) 0 else x.length
inline fun <reified T : CharSequence?> test3(x: Any) =
if (x !is T) 0 else x.length
inline fun <reified T : CharSequence> test4(x: Any?) =
if (x !is T) 0 else x.length
fun <T : S?, S> test5(x: T, fn: (S) -> Unit) {
if (x != null) fn(x)
}