Fix some Unit materialization bugs
This commit is contained in:
+20
-12
@@ -1,18 +1,26 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1132
|
||||
var log = ""
|
||||
|
||||
fun box(): String {
|
||||
foo() ?: bar()
|
||||
if (foo() == null) bar()
|
||||
fun log(msg: String) {
|
||||
log += "$msg;"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
log("!!")!!
|
||||
|
||||
log("elvis-left") ?: log("elvis-right")
|
||||
|
||||
if (log("if") == null) log("then")
|
||||
|
||||
when (null) {
|
||||
log("when-pattern") -> log("when-body-1")
|
||||
}
|
||||
|
||||
when (log("when-subject")) {
|
||||
null -> log("when-body-2")
|
||||
}
|
||||
|
||||
if (log != "!!;elvis-left;if;when-pattern;when-subject;") return "fail: $log"
|
||||
|
||||
if (log != "foo;foo;") return "fail: $log"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
log += "foo;"
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
log += "bar;"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user