castwide / solargraph

A Ruby language server.
https://solargraph.org
MIT License
1.87k stars 154 forks source link

Error processing private_constant #631

Closed hallerm closed 1 year ago

hallerm commented 1 year ago

A typo in source code such as:

  class Oops; end
  private_constant(&:Oops)

Will cause solargraph 0.48.0 to terminate parsing with the following error:

[Extension Host] [WARN] Error processing request: [NoMethodError] undefined method `type' for nil:NilClass

console.ts:137 [Extension Host] [WARN] /opt/homebrew/lib/ruby/gems/2.6.0/gems/solargraph-0.48.0/lib/solargraph/parser/rubyvm/node_processors/send_node.rb:235:in `block in process_private_constant'
/opt/homebrew/lib/ruby/gems/2.6.0/gems/solargraph-0.48.0/lib/solargraph/parser/rubyvm/node_processors/send_node.rb:234:in `each'
/opt/homebrew/lib/ruby/gems/2.6.0/gems/solargraph-0.48.0/lib/solargraph/parser/rubyvm/node_processors/send_node.rb:234:in `process_private_constant'