[BUG] Method is allowed to receive both block argument and actual block
Reported by oleg dashevskii | February 17th, 2008 @ 08:43 PM | 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 24th, 2008 @ 06:07 AM
Committed with 49b727.
Sorry for your name got lost in the commit.
-

Eero Saynatkari February 25th, 2008 @ 12:13 AM
- → State changed from new to resolved
Closed per above.
-

Adam Shelly February 25th, 2008 @ 07:55 AM
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 25th, 2008 @ 07:57 AM
- → State changed from resolved to open
- → Assigned user changed from to Evan Phoenix
-
Ryan Davis March 1st, 2008 @ 12:57 AM
- → Assigned user changed from Evan Phoenix to Ryan Davis
-
Ryan Davis July 10th, 2008 @ 10:22 PM
- → State changed from open to new
- → Tag changed from to bug compatibility compiler patch
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 »
