Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case when splat failing for word arrays #2247

Closed
triplepointfive opened this issue Sep 15, 2015 · 1 comment · Fixed by #2252
Closed

Case when splat failing for word arrays #2247

triplepointfive opened this issue Sep 15, 2015 · 1 comment · Fixed by #2252

Comments

@triplepointfive
Copy link

Given example

case x
when *%w(foo bar) then x
end

Is being auto fixed to

case x
when foo bar then x
end

But foo bar is expected to be defined as strings.

Also it fails immediately:

app.rb:3:3: C: [Corrected] Do not expand array literals in when conditions.
  when *%w(foo bar) then x
  ^^^^^^^^^^^^^^^^^
app.rb:3:12: E: unexpected token tIDENTIFIER
  when foo bar then x
           ^^^
app.rb:5:1: E: unexpected token kEND
end
^^^

Checked on v0.34.1

@rrosenblum
Copy link
Contributor

Definitely a bug. I forgot to account for the % type arrays when writing the auto-correct. I will work on a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants