Skip to content

Remove duplicate dead methods in RbsMap::Conversions - #41

Closed
apiology wants to merge 1 commit into
masterfrom
rbs-conversions-dead-code-cleanup
Closed

Remove duplicate dead methods in RbsMap::Conversions#41
apiology wants to merge 1 commit into
masterfrom
rbs-conversions-dead-code-cleanup

Conversation

@apiology

@apiology apiology commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Why

RbsMap::Conversions#build_type and #parts_of_function are each defined twice in this file. Ruby silently uses the later definition, so the earlier one is dead code — but it's live-looking dead code: it references two helper methods (other_type_to_type, method_type_to_type) that don't exist anywhere in lib/, so if anything ever called the shadowed version, it would raise NoMethodError. Nothing currently reaches it, but it's a landmine for the next refactor that touches this file and doesn't know to check which definition actually runs.

How

Delete the earlier (shadowed) definitions of both methods. Also fixes a merge artifact nearby: a # rubocop:enable comment had gotten concatenated onto the same line as the next method's docstring, breaking both the rubocop directive and the docstring.

What's in it

  • lib/solargraph/rbs_map/conversions.rb: -100/+2 lines, no behavior change (dead code removed).

Testing: bundle exec rspec spec/rbs_map/ — 30 examples, 0 failures, 4 pending.

Two pairs of duplicate method definitions (parts_of_function,
build_type) exist in this file, where an old implementation was left
in place, shadowed and made unreachable by a newer one added elsewhere
in the file - Ruby silently uses the later definition, so the earlier
one is dead code. The dead build_type/parts_of_function reference two
helper methods (other_type_to_type, method_type_to_type) that don't
exist anywhere in lib/, so either would raise NoMethodError if ever
reached.

Also fixes a merge artifact: a `# rubocop:enable` comment had gotten
concatenated onto the same line as the next method's docstring
comment, which both broke the rubocop directive and orphaned the
docstring.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@apiology

apiology commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Resubmitting this against castwide/solargraph upstream.

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