Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Arguments after a splatted variable inside of []= calls cause Rubinius::CompileError #1569

Closed
jredville opened this Issue Feb 23, 2012 · 0 comments

Comments

Projects
None yet
1 participant

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

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

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

@dbussink dbussink closed this in 2ab0d14 Jul 29, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment