Closed
Description
I think I have found a bug. I think this code should work.
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'syntax_tree', '5.3.0'
end
require "syntax_tree"
source = <<~RUBY
with_options bookkeeping_account_number: 12 do
validates :bookkeeping_number
end
RUBY
program = SyntaxTree.parse(source)
program => { statements: { body: [binary] } }
formatter = SyntaxTree::Formatter.new(source, [])
binary.format(formatter)
formatter.flush
formatter.output.join
right now I get
untitled2.rb:26: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!
/Users/simon/.asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/syntax_tree-5.3.0/lib/syntax_tree/node.rb:4374:in `forced_do_end_bounds?': undefined method `call' for nil:NilClass (NoMethodError)
from /Users/simon/.asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/syntax_tree-5.3.0/lib/syntax_tree/node.rb:4308:in `format'
from /Users/simon/.asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/syntax_tree-5.3.0/lib/syntax_tree/formatter.rb:168:in `format'
from /Users/simon/.asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/syntax_tree-5.3.0/lib/syntax_tree/node.rb:3434:in `format'
from untitled2.rb:29:in `<main>'
Metadata
Metadata
Assignees
Labels
No labels