Improve overload resolution and macro handling in Chain::Call - #34
Closed
apiology wants to merge 3 commits into
Closed
Improve overload resolution and macro handling in Chain::Call#34apiology wants to merge 3 commits into
apiology wants to merge 3 commits into
Conversation
Extract per-overload signature matching in Call#inferred_pins into match_overload_type, improving how argument/block types are matched against method overloads and how macro/directive-based pins are reprocessed when no signature matches by type alone. Extracted from castwide#1006 (Improve pin caching) as a standalone piece: this is a type-inference improvement to method call resolution, independent of the gem pin caching machinery in the rest of that PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
apiology
marked this pull request as draft
August 2, 2026 15:52
That PR restores the array/tuple literal element-type inference that master reverted, which is what these pending specs are waiting on. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Filed a new issue after tracing the root cause enough to size a fix: it's not in Chain::Call's overload matching (this PR's own code) but in how the resulting local variable's type gets resolved/cached afterward, a different subsystem than what this PR touches. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Owner
Author
|
Resubmitting this against castwide/solargraph upstream. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes macro-based return type inference when the macro's
$1/$2placeholders reference the call's actual arguments, not just literal text elsewhere:Foo.bar(String)inferred typenilStringRoot cause: macro/directive reprocessing only ran when normal overload matching produced no type at all.
bar's macro-based signature did produce a (wrong) type through the plain matching path, so reprocessing never ran.Chain::Call#inferred_pins's per-overload matching logic is extracted intomatch_overload_type, restructured so macro reprocessing runs whenever the matched type doesn't actually resolve the macro's placeholders against the real arguments.Also adds spec coverage for related overload/macro edge cases; 8 of the new specs are
pending, linked to tracking issues rather than left silently broken (#1223, #1246).Testing:
bundle exec rspec spec/source/chain/call_spec.rb spec/source_map/clip_spec.rb— 203 examples, 0 failures, 31 pending.