WASM: Implement spread operator

This commit is contained in:
Igor Laevsky
2021-06-27 15:04:12 +03:00
committed by teamcityserver
parent f5e59194b5
commit d835b3c164
22 changed files with 282 additions and 68 deletions
@@ -1,5 +1,6 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// Doesn't fail on WASM backend if lambdas return Int. Need to investigate futher.
// WASM_MUTE_REASON: UNIT_ISSUES
// !LANGUAGE: +UseCorrectExecutionOrderForVarargArguments
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
var result = "fail"
fun foo(vararg xs: Int, s1: String = "", s2: String = "OK") {
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
// WITH_RUNTIME
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// !LANGUAGE: +NewInference
fun sum(vararg args: Int): Int {
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// !LANGUAGE: +InlineClasses
inline class UInt(val value: Int)
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
fun foo1(
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// !LANGUAGE: +NewInference +MixedNamedArgumentsInTheirOwnPosition
// See KT-17691: Wrong argument order in resolved call with varargs. (fixed in JVM_IR)
+1 -1
View File
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// WASM_MUTE_REASON: STDLIB_STRING_BUILDER
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
fun join(x: Array<out String>): String {
var result = ""
for (i in x) {
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
abstract class Base(val s: String, vararg ints: Int)
fun foo(s: String, ints: IntArray) = object : Base(ints = *ints, s = s) {}
@@ -1,5 +1,5 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// WASM_MUTE_REASON: UNSIGNED_ARRAYS
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
fun booleanVararg(vararg xs: Boolean) {
if (xs.size != 1 && xs[0] != true) throw AssertionError()
}
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// !LANGUAGE: +AllowAssigningArrayElementsToVarargsInNamedFormForFunctions
fun test(vararg s: String) = s[1] + s.size
-2
View File
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
fun barB(vararg args: Byte) = args
fun barC(vararg args: Char) = args
fun barD(vararg args: Double) = args
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
// WITH_RUNTIME
import kotlin.test.*
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: SPREAD_OPERATOR
fun box(): String {
if (test1() != "") return "fail 1"
if (test1(1) != "1") return "fail 2"