Support constant assign parsed before class/module definition#1621
Merged
tompng merged 1 commit intoruby:masterfrom Feb 22, 2026
Merged
Support constant assign parsed before class/module definition#1621tompng merged 1 commit intoruby:masterfrom
tompng merged 1 commit intoruby:masterfrom
Conversation
Collaborator
|
🚀 Preview deployment available at: https://2f6c154e.rdoc-6cd.pages.dev (commit: bc71285) |
kou
approved these changes
Feb 21, 2026
lib/rdoc/code_object/constant.rb
Outdated
| # The module or class this constant is an alias for | ||
|
|
||
| def is_alias_for | ||
| @is_alias_for ||= find_alias_for |
Member
There was a problem hiding this comment.
May find_alias_for return a String? If find_alias_for must not return a String, how about doing this in else?
diff --git a/lib/rdoc/code_object/constant.rb b/lib/rdoc/code_object/constant.rb
index 8823b0bd..69c3133a 100644
--- a/lib/rdoc/code_object/constant.rb
+++ b/lib/rdoc/code_object/constant.rb
@@ -92,7 +92,7 @@ class RDoc::Constant < RDoc::CodeObject
@is_alias_for = found if found
@is_alias_for
else
- @is_alias_for
+ @is_alias_for ||= find_alias_for
end
end
Member
Author
There was a problem hiding this comment.
That looks much better, thank you. Updated
Support `Const = RHS` parsed before `class RHS;end` defined in another file.
ab711b7 to
bc71285
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support
Const = RHSparsed beforeclass RHS;enddefined in another file.This will fix one document-coverage check failure in ruby/ruby#16194