ruby / prism

Prism Ruby parser
https://ruby.github.io/prism/
MIT License
792 stars 134 forks source link

Prism rejects valid (?) syntax that CRuby accepts: `break while false` #2841

Closed Earlopain closed 3 weeks ago

Earlopain commented 1 month ago

Questionmark since I'm not sure what this code would even mean.

break while false

Prism rejects this, saying break is invalid at this point. Ruby happily executes it though.

image

[user@DESKTOP-PC ruby-prism]$ ruby --version
ruby 3.4.0dev (2024-05-24T16:36:54Z master 47f0965269) [x86_64-linux]
[user@DESKTOP-PC ruby-prism]$ ruby test.rb
[user@DESKTOP-PC ruby-prism]$ 
st0012 commented 1 month ago

I think this is the case for next too: next while false is valid in Ruby but invalid with Prism.

kddnewton commented 3 weeks ago

Fixed by https://github.com/ruby/prism/pull/2912