rubinius/rubinius — Issue #1569: Arguments after a splatted variable inside of []= calls cause Rubinius::CompileError
Author: jredville
Created: 2012-02-23 05:14:00+00:00
State: open

Report submitted at: https://gist.github.com/1890439

The crashing code is the `self[1,*a,2] = 2` line in:

```ruby
def []=(*args)
p args
end

a = ['a']

self[1,*a,2] = 2

```

Creating a file `foo.rb` with these contents, then running `rbx -X19 foo.rb` will reproduce the Exception.

I observed the following while looking into this Exception:
* if the splatted arg is the last arg, the code runs fine (`self[1,*a] = 2` runs)
* if the `[]=` is replaced with a `[]` call, the code runs fine
* if the method is defined in a class, the exception reproduces
* if the variable is replaced with a direct array, the code runs fine (`self[1,*['a'],2] = 2` runs)
* a normal method call with the same signature runs fine