Actions
Bug #20649
closedRipper fails to tokenize `def f; (x)::A =`
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-07-24T05:44:32Z master e642ddf7ae) [x86_64-linux]
Backport:
Description
Ripper fails to tokenize some dynamic constant assignment syntax error code.
''::A=
(x)::A=
(x).y::Z=
[]::A=
{}::A=
``::A=
//::A=
%()::A=
in method body seems to fail.
Same for for ''::A in
and rescue => ''::A;
in method body.
Ripper.tokenize 'def f; (x)::A ='
#=>
/opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:245:in 'Ripper::Lexer#on_error2': undefined method 'pos' for nil (NoMethodError)
@errors.push Elem.new(elem.pos, __callee__, elem.tok, elem.state, mesg)
^^^^
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:176:in 'Ripper#parse'
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:176:in 'Ripper::Lexer#parse'
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:150:in 'Ripper::Lexer#tokenize'
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:26:in 'Ripper.tokenize'
from -e:1:in '<main>'
Updated by nobu (Nobuyoshi Nakada) 4 months ago
- Related to Bug #17345: ripper: nothing raised when assigning to keyword variables added
Updated by nobu (Nobuyoshi Nakada) 4 months ago
- Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED
Updated by nobu (Nobuyoshi Nakada) 4 months ago
Updated by nobu (Nobuyoshi Nakada) 4 months ago
- Status changed from Open to Closed
Applied in changeset git|97449338d6cb42d9dd7c9ca61550616e7e6b6ef6.
[Bug #20649] Allow nil
as 2nd argument of assign_error
Fallback to the last token element in that case, for the backward
compatibilities.
Updated by nagachika (Tomoyuki Chikanaga) 3 months ago
- Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED
ruby_3_2 a8a25291447e3630d455e82851ca58fc8ac372ec merged revision(s) 97449338d6cb42d9dd7c9ca61550616e7e6b6ef6.
Updated by k0kubun (Takashi Kokubun) 3 months ago
- Backport changed from 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: DONE
ruby_3_3 b210c86a0201f6a97c4da8266908260746f53ae0 merged revision(s) 97449338d6cb42d9dd7c9ca61550616e7e6b6ef6.
Actions
Like0
Like0Like0Like0Like0Like0Like0