Files
kotlin-fork/compiler/testData/codegen/box/unit/kt4212.kt
T
Svyatoslav Kuzmich b79719d6f5 [Wasm] Fix unit issues
- Materialize unit when its value is actually needed.
- Special-case Unit_getInstance return type at codegen. It should be a
  proper Unit object instead of a "void"
2021-09-08 19:56:26 +03:00

21 lines
314 B
Kotlin
Vendored

fun foo(): Any? = bar()
fun bar() {}
fun baz(): Any? {
return bar()
}
fun quux(): Unit? = bar()
fun box(): String {
foo()
if (foo() != Unit) return "Fail 1"
if (foo() != bar()) return "Fail 2"
if (bar() != baz()) return "Fail 3"
if (baz() != quux()) return "Fail 4"
return "OK"
}