From: merch-redmine@... Date: 2019-08-07T16:36:39+00:00 Subject: [ruby-core:94188] [Ruby master Bug#7615] assignment to context variable changes the precedence order of function call with followed by ' (' (whitespace-bracket) Issue #7615 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Assigned to Closed This was fixed between Ruby 2.4 and 2.5: ``` $ ruby24 -e ' > def foo(x); 99; end > a = foo (44) / 11 > foo = 99999999 > b = foo (44) / 11 > puts "a: #{a} b: #{b}"' a: 99 b: 9 $ ruby25 -e ' > def foo(x); 99; end > a = foo (44) / 11 > foo = 99999999 > b = foo (44) / 11 > puts "a: #{a} b: #{b}"' a: 99 b: 99 ``` ---------------------------------------- Bug #7615: assignment to context variable changes the precedence order of function call with followed by ' (' (whitespace-bracket) https://bugs.ruby-lang.org/issues/7615#change-80447 * Author: snoble (Steven Noble) * Status: Closed * Priority: Normal * Assignee: nobu (Nobuyoshi Nakada) * Target version: * ruby -v: ruby 2.0.0dev (2012-12-01 trunk 38126) [x86_64-darwin12.2.0] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- this is similar to http://bugs.ruby-lang.org/issues/1801 but it wasn't pointed out then that ruby will use two different parsings at different times note that in this code `a` and `b` have the same assignment code but are assigned different values code: def foo(x); 99; end a = foo (44) / 11 foo = 99999999 b = foo (44) / 11 puts "a: #{a} b: #{b}" #output of "a: 99 b: 9" The output of ruby_parser is: s(:block, s(:defn, :foo, s(:args, :x), s(:lit, 99)) s(:lasgn, :a, s(:call, nil, :foo, s(:call, s(:lit, 44), :/, s(:lit, 11)))), s(:lasgn, :foo, s(:lit, 999999999)), s(:lasgn, :b, s(:call, s(:call, nil, :foo, s(:lit, 44)), :/, s(:lit, 11))) ) observed in 1.9.4 and 2.0.0-preview2, but does not occur in 1.8.7 -- https://bugs.ruby-lang.org/ Unsubscribe: