Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.7
-
Fix Version/s: JRuby 1.7.0.RC1
-
Component/s: Ruby 1.9.2
-
Labels:None
-
Environment:Ubuntu 10.11 - x64
-
Number of attachments :
Description
The following code fragment should show it clearly.
me@mypc:~/$ cat test.rb
class Array
def proc_on_first
yield([0])
end
end
ary = [[42]]
p ary.proc_on_first{|b|b.first}
p ary.proc_on_first(&:first)
me@mypc:~/$ jruby --1.9 test.rb
0
NoMethodError: undefined method `first' for 0:Fixnum
proc_on_first at test.rb:3
(root) at test.rb:10
me@mypc:~/$ jruby --1.8 test.rb
0
0
me@mypc:~/$
There are severeal issues concerning Procs, Symbols and &, but I couldn't find one that shows this behaviour.
In MRI Ruby 1.9.2 and 1.9.3 this works fine like in JRuby --1.8
Ahh, seems like a good find. It looks like we're unboxing too much in the 1.9 case, which has been a common challenge for 1.9 mode block argument passing.