Project

General

Profile

Actions

Backport #1979

closed

parser confused by local variable assignment

Added by coatl (caleb clausen) over 14 years ago. Updated over 4 years ago.


Description

=begin
I posted this before as a followup to bug #1801. Since there was no response and it seems to have been fixed independently of #1801 in the distant past, I'm filing it as a separate bug.

I can't decide if this is a different manifestation of bug #1801 or just a highly similar bug, maybe someone can enlighten me:

p = p m %(2)

I think the %(2) should be treated as a string, since it is in all other cases I know of (unless m is an lvar, which obviously it isn't here). However, it gets parsed as an operator and a parenthesized numeric literal.

In this variation of the expression, %(2) is a string, as I would expect:

p m %(2)

Is this the same as #1801?

This expression works as I expected for versions 1.4.0 thru 1.7.1. All versions after 1.7.1 don't work the way I expect. In versions before 1.4.0 it causes a syntax error. Jruby has identical behavior as recent mri rubies. In rubinius, it causes a stack dump.

Something interesting happened around about 1.7.1.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0