diff options
| author | Marmare314 <49279081+Marmare314@users.noreply.github.com> | 2023-04-26 11:32:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-26 11:32:11 +0200 |
| commit | 59957746e91c1322a8ca6d228bcaa0f31941ee1b (patch) | |
| tree | d928dea7c99f1d9f17107aac8008b5b7e870d190 /tests/typ/compiler | |
| parent | 6134e3f4ee5298153c36d344df97f36279931c33 (diff) | |
Pattern as parameter (#854)
Diffstat (limited to 'tests/typ/compiler')
| -rw-r--r-- | tests/typ/compiler/closure.typ | 23 |
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 |
