Infer element types for array literals and NilClass for nil literals - #40
Draft
apiology wants to merge 1 commit into
Draft
Infer element types for array literals and NilClass for nil literals#40apiology wants to merge 1 commit into
apiology wants to merge 1 commit into
Conversation
Array literal chains (`[1, 2, 3]`) previously resolved to a bare `Array` with no element type. Infer each child's type and attach it as the Array's generic parameter, falling back to plain `Array` when empty or undefined. `simplify_literals` left the `nil` pseudo-type tag as-is instead of converting it to `NilClass` like other literals are converted to their class names. This also surfaced two previously-pending specs (NilClass/nil conformance, and passing a NilClass value to a `nil` parameter) that now pass.
Closed
2 tasks
apiology
added a commit
that referenced
this pull request
Aug 6, 2026
This pending case already existed on master with a vague "side of effect of inference changes" reason. It's the same nil-doesn't-simplify-to-NilClass gap that's already tracked and fixed (pending merge) in castwide#1223 and #40. Make that traceable instead of leaving the next reader to rediscover it.
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.
ComplexType::UniqueType#simplify_literalsconverts literal types to their class name (e.g.1→Integer), but left thenilpseudo-type tag untouched — so1 | nilsimplified toInteger | nilinstead ofInteger | NilClass, inconsistent with every other literal.to_rbsspecial-cased theniltag name to render RBSnil; it now also special-casesNilClassso simplified types still render asnilrather than::NilClass:Stacked on castwide#1223 (
apiology-1196-literal-inference); diff here is scoped to this onenil/NilClassfix (2 files, 3 lines).🤖 Generated with Claude Code