Open dazuma opened 2 years ago
I am encountering this as well. without really grokking this code:
https://github.com/lsegal/yard/blob/v0.9.27/lib/yard/parser/ruby/ruby_parser.rb#L373
I tried flipping the shift to a pop, since the correct entry of @map[:aref]
was in the last position, which resolved my errors.
but I see this change was made in https://github.com/lsegal/yard/pull/1389 and the test added there fails when it is a pop.
some other fix is needed.
đŸ‘‹ I'm the author of the PR that caused the regression, thanks for flagging it @notEthan.
Do one of you want to create a branch with a failing test? I'll take a look and see if I can land a fix things up.
Create the following file
foo.rb
:Run yardoc with this file, using yard 0.9.27 on Ruby 3.0.3. It results in an exception similar to the following:
I've tracked this down as far as determining that the value for the constant node for
X
is empty due to the node having an invalidsource_range
where the ending position is less than the beginning. The ending position is actually coming from the previous aref from the linea[:b] = 1
. The parser doesn't seem to consume that aref when it is on the LHS of an assignment operator, so when theX = a[:b]
line gets parsed in RipperParser#on_aref, it's getting the ending position from the previous instance.This appears to be a regression in 0.9.27. It does not happen in 0.9.26. Ruby 3.0.3. 2019 Macbook Pro running Monterey 12.1, although I doubt that matters.