Files
kotlin-fork/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/ArrayAccess.fir.kt
T
simon.ogorodnik 34e6649d31 [FIR] Harden check of argument type properly
Before this commit, nullable argument could match not null parameter.
Now we require also correct nullability that breaks some cases
2020-02-03 16:45:18 +03:00

14 lines
328 B
Kotlin
Vendored

fun bar(x: Int): Int = x + 1
fun foo() {
val x: Int? = null
val a = Array<Int>(3, {0})
if (x != null) bar(a[x]) else bar(<!INAPPLICABLE_CANDIDATE!>a[x]<!>)
bar(a[if (x == null) 0 else x])
bar(<!INAPPLICABLE_CANDIDATE!>a[x]<!>)
<!INAPPLICABLE_CANDIDATE!>"123"[x]<!>;
if (x != null) "123"[x];
}