Repository navigation
Conversation
TypeMethods#tuple? always returned false, so destructuring an Array(Foo, Bar) gave every target the first element's type. Array literals no longer produce fixed-parameter types, so a tuple only comes from a YARD or RBS declaration and tuple? can report it again. Targets after a splat now carry a negative index, and a tuple gives them the union of its elements, since which element they get depends on the tuple's length. This also types block parameters destructured from a yielded tuple (Hash#each), fixing three pending specs, and clears two ignore markers in RbsMap::Conversions#rebound_alias?. The new subtraction in MasgnNode gets a marker for the bigdecimal Integer#- defect fixed by #286.
CI's strong typecheck reports the marker on SourceMap::Mapper's comment position as unneeded now that destructured comments are typed.
apiology
marked this pull request as ready for review
October 24, 2026 23:08
The BigDecimal Integer#- false positive it covered appears only in a local Ruby 3.2.6 setup; CI never reports it.
Tuple typing now types ut in resolve_param_generics_from_context, which exposes the nil-vs-NilClass argument check that castwide#1451 fixes.
Destructured facts are now typed, exposing Hash#fetch(key, nil) returning generic<X> and the nil argument check. Both castwide#1266 and castwide#1451 are needed to clear it.
castwide#1258 narrows a repeated pure call with a local variable argument, which is the cp[i] shape this line hits.
Owner
Author
|
Claude: Opened upstream as castwide#1461. |
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: Destructuring a declared tuple gives every variable the first element's type:
A declared
Array(A, B)is read asArray<A>for mass assignment and destructured block parameters such asHash#each { |k, v| }.Solution: Re-enable
TypeMethods#tuple?, which only declared types can satisfy now that array literals infer a bareArray, and give targets after a splat the union of the tuple's elements, since their position depends on the tuple's length.Out of scope:
pair.firstandpair[0]stayFoo, Bar, nil; positional element methods need the tuple fill removed in castwide#1201.Typed block parameters expose Solargraph gaps in its own code. Two are marked with the fix PRs that clear them:
unique_type.rb:431(castwide#1451) andflow_sensitive_typing.rb:234(castwide#1266 with castwide#1451). One remains unmarked:complex_type/unique_type.rb:426: Unresolved call to mapMarkers cleared: 1