From 22e54e670354af7d3bd7ebdef3d8a4f072656e60 Mon Sep 17 00:00:00 2001 From: Enzo Date: Sun, 3 Jan 2021 16:19:43 +0100 Subject: [PATCH] fmt: fix formatting array decomposition (#7835) --- vlib/v/fmt/fmt.v | 1 + vlib/v/fmt/tests/array_decomposition_keep.vv | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 vlib/v/fmt/tests/array_decomposition_keep.vv diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 29a0117911..fc1c0205bf 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -1140,6 +1140,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) { } ast.ArrayDecompose { f.expr(node.expr) + f.write('...') } } } diff --git a/vlib/v/fmt/tests/array_decomposition_keep.vv b/vlib/v/fmt/tests/array_decomposition_keep.vv new file mode 100644 index 0000000000..2822cd955a --- /dev/null +++ b/vlib/v/fmt/tests/array_decomposition_keep.vv @@ -0,0 +1,8 @@ +fn varargs(a ...int) { + println(a) +} + +fn main() { + a := [1, 2, 3] + varargs(a...) +}