Skip to content

Commit ee86818

Browse files
authored
Merge pull request #3723 from ruby/revisit-variable-capture
Revisit variable capture syntax error
2 parents 7a480cb + c03e113 commit ee86818

File tree

7 files changed

+74
-55
lines changed

7 files changed

+74
-55
lines changed

config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ errors:
217217
- PARAMETER_UNEXPECTED_FWD
218218
- PARAMETER_UNEXPECTED_NO_KW
219219
- PARAMETER_WILD_LOOSE_COMMA
220-
- PATTERN_ALTERNATIVE_AFTER_CAPTURE
221220
- PATTERN_ARRAY_MULTIPLE_RESTS
222221
- PATTERN_CAPTURE_DUPLICATE
223222
- PATTERN_CAPTURE_IN_ALTERNATIVE

src/prism.c

Lines changed: 60 additions & 53 deletions
Large diffs are not rendered by default.

templates/src/diagnostic.c.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
299299
[PM_ERR_PARAMETER_UNEXPECTED_FWD] = { "unexpected `...` in parameters", PM_ERROR_LEVEL_SYNTAX },
300300
[PM_ERR_PARAMETER_WILD_LOOSE_COMMA] = { "unexpected `,` in parameters", PM_ERROR_LEVEL_SYNTAX },
301301
[PM_ERR_PARAMETER_UNEXPECTED_NO_KW] = { "unexpected **nil; no keywords marker disallowed after keywords", PM_ERROR_LEVEL_SYNTAX },
302-
[PM_ERR_PATTERN_ALTERNATIVE_AFTER_CAPTURE] = { "alternative pattern after variable capture", PM_ERROR_LEVEL_SYNTAX },
303302
[PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS] = { "unexpected multiple '*' rest patterns in an array pattern", PM_ERROR_LEVEL_SYNTAX },
304303
[PM_ERR_PATTERN_CAPTURE_DUPLICATE] = { "duplicated variable name", PM_ERROR_LEVEL_SYNTAX },
305304
[PM_ERR_PATTERN_CAPTURE_IN_ALTERNATIVE] = { "variable capture in alternative pattern", PM_ERROR_LEVEL_SYNTAX },
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1 => [a, b] | 2
2+
^ variable capture in alternative pattern
3+
^ variable capture in alternative pattern
4+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1 => { a: b } | 2
2+
^ variable capture in alternative pattern
3+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1 => (2 => b) | 2
2+
^ variable capture in alternative pattern
3+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1 => a | b
2+
^ variable capture in alternative pattern
3+
^ variable capture in alternative pattern
4+

0 commit comments

Comments
 (0)