From 500a87756f9873a320aa3a11ab2d1ac4e1b4afee Mon Sep 17 00:00:00 2001 From: ydah Date: Wed, 8 Jan 2025 23:58:59 +0900 Subject: [ruby/prism] Reject pattern match with unexpected double splat inside array `a => [-2**b]` should be SyntaxError Fixes: https://github.com/ruby/prism/issues/3381 https://github.com/ruby/prism/commit/ae8e83b389 --- .../pattern_match_with_unexpected_splat_inside_arraytxt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt (limited to 'test') diff --git a/test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt b/test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt new file mode 100644 index 0000000000..d19491e6bf --- /dev/null +++ b/test/prism/errors/pattern_match_with_unexpected_splat_inside_arraytxt @@ -0,0 +1,14 @@ +a => [-2*b] + ^ expected a `]` to close the pattern expression + ^ unexpected '*', expecting end-of-input + ^ unexpected '*', ignoring it + ^ unexpected ']', expecting end-of-input + ^ unexpected ']', ignoring it + +a => [-2**b] + ^ expected a `]` to close the pattern expression + ^~ unexpected '**', expecting end-of-input + ^~ unexpected '**', ignoring it + ^ unexpected ']', expecting end-of-input + ^ unexpected ']', ignoring it + -- cgit v1.2.3