ruby / prism

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

Handle implicit array precedence #2889

Closed kddnewton closed 3 weeks ago

kddnewton commented 3 weeks ago

Fixes https://github.com/ruby/prism/issues/2012

When an implicit array is used in a write, is causes the whole expression to become a statement. For example:

a = *b
a = 1, 2, 3

Even though these expressions are exactly equivalent to their explicit array counterparts:

a = [*b]
a = [1, 2, 3]

As such, these expressions cannot be joined with other expressions by operators or modifiers except if, unless, while, until, or rescue.