Skip to content

Rightward assignment inside "case ... when" produces invalid syntax #235

Closed
@hpello

Description

@hpello

Hey there!

I noticed the following behaviour, when using rightward assignment => inside a case ... when:

puts SyntaxTree.format <<~RUBY
  case [0]
  when 0
    { a: 0 } => { a: }
    puts a
  end
RUBY

produces:

[0] =>
  when 0
    case { a: 0 }
    a:
    end
    puts a

It seems like the rightward assignment is moved to the top... producing an invalid ruby syntax.
Do you know where this may come from?

Regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions