Fix steep warnings introduced by rbs 4.1.3 - #849
Merged
Conversation
CI does not commit Gemfile.lock, so the rbs upgrade from 4.0.3 to
4.1.3 landed unlocked and introduced eight steep warnings that fail
`rake steep` on untouched main. Fix each by category:
- rbs 4.1 now types two previously problematic calls correctly,
turning their `# steep:ignore` comments into RedundantIgnoreComment
warnings: drop them (Options.new, Options::Definitions#features=).
- rbs 4.1 declares the block of `Enumerable#to_h` as returning
`Hash::_Pair[K, V]`, an interface whose `to_ary` returns a tuple.
Steep types an array-literal block body as `Array[...]`, never a
tuple, so every `to_h { [k, v] }` now warns. Where an equally
simple block-free form exists, use it: `Hash#invert` for
Status::SYMBOL_CODES and a literal hash for PerOperation::KEYS.
Headers#to_h, Headers#deconstruct_keys, and Options#to_hash keep
their code with a targeted `# steep:ignore` instead: block-free
rewrites of these trip Style/MapToHash or Style/ReduceToHash, and
multi-line tuple assertions push Headers past Metrics/ClassLength.
- Steep now types `&:size` in `CompositeIO#size` as a bare `::Proc`,
which no longer matches `sum`'s optional block type. Keep the code
with a targeted `# steep:ignore`, since the explicit-block form
trips Style/SymbolProc.
sferik
approved these changes
Aug 16, 2026
sferik
added a commit
that referenced
this pull request
Aug 16, 2026
Follow-up to #849, which adapted the type-check sources to rbs 4.1's stricter signatures but left the floor at ">= 4". The two changes are not backwards compatible: under rbs 4.0.3 the current sources produce six warnings, since the four added `# steep:ignore` comments become RedundantIgnoreComment and the two removed ones let UnannotatedEmptyCollection resurface (Options.new and Options::Definitions#features=). CI always resolves the newest rbs, because Gemfile.lock is gitignored, so it never saw this. A contributor with a lockfile resolved at 4.0.x would get a red `rake steep` with no indication that the fix is to update rbs. Raise the floor to the version the sources actually require; 4.1.0 type-checks clean.
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.
CI resolves gems fresh on every run (
Gemfile.lockis not committed). The last green run on main resolved rbs 4.0.3; runs today resolve rbs 4.1.3, which introduces 8 new warnings, so the steep job fails even on an untouched checkout of main (see #847 and #848).Changes, net 8 insertions and 8 deletions, behavior identical:
# steep:ignorecomments that rbs 4.1.3 flags as redundant.# steep:ignorecomments where the stricter signatures cannot be satisfied without restructuring: three.to_h { block }sites (block body vs the newHash::_Pairexpected type) and onesum(&:size)(bareProcvssum's optional block type).to_hswap inSYMBOL_CODESwithSYMBOLS.invert, and writePerOperation::KEYSas a literal hash.Tried and rejected:
.map { }.to_h(RuboCopStyle/MapToHash),each_with_object(steepUnannotatedEmptyCollection, RuboCopStyle/ReduceToHash), inline tuple assertions (Metrics/ClassLength).