Project

General

Profile

Actions

Bug #19025

closed

Ripper cannot parse syntax ok code that has numbered parameters

Added by tompng (tomoya ishida) over 1 year ago. Updated 9 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0dev (2022-09-22T02:42:57Z :detached: 830b2e217b) [x86_64-linux]
[ruby-core:110114]

Description

Ruby says p { a = 0; [_1, _1 **2] } is syntax ok, Ripper says syntax error

code = 'p { a = 0; [_1, _1 **2] }'
eval(code) #=> nil (Syntax OK)
Ripper.sexp(code) #=> nil (Syntax Error)

Other similar codes. maybe not a bug

p { a = 0; [a **2] } # Syntax OK
p { a = 0; [_1 **2] } # Syntax Error
p { a = 0; [a, _1 **2] } # Syntax Error
p { a = 0; [_1, _1 **2] } # Syntax OK, Ripper.sexp says Syntax Error
Actions #1

Updated by nobu (Nobuyoshi Nakada) 12 months ago

  • Status changed from Open to Closed

Applied in changeset git|91c004885fc75a93cadf0094fa86ec3bd0ec25f5.


[Bug #19025] Numbered parameter names are always local variables

Actions #2

Updated by nobu (Nobuyoshi Nakada) 12 months ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) 10 months ago

  • Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE

ruby_3_2 465eb7418d7ed91f5f0c75da77765c7f5ef8354f merged revision(s) 91c004885fc75a93cadf0094fa86ec3bd0ec25f5.

Updated by usa (Usaku NAKAMURA) 9 months ago

  • Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE to 3.0: REQUIRED, 3.1: DONE, 3.2: DONE

ruby_3_1 e55dde3bdddbc595be12e7184a23e729647eb989 merged revision(s) 91c004885fc75a93cadf0094fa86ec3bd0ec25f5.

Updated by usa (Usaku NAKAMURA) 9 months ago

  • Backport changed from 3.0: REQUIRED, 3.1: DONE, 3.2: DONE to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE

reverted on ruby_3_1 because the test is not passed...

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0