Keep block parameter types documented by @!parse stubs - #94
Merged
apiology merged 2 commits intoSep 8, 2026
Merged
Conversation
A gem's plain &block signature and a workspace @!parse stub's yield-typed one only differ in the block's own type_arity, so combine_signatures_by_type_arity bucketed them as separate overloads and left picking between them to Chain::Call at every call site. Merge them into one signature before that bucketing instead, and make Callable#combine_blocks prefer the block that actually declares parameters rather than choosing arbitrarily. The merged pin is now correct on its own - hover and completion benefit too, not just inference at a call that happens to trigger dispatch_order.
The merge only fired when one side's block declared zero yielded parameters. A block documenting one parameter and a sibling documenting two hit the identical type_arity mismatch and still failed to combine. Compare declared parameter counts instead of emptiness, so any side with fewer yielded parameters loses to one with more, not just the zero case.
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.
This PR was written by Claude Code on behalf of @apiology.
Based on castwide#1288.
A workspace
@!parsestub's block parameter type has no effect when thegem's own doc already declares a return type:
The method pin itself carries only one of the two signatures, so hover
and completion lose the same information inference does.
combine_signatures_by_type_aritybuckets signatures bytype_aritybefore merging, and a block's declared-parameter count changes that
bucket, so this adds a pass that merges block-informativeness-only
differences first and makes
Callable#combine_blocksprefer the moreinformative block instead of choosing arbitrarily; two related gaps stay
open (a stub missing
@returnis discarded wholesale bycombine_signatures, anddef self.buildpaired withclass << selfnever combines pins at all).