Skip to content

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

Open
SAY-5 wants to merge 1 commit into
ruby:masterfrom
SAY-5:fix-inspect-cached-alias
Open

Fix NoMethodError in MethodAttr#inspect for cache-loaded aliases#1747
SAY-5 wants to merge 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

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.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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

1 participant