Closed swiknaba closed 3 years ago
This is due to a change in Ruby: https://bugs.ruby-lang.org/issues/6087#note-18
Sexp
is a subclass of Array
, so it is affected.
However, I found that Sexp#sexp_body
is a good replacement.
Using Sexp#sexp_body()
instead of Sexp#[]
indeed solves the problem, since it yields the same result as Sexp#[]
in Ruby < 3. Thanks!
Parsing the following simple example:
returns the following Sexp:
let's assign this a variable, e.g.
call_element
.Now let's extract a sub-tree:
Result in Ruby 2.7.2:
Result in Ruby 3.0.0:
is this an expected change, i.e. do I now need to check, if a sub-tree is an array or a Sexp? I would expect
call_element[3..-1]
to always return a Sexp if possible.Find more details here: https://github.com/DamirSvrtan/fasterer/pull/85