Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.6, JRuby 1.2
-
Fix Version/s: None
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Mac OS X 10.5.6; Java 1.5.0_16;
-
Number of attachments :
Description
I first discovered this when I noticed that the following snippet fails in JRuby (both 1.1.6 and 1.1.7) and succeeds in Ruby 1.8.6:
module Mod [:Foo, :Bar].each_with_index &(method :const_set) end
I came up with a little bit more detailed example that I think may be the same problem:
def foo(x, y)
puts "#{x} and #{y}"
end
def bar(&block)
block.call ["tweedledee", "tweedledum"]
end
bar &(method :foo)
The results from running the second snippet:
$ ruby test.rb tweedledee and tweedledum $ jruby test.rb test.rb:12:in `to_proc': wrong # of arguments(1 for 2) (ArgumentError) from test.rb:12:in `call' from test.rb:12:in `bar' from test.rb:15
The same error occurs when running the first snippet.
Taking away the array brackets avoids the problem, as does using "yield" instead of a block variable.
The first example works in both jruby 1.6.7 and mri 1.9.3-p194. The second example fail the sameway in both too.
Can be closed.