Skip to content

Fix NoMethodError in MethodAttr#inspect for cache-loaded aliases#1747

Merged
tompng merged 1 commit into
ruby:masterfrom
SAY-5:fix-inspect-cached-alias
Jul 18, 2026
Merged

Fix NoMethodError in MethodAttr#inspect for cache-loaded aliases#1747
tompng merged 1 commit into
ruby:masterfrom
SAY-5:fix-inspect-cached-alias

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

MethodAttr#inspect calls @is_alias_for.name directly, but for a method loaded from the ri cache @is_alias_for is still the unresolved [class, singleton, name] tuple, so calling inspect (e.g. p driver.stores.first.load_method("Array", "#append")) raises NoMethodError: undefined method 'name' for an instance of Array.

This mirrors the guard pretty_print already uses in the same file: use the resolved object's name when available, otherwise fall back to the method name from the tuple.

Closes #1737.

@SAY-5
SAY-5 temporarily deployed to fork-preview-protection July 18, 2026 14:31 — with GitHub Actions Inactive
@tompng
tompng merged commit f0d6f53 into ruby:master Jul 18, 2026
29 checks passed
@matzbot

matzbot commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

🚀 Preview deployment available at: https://44081a2c.rdoc-6cd.pages.dev (commit: 9576cdf)

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.

Alias method loaded from cache throws NoMethodError on inspect

3 participants