diff --git a/tests/suite/scripting/destructuring.typ b/tests/suite/scripting/destructuring.typ index 3c0c754c8..87bdefa73 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" +} +