[BUG] Method is allowed to receive both block argument and actual block
Reported by oleg dashevskii | February 17th, 2008 @ 11:43 AM | in 1.0 preview
def foo(a,&b); [a,yield(b)] end
l = lambda { 99 }
# MRI says here "both block arg and actual block given" and it's an error.
r = foo(100, &l) do 999 end
# rbx just silently executes the code, returning [100,999]
p r
Comments and changes to this ticket
-

-

-
oleg dashevskii February 23rd, 2008 @ 09:07 PM
Committed with 49b727.
Sorry for your name got lost in the commit.
-

ronin-13627 (at lighthouseapp) February 24th, 2008 @ 03:13 PM
- → State changed from new to resolved
Closed per above.
-

Adam Shelly February 24th, 2008 @ 10:55 PM
Here's a patch to fix it.
The issue was that rb_compile_error() was #defined to be the same as _debug_print, which was turned off. I changed all the calls for this type of error to yyerror(), which correctly raises the syntax error.
Someone should probably check the rest of the calls to rb_compile_error in grammar.y to see if they should also be turned into yyerrors.
-
Brian Ford February 24th, 2008 @ 10:57 PM
- → Assigned user changed from to Evan Phoenix
- → State changed from resolved to open
-
Ryan Davis February 29th, 2008 @ 03:57 PM
- → Assigned user changed from Evan Phoenix to Ryan Davis
-
Ryan Davis July 10th, 2008 @ 01:22 PM
- → Tag changed from to bug compatibility compiler patch
- → State changed from open to new
-
Brian Ford December 2nd, 2008 @ 03:39 PM
- → State changed from new to resolved
This was fixed in 9dadb8234 for a related issue. The problem exists in ruby_parser, but that is an independent project. The following ticket has been submitted for that project:
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
