summaryrefslogtreecommitdiff
path: root/tests/suite/scripting
diff options
context:
space:
mode:
authorIan Wrzesinski <133046678+wrzian@users.noreply.github.com>2024-12-08 11:29:49 -0500
committerGitHub <noreply@github.com>2024-12-08 16:29:49 +0000
commite6de044b1da1e1c801a69149d757bada7154a83b (patch)
tree610123bcc2953195f0a3ac5bf1008735fc5caa21 /tests/suite/scripting
parentfbcd624eebf9763d5cedbbc433e8b5ffee8402d8 (diff)
Add test for issue #4573 (#5542)
Diffstat (limited to 'tests/suite/scripting')
-rw-r--r--tests/suite/scripting/destructuring.typ20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/suite/scripting/destructuring.typ b/tests/suite/scripting/destructuring.typ
index 3c0c754c..87bdefa7 100644
--- a/tests/suite/scripting/destructuring.typ
+++ b/tests/suite/scripting/destructuring.typ
@@ -373,3 +373,23 @@
// Error: 6-12 too many elements to destructure
// Hint: 6-12 the provided array has a length of 3, but the pattern expects 2 elements
#for (x, y) in ((1,2,3), (4,5,6)) {}
+
+--- issue-4573-destructuring-unclosed-delimiter ---
+// Tests a case where parsing within an incorrectly predicted paren expression
+// (the "outer" assignment) would put the parser in an invalid state when
+// reloading a stored prediction (the "inner" assignment) and cause a panic when
+// generating the unclosed delimiter error. See the comment in the issue for
+// more details.
+#{
+ (
+ // Error: 5-7 expected pattern, found keyword `if`
+ // Hint: 5-7 keyword `if` is not allowed as an identifier; try `if_` instead
+ // Error: 9 expected comma
+ // Error: 13-17 unexpected keyword `else`
+ // Error: 20 expected comma
+ if x {} else {}
+ // Error: 5-6 unclosed delimiter
+ { () = "inner"
+ ) = "outer"
+}
+