34e6649d31
Before this commit, nullable argument could match not null parameter. Now we require also correct nullability that breaks some cases
14 lines
328 B
Kotlin
Vendored
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];
|
|
}
|