Issue #17425 has been reported by no6v (Nobuhiro IMAI). ---------------------------------------- Bug #17425: Ripper.lex raises unexpected error https://bugs.ruby-lang.org/issues/17425 * Author: no6v (Nobuhiro IMAI) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.0dev (2020-12-22T08:12:51Z master f2f00e24fa) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- ``` $ cat /tmp/l.rb require "ripper" pp Ripper.lex("def foo(arg1?:) end") $ ./ruby -v /tmp/l.rb ruby 3.0.0dev (2020-12-22T08:12:51Z master f2f00e24fa) [x86_64-linux] /var/tmp/git/ruby/ruby/.local/lib/ruby/3.0.0/ripper/lexer.rb:198:in `on_error2': undefined method `pos' for 30279:Integer (NoMethodError) ``` ``` Breakpoint 1, ripper_dispatch2 (p=p@entry=0x555555c73240, mid=34721, a=93824999713440, b=b@entry=41775) at ripper.y:13336 13336 { (gdb) rp p->lex.input T_STRING: "def foo(arg1?:) end" bytesize:19 (embed) encoding:1 coderange:7bit $1 = (struct RString *) 0x555555c77400 (gdb) rb_id2name mid ID: l(34721): on_param_error (gdb) rp a T_STRING: "formal argument must be local variable" bytesize:38 encoding:1 coderange:unknown $2 = (struct RString *) 0x555555c76aa0 (gdb) rp b FIXNUM: 20887 (gdb) rb_id2name b ID: j(41775): arg1? (gdb) up #1 0x00007ffff2c30719 in formal_argument (p=p@entry=0x555555c73240, lhs=lhs@entry=41775) at ripper.y:7881 7881 ERR("formal argument must be local variable"); (gdb) c Continuing. /var/tmp/git/ruby/ruby/.local/lib/ruby/3.0.0/ripper/lexer.rb:198:in `on_error2': undefined method `pos' for 20887:Integer (NoMethodError) ``` -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>