diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index fcb34922507..8d8da35eba9 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -655,6 +655,11 @@ task args0(type: RunKonanTest) { source = "runtime/basic/args0.kt" } +task spread_operator_0(type: RunKonanTest) { + goldValue = "[K, o, t, l, i, n, , i, s, , c, o, o, l, , l, a, n, g, u, a, g, e]\n" + source = "codegen/basics/spread_operator_0.kt" +} + task main_exception(type: RunKonanTest) { // TODO: cannot currently check the output because the exact stacktrace strings are unpredictable. // goldValue = "Uncaught exception from Kotlin's main: Throwable\n" diff --git a/backend.native/tests/codegen/basics/spread_operator_0.kt b/backend.native/tests/codegen/basics/spread_operator_0.kt new file mode 100644 index 00000000000..078c2a6fbdc --- /dev/null +++ b/backend.native/tests/codegen/basics/spread_operator_0.kt @@ -0,0 +1,12 @@ +fun main(arg:Array) { + val list0 = _arrayOf("K", "o", "t", "l", "i", "n") + val list1 = _arrayOf("l", "a","n", "g", "u", "a", "g", "e") + val list = foo(list0, list1) + println(list.toString()) +} + + +fun foo(a:Array, b:Array) = listOf(*a," ", "i", "s", " ", "c", "o", "o", "l", " ", *b) + + +fun _arrayOf(vararg arg:String) = arg \ No newline at end of file