From 938b0af889b8fbe6265695b1b8e54aee338ba87f Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 11 Apr 2022 15:52:57 +0200 Subject: Spreading into arrays and dictionaries --- tests/typ/code/spread.typ | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'tests/typ/code') diff --git a/tests/typ/code/spread.typ b/tests/typ/code/spread.typ index 5f7d2061..c5415c42 100644 --- a/tests/typ/code/spread.typ +++ b/tests/typ/code/spread.typ @@ -70,9 +70,26 @@ #let f(..a, ..b) = none --- -// Error: 3-6 spreading is not allowed here -{(..x)} +// Test spreading into array and dictionary. +{ + let l = (1, 2, 3) + let r = (5, 6, 7) + test((..l, 4, ..r), range(1, 8)) + test((..none), ()) +} + +{ + let x = (a: 1) + let y = (b: 2) + let z = (a: 3) + test((:..x, ..y, ..z), (a: 3, b: 2)) + test((..(a: 1), b: 2), (a: 1, b: 2)) +} + +--- +// Error: 11-17 cannot spread dictionary into array +{(1, 2, ..(a: 1))} --- -// Error: 9-17 spreading is not allowed here -{(1, 2, ..(1, 2))} +// Error: 5-11 cannot spread array into dictionary +{(..(1, 2), a: 1)} -- cgit v1.2.3