Skip to content

Remove dead TypeMethods#qualify - #1337

Open
apiology wants to merge 1 commit into
castwide:masterfrom
apiology:remove-dead-typemethods-qualify
Open

Remove dead TypeMethods#qualify#1337
apiology wants to merge 1 commit into
castwide:masterfrom
apiology:remove-dead-typemethods-qualify

Conversation

@apiology

@apiology apiology commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Problem: ComplexType::TypeMethods#qualify cannot be called. TypeMethods is included only by UniqueType, which defines its own #qualify, and a method defined directly in a class wins over one from an included module. ComplexType does not include TypeMethods at all — it reaches the module only through a method_missing forward to @items.first, which never fires for a name the class defines itself, and it defines its own #qualify too.

UniqueType.instance_method(:qualify).owner   # => UniqueType
ComplexType.instance_method(:qualify).owner  # => ComplexType
ComplexType.ancestors.include?(TypeMethods)  # => false

The two live implementations also take (api_map, *gates) rather than this one's (api_map, context = ''), so a caller written against it would not work against either.

Solution: Delete it.

🤖 Generated with Claude Code

Nothing can reach this method. TypeMethods is included only by
UniqueType, which defines its own #qualify, and a method defined
directly in a class always wins over one from an included module.
ComplexType does not include TypeMethods at all -- it reaches the
module only through a method_missing forward to @items.first, which
never fires for a name the class defines itself, and ComplexType
defines its own #qualify too.

Checked at runtime rather than by reading:

    UniqueType.instance_method(:qualify).owner   # => UniqueType
    ComplexType.instance_method(:qualify).owner  # => ComplexType
    ComplexType.ancestors.include?(TypeMethods)  # => false

The two live implementations also take a different signature from this
one -- (api_map, *gates) rather than (api_map, context = '') -- so a
caller written against this version would not work against either.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@apiology
apiology marked this pull request as ready for review September 6, 2026 16:05
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.

1 participant