History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-1468
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Charles Oliver Nutter
Reporter: Pat Cheng
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

blocks with var args does not work the same as MRI or JRuby 1.0.1 when the argument supplied is an array

Created: 23/Oct/07 06:05 PM   Updated: 22/Dec/07 06:28 AM
Component/s: None
Affects Version/s: JRuby 1.1+
Fix Version/s: JRuby 1.1b1, JRuby 1.0.2

Time Tracking:
Not Specified

File Attachments: 1. File test_block_arg_processing.rb (10 kb)
2. Text File test_var_arg_block.rb (0.3 kb)

Environment: trunk (4673), Windows XP, JRE 1.6.0.0_02

Testcase included: yes


 Description  « Hide
Wih the following code:
Proc.new { |*element| assert_equal [["a"]], element }.call( ["a"] )

in MRI and JRuby 1.0.1, element is actually [["a"]]

in trunk, element is actually ["a"]



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Charles Oliver Nutter - 23/Oct/07 08:16 PM
Eeek, I thought we'd seen the last of these. Broken on both trunk and 1.0.

Charles Oliver Nutter - 25/Oct/07 06:17 PM
Added a more complete test for many permutations of blocks, block arguments, and define_method to help cover remaining failure cases. Current failures in JRuby:
  1) Error:
test_definemethods(TestVarArgBlock):
ArgumentError: wrong number of arguments(1 for 2)
    test/test_var_arg_block.rb:135:in `check_requiredargs_definemethods'
    test/test_var_arg_block.rb:211:in `test_definemethods'

  2) Error:
test_requiredargs_blocks(TestVarArgBlock):
ArgumentError: wrong number of arguments(1 for 2)
    test/test_var_arg_block.rb:63:in `test_requiredargs_blocks'

  3) Failure:
test_vararg_blocks(TestVarArgBlock)
    [test/test_var_arg_block.rb:27:in `test_vararg_blocks'
     test/test_var_arg_block.rb:9:in `blockarg'
     test/test_var_arg_block.rb:27:in `test_vararg_blocks']:
<[["a"]]> expected but was
<["a"]>.

Charles Oliver Nutter - 26/Oct/07 02:50 PM
Ok, I've made fixes to all this on trunk, and the original case passes as well as the other failures. I'm launching into backporting to 1.0 now, it will take a bit.

Charles Oliver Nutter - 26/Oct/07 04:15 PM
Fixed on 1.0 branch and trunk. Thanks for the report and test case!