Repository navigation
Conversation
Since castwide#1201, resolve_generics bound a class's first generic to the union of every receiver parameter and all later generics to undefined. That is right for Array<A, B> and tuple receivers, which castwide#1201 treats as parameterized arrays, but wrong for classes declaring several generics. Enumerator[Elem, Return] lost Return and got Elem bound to Elem | Return, so the blocks of map.with_index and each_with_index.map received no usable element type. Keep the union for implicit-union and fixed-parameter receivers, and bind other receivers' declared generics by position again, falling back to the RBS generic default.
Owner
Author
|
Claude: Closing as a duplicate of castwide/solargraph#1415, Resolve every generic parameter, not only the first. On its head, |
apiology
added a commit
that referenced
this pull request
Oct 27, 2026
Cover the block parameters and result of map.with_index, the pair yielded by each_with_index.map, and a tuple receiver of a single-generic class, which positional binding must leave as a union. Carried over from #354, which this PR supersedes.
apiology
added a commit
that referenced
this pull request
Oct 27, 2026
#354 is closing as a duplicate of castwide#1415, which also clears this finding.
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.
Claude: This PR was written by Claude Code on behalf of @apiology.
Problem: Block parameters of
map.with_indexlose their types:Every receiver whose class declares two or more generics, such as core RBS's
Enumerator[Elem, Return], has lost them since castwide/solargraph#1201;names.each_with_index.map { |pair| }typespairasArray(String, Integer), Array<String>.Solution: Bind a multi-generic receiver's declared parameters by position again, keeping castwide#1201's union binding for
Array<A, B>and tuple receivers, so every type comes from a declaration andChain::Literal,Chain::Array,literal?andtuple?stay untouched.Not covered: destructuring that tuple into
|name, idx|also needstuple?re-enabled, which apiology/solargraph#341 does.