-
-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right hand assignment inside case/when/end causes cannot get the first element of beginless range (RangeError) #1434
Comments
I have a similar failure, but with a different pattern (heavily stripped down) case [self, other]
in [MetaType[id], *]
if other in MetaType[id2]
end
end
|
I believe the proper fix is in def line
line_range && line_range.first
end by def line
line_range && line_range.begin
end since However in that case yardoc dies farther:
so it looks like after all it does not like def line
line_range && line_range.begin || 1
end and this time yardoc finishes properly. |
It turns out I also need to change self.line_range = Range.new(f.line_range.begin || 1, l.line_range.last)
self.source_range = Range.new(f.source_range.begin || 1, l.source_range.last) instead of using |
This implements the fix suggested by @akimd: See lsegal#1434 (comment) Fixes lsegal#1434.
Yards AST parser raises
cannot get the first element of beginless range (RangeError)
when using right-hand assignment and restructuring.I have tried using restructuring in different contexts and only the use from the examples below inside of the case statement causes an error.
Steps to reproduce
Example 1 - causes an error
Example 2 - causes an error
Example 3 - no error
The error does not occur in every context, I was only able to trigger it inside the case/when statement.
Actual Output
Expected Output
I expect no errors and no docs produced from the example
Environment details:
macOS 11.6.2 (20G314)
ruby -v
):ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin20]
yard -v
):yard 0.9.27
I have read the Contributing Guide.
The text was updated successfully, but these errors were encountered: