castwide/solargraph

Spec failure on Ruby 3.3

Opened this issue · 2 comments

I encountered this while testing bumping Ruby version to 3.3 (the current latest version):

https://github.com/castwide/solargraph/actions/runs/11329721863/job/31505892088?pr=725

[WARN] Error reading /tmp/d20241014-2342-yud17h/test.gemspec
[WARN] /tmp/d20241014-2342-yud17h/test.gemspec:2:in `<main>': Error (RuntimeError)
	from -e:1:in `eval'
	from -e:1:in `<main>'

[WARN] Error reading /tmp/d202[41](https://github.com/castwide/solargraph/actions/runs/11329721863/job/31505892088?pr=725#step:6:42)014-2342-aadwlg/test.gemspec
[WARN] -e:1:in `eval': --> /tmp/d20241014-23[42](https://github.com/castwide/solargraph/actions/runs/11329721863/job/31505892088?pr=725#step:6:43)-aadwlg/test.gemspec
expected a method name
> 2        123.
> 3      
/tmp/d20241014-2342-aadwlg/test.gemspec:3: syntax error, unexpected end-of-input (SyntaxError)
	from -e:1:in `<main>'

[WARN] Error loading ./path/does_not_exist.rb: [Errno::ENOENT] No such file or directory @ rb_sysopen - ./path/does_not_exist.rb
................................................................................................................................................................................................................................................................................................................................................................................................................................................................F...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Failures:

  1) Solargraph::Source::Chain infers booleans from or-nodes passed to !
     Failure/Error: expect(type.tag).to eq('Boolean')

       expected: #<Encoding:UTF-8> "Boolean"
            got: #<Encoding:ASCII-8BIT> "undefined"

       (compared using ==)
     # ./spec/source/chain_spec.rb:164:in `block (2 levels) in <top (required)>'

Finished in 35.76 seconds (files took 1.91 seconds to load)
1012 examples, 1 failure

Failed examples:

rspec ./spec/source/chain_spec.rb:1[56](https://github.com/castwide/solargraph/actions/runs/11329721863/job/31505892088?pr=725#step:6:57) # Solargraph::Source::Chain infers booleans from or-nodes passed to !

So it means that !([].include?('.') || [].include?('#')) is not a direct block anymore, and it is a "BEGIN" block

however, the check

expects :begin, but I'm getting :BEGIN

N: #<RubyVM::AbstractSyntaxTree::Node:OPCALL@2:7-2:46>
N: #<RubyVM::AbstractSyntaxTree::Node:BEGIN@2:8-2:46>
-          elsif n.type == :begin
+          elsif n.type == :BEGIN

With this change, the spec pass, but I'm not going to propose it because I don't know why it is lower case, whether if it should check for both, if other occurrences of "begin" should be fixed too