Fix some Unit materialization bugs

This commit is contained in:
Anton Bannykh
2018-03-02 18:08:55 +03:00
parent 1f7d235fb5
commit 7cde03938a
6 changed files with 63 additions and 24 deletions
+20 -12
View File
@@ -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;"
}