[Bug #20789] Fix an invalid syntax error when ->a=1...{}
https://bugs.ruby-lang.org/issues/20789
This commit is contained in:
parent
e50754fcfa
commit
1c762d9566
Notes:
git
2024-10-09 14:58:37 +00:00
2
parse.y
2
parse.y
@ -11043,7 +11043,7 @@ parser_yylex(struct parser_params *p)
|
|||||||
SET_LEX_STATE(EXPR_BEG);
|
SET_LEX_STATE(EXPR_BEG);
|
||||||
if ((c = nextc(p)) == '.') {
|
if ((c = nextc(p)) == '.') {
|
||||||
if ((c = nextc(p)) == '.') {
|
if ((c = nextc(p)) == '.') {
|
||||||
if (p->ctxt.in_argdef || IS_LABEL_POSSIBLE() || lambda_beginning_p()) {
|
if (p->ctxt.in_argdef || IS_LABEL_POSSIBLE()) {
|
||||||
SET_LEX_STATE(EXPR_ENDARG);
|
SET_LEX_STATE(EXPR_ENDARG);
|
||||||
return tBDOT3;
|
return tBDOT3;
|
||||||
}
|
}
|
||||||
|
@ -1975,6 +1975,7 @@ eom
|
|||||||
assert_valid_syntax('def nil(...) end')
|
assert_valid_syntax('def nil(...) end')
|
||||||
assert_valid_syntax('def true(...) end')
|
assert_valid_syntax('def true(...) end')
|
||||||
assert_valid_syntax('def false(...) end')
|
assert_valid_syntax('def false(...) end')
|
||||||
|
assert_valid_syntax('->a=1...{}')
|
||||||
unexpected = /unexpected \.{3}/
|
unexpected = /unexpected \.{3}/
|
||||||
assert_syntax_error('iter do |...| end', /unexpected/)
|
assert_syntax_error('iter do |...| end', /unexpected/)
|
||||||
assert_syntax_error('iter {|...|}', /unexpected/)
|
assert_syntax_error('iter {|...|}', /unexpected/)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user