Project

General

Profile

Actions

Bug #20785

open

Should `a in b, and c` `a in b, or c` `a in b, rescue c` be syntax ok?

Added by tompng (tomoya ishida) 2 months ago. Updated 26 days ago.

Status:
Assigned
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-10-04T03:22:53Z master 939ec9f080) +YJIT +MN +PRISM [arm64-darwin22]
[ruby-core:119462]

Description

This code is accepted in parse.y but rejected in prism

tap do
  a in b, and c
  a in b, or c
  a in b, rescue c
end

# parsed as
tap do
  (a in b,;) and c
  (a in b,;) or c
  a in b,;
rescue c
end

I think these should be rejected like prism (parse.y accepts)

a in b, and c

a in b,
and c

tap do
  a in b, rescue c
end

I think these should be accepted like parse.y (prism rejects)

tap do
  a in b,
end

tap do
  a in b,
rescue
end
Actions

Also available in: Atom PDF

Like2
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like1