Actions
Bug #21097
open`x = a rescue b in c` and `def f = a rescue b in c` parsed differently between parse.y and prism
ruby -v:
ruby 3.5.0dev (2025-01-27T08:19:32Z master c3c7300b89) +YJIT +MN +PRISM [arm64-darwin22]
Description
x = a rescue b in c
(x = (a rescue b)) in c # parse.y, prism(ruby 3.4)
x = (a rescue (b in c)) # prism(ruby 3.5)
def f = a rescue b in c #=> true(parse.y), :f(prism)
(def f = (a rescue b)) in c # parse.y
def f = (a rescue (b in c)) # prism
There is no difference between prism and parse.y parsing these codes
a rescue b in c # a rescue (b in c)
x = a rescue b # x = (a rescue b)
x = b in c # (x = b) in c
def f = a rescue b # def f = (a rescue b)
def f = b in c # (def f = a) in b
Updated by tompng (tomoya ishida) 7 days ago
not
in
and not
rescue
has the same problem
$ ruby --parser=parse.y -e "def f = not 1 in 2; p f"
false
$ ruby --parser=prism -e "def f = not 1 in 2; p f"
true
$ ruby --parser=parse.y -e "def f = not a rescue true; p f"
false
$ ruby --parser=prism -e "def f = not a rescue true; p f"
true
Updated by tenderlovemaking (Aaron Patterson) 7 days ago
- Assignee set to prism
Actions
Like0
Like0Like0