-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Environment
- jruby 9.1.6.0-SNAPSHOT (2.3.1) 2016-11-08 cb5a7be Java HotSpot(TM) 64-Bit Server VM 25.91-b14 on 1.8.0_91-b14 +jit [linux-x86_64]
- Linux noweto 4.4.0-25-generic LocalContextScope documentation improvement #44-Ubuntu SMP Fri Jun 10 18:19:48 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
The following worked at least until JRuby 9.0.0.0 and works in MRI:
def modify(x)
x << 'a'
end
modify(u = '') # => "a"
u # => "a"
x = {} # => {}
modify(x[5] = '') # => "a"
x # => {5=>"a"}Actual Behavior
At least from JRuby 9.1.5.0 onwards including the above listed JRuby 9.1.6.0 snapshot the following happens:
def modify(x)
x << 'a'
end
modify(u = '') # => "a"
u # => "a"
x = {} # => {}
modify(x[5] = '') # => "a"
x # => {5=>""}The difference is in the last line where the string assigned to x[5] isn't modified anymore, leading to erroneous behaviour.
Reactions are currently unavailable