blob: aad874c2115bc22012b034a44a7e86cb20fd8dde [file] [log] [blame]
// TARGET_BACKEND: JVM
// FILE: varModifiedAfterCheck.kt
fun implicitCheck(s: String) {}
fun test1() {
var a = J.foo()
val b = a
a = J.bar()
if (b != null) {
if (a != null) {
throw AssertionError("a: $a")
}
}
}
fun test2() {
var a = J.foo()
val b = a
if (b != null) {
a = J.bar()
if (a != null) {
throw AssertionError("a: $a")
}
}
}
fun test3() {
var a = J.foo()
val b = a
a = J.bar()
implicitCheck(b)
if (a != null) {
throw AssertionError("a: $a")
}
}
fun test4() {
var a = J.foo()
val b = a
implicitCheck(b)
a = J.bar()
if (a != null) {
throw AssertionError("a: $a")
}
}
fun box(): String {
test1()
test2()
test3()
test4()
return "OK"
}
// FILE: J.java
public class J {
public static String foo() { return ""; }
public static String bar() { return null; }
}