summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarmare314 <49279081+Marmare314@users.noreply.github.com>2023-04-26 11:32:11 +0200
committerGitHub <noreply@github.com>2023-04-26 11:32:11 +0200
commit59957746e91c1322a8ca6d228bcaa0f31941ee1b (patch)
treed928dea7c99f1d9f17107aac8008b5b7e870d190 /tests
parent6134e3f4ee5298153c36d344df97f36279931c33 (diff)
Pattern as parameter (#854)
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/compiler/closure.typ23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/typ/compiler/closure.typ b/tests/typ/compiler/closure.typ
index 2d12a2bc..0f6809b5 100644
--- a/tests/typ/compiler/closure.typ
+++ b/tests/typ/compiler/closure.typ
@@ -146,6 +146,29 @@
}
---
+// Parameter unpacking.
+#let f((a, b), ..c) = (a, b, c)
+#test(f((1, 2), 3, 4), (1, 2, (3, 4)))
+
+#let f((k: a, b), c: 3, (d,)) = (a, b, c, d)
+#test(f((k: 1, b: 2), (4,)), (1, 2, 3, 4))
+
+// Error: 22-23 duplicate parameter: a
+#let f((a: b), (c,), a) = none
+
+// Error: 8-14 expected identifier, found array
+#let f((a, b): 0) = none
+
+// Error: 10-19 expected identifier, found destructuring pattern
+#let f(..(a, b: c)) = none
+
+// Error: 10-16 expected identifier, found array
+#let f(..(a, b)) = none
+
+// Error: 10-19 expected identifier, found destructuring pattern
+#let f(..(a, b: c)) = none
+
+---
// Error: 11-12 duplicate parameter: x
#let f(x, x) = none