[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"
This commit is contained in:
Svyatoslav Kuzmich
2021-05-24 18:06:26 +03:00
committed by TeamCityServer
parent 20ddaa9ebf
commit b79719d6f5
45 changed files with 289 additions and 141 deletions
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
fun foo() {}
fun box(): String {
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
fun isNull(x: Unit?) = x == null
fun box(): String {
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
val c = Unit
val d = c
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
fun foo(): Any? = bar()
fun bar() {}
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
fun <T : Any, R> T.let(f: (T) -> R): R = f(this)
fun box(): String {
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
fun isNull(x: Unit?) = x == null
fun <T : Any> isNullGeneric(x: T?) = x == null
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
fun foo() {}
fun box(): String {
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNIT_ISSUES
fun box(): String {
Unit