Skip to content

Commit

Permalink
+ ruby32.y: Allow optional newlines before closing parenthesis (#892)
Browse files Browse the repository at this point in the history
Closes #891
  • Loading branch information
koic authored Dec 13, 2022
1 parent 7dca1da commit fbc2d7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parser/ruby32.y
Original file line number Diff line number Diff line change
Expand Up @@ -2346,7 +2346,7 @@ opt_block_args_tail:
result = @builder.pin(val[0], non_lvar)
}
p_expr_ref: tCARET tLPAREN expr_value tRPAREN
p_expr_ref: tCARET tLPAREN expr_value rparen
{
expr = @builder.begin(val[1], val[2], val[3])
result = @builder.pin(val[0], expr)
Expand Down
10 changes: 10 additions & 0 deletions test/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10526,6 +10526,16 @@ def test_pin_expr
%q{ ~ selector (in_pattern.pin)
| ~~~~~~~~~~~~~~~~~~~~~ expression (in_pattern.pin)},
SINCE_3_1)

assert_parses_pattern_match(
s(:in_pattern,
s(:pin,
s(:begin,
s(:int, 1))), nil, nil),
%Q{in ^(1\n)},
%q{ ~ selector (in_pattern.pin)
| ~~~~~ expression (in_pattern.pin)},
SINCE_3_2)
end

def test_assignment_to_numparam_via_pattern_matching
Expand Down

0 comments on commit fbc2d7b

Please sign in to comment.