Skip to content

Remove the unmatched constant alias queue - #1766

Open
tompng wants to merge 1 commit into
ruby:masterfrom
tompng:remove_unmatched_constant_alias
Open

Remove the unmatched constant alias queue#1766
tompng wants to merge 1 commit into
ruby:masterfrom
tompng:remove_unmatched_constant_alias

Conversation

@tompng

@tompng tompng commented Aug 7, 2026

Copy link
Copy Markdown
Member

unmatched_constant_alias is not used anymore.

Value was set in add_module_alias(from, from_name, to, file) when from is nil, but all path that calls add_module_alias doesn't pass nil to it.

Copilot AI lite review requested due to automatic review settings August 7, 2026 15:06
@tompng
tompng temporarily deployed to fork-preview-protection August 7, 2026 15:06 — with GitHub Actions Inactive
@matzbot

matzbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

🚀 Preview deployment available at: https://7f7a8602.rdoc-6cd.pages.dev (commit: 80583c3)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the previously-unused unmatched_constant_alias queue from RDoc::Store and deletes the related deferred-alias handling in RDoc::Context, based on the fact that current call paths never invoke add_module_alias with a nil source.

Changes:

  • Removed RDoc::Store#unmatched_constant_alias (reader and initialization).
  • Deleted deferred alias-resolution logic that depended on the store’s unmatched-alias queue.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/rdoc/store.rb Removes the unused unmatched-constant-alias queue from the store.
lib/rdoc/code_object/context.rb Removes queue-driven deferred alias handling tied to unmatched_constant_alias.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 559 to 560
# BasicObject = BlankSlate
return from if @store.find_class_or_module to_full_name
The queue handled a module alias whose target was not yet in the
store, to be replayed when the target appeared. No caller passes an
unresolved target anymore: the Ruby parser only registers a module
alias after finding the target, and has been doing so since the
Ripper-based parser was removed. A constant alias whose target
appears later is handled by Constant#is_alias_for_path and
ClassModule#update_aliases at Store#complete time.

The from_name parameter of Context#add_module_alias only fed the
queue, so it is removed as well.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 7, 2026 16:41
@tompng
tompng force-pushed the remove_unmatched_constant_alias branch from 603fa0f to 80583c3 Compare August 7, 2026 16:41
@tompng
tompng deployed to fork-preview-protection August 7, 2026 16:41 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Suppressed comments (1)

lib/rdoc/code_object/context.rb:552

  • RDoc::Context#add_module_alias is a documented (public) method, and this change reduces its arity from 4 to 3 args. Even though the repo’s call sites were updated, this is a breaking API change for any external callers.

Consider keeping backward compatibility by accepting both the new (from, to, file) form and the legacy (from, from_name, to, file) form (ignoring from_name), and add an explicit ArgumentError when from is nil to avoid a confusing NoMethodError on from.dup.

  # Adds an alias from +from+ (a class or module) to the constant +to+ which
  # was defined in +file+.

  def add_module_alias(from, to, file)
    return from if @done_documenting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants