fables-tales/rubyfmt

Supporting Ruby 3.1 shorthand hash syntax

Closed this issue · 1 comments

  • Ruby version: 3.1.2
  • Rubyfmt git sha: v0.8.1

Input file

a = 1
b = 2

h = { a:, b: }

puts h

Rubyfmt's output

Error! source: app.rb
Rubyfmt detected a syntax error in the ruby code being executed

This breaks because

This source code uses the new shorthand hash syntax introduced in Ruby 3.1 (more info: https://dev.to/baweaver/ruby-3-1-shorthand-hash-syntax-first-impressions-19op).

reese commented

I'm going to write up a meta-issue in a bit that tracks all the syntax we don't currently support (pattern matching, endless methods, this, etc.), but it's definitely on my radar. It does require us bumping the Ruby checkout pretty far though, so it'll be a bit just to make sure that doesn't totally bust anything.