rubinius/rubinius — Issue #1502: define_method broken with default arguments in 1.9
Author: whitequark
Created: 2012-01-09 03:28:59+00:00
State: open

In the current rbx-head in 1.9 mode, define_method is broken when default arguments are passed.

```
rubinius-2.0.0dev :001 > class A; define_method(:test) do |arg=1|; p arg; end; end; A.new.test(123)
ArgumentError: ArgumentError
from (irb):1
from kernel/common/block_environment.rb:74:in `call_on_instance'
from kernel/common/eval.rb:71:in `eval'
from kernel/common/kernel19.rb:17:in `loop'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/delta/codeloader.rb:67:in `load_script'
from kernel/delta/codeloader.rb:109:in `load_script'
from kernel/loader.rb:630:in `script'
from kernel/loader.rb:834:in `main'
rubinius-2.0.0dev :002 > class A; define_singleton_method(:test) do |arg=1|; p arg; end; end; A.test(123)
ArgumentError: ArgumentError
from (irb):2
from kernel/common/block_environment.rb:74:in `call_on_instance'
from kernel/common/eval.rb:71:in `eval'
from kernel/common/kernel19.rb:17:in `loop'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/common/throw_catch19.rb:8:in `catch'
from kernel/common/throw_catch.rb:10:in `register'
from kernel/common/throw_catch19.rb:7:in `catch'
from kernel/delta/codeloader.rb:67:in `load_script'
from kernel/delta/codeloader.rb:109:in `load_script'
from kernel/loader.rb:630:in `script'
from kernel/loader.rb:834:in `main'
```