Generic type ops - #42
Merged
Merged
Conversation
KotlinIsland
force-pushed
the
main
branch
6 times, most recently
from
July 22, 2026 08:38
0a30a5b to
a2564b5
Compare
…lization
a foldable operation in a type expression whose operand still mentions a type
parameter — `Array[Dim + 1]`, `-> I + 1`, `I < 10`, `S.startswith("foo")` — is
kept symbolic as a new `Type::Deferred` instead of eagerly collapsing to the
parameter's bound. when the parameter is specialized at a call site, the operation
re-runs with the same fold value inference uses, so `extend(x: Array[5])` infers
`Array[6]` rather than `Array[int]`
covers binary, unary, comparison and method-call operations. the literal folds are
shared with value inference (`literal_binary_op` / `literal_unary_op` extracted,
`deferred_comparison` added); a deferred operation behaves as its reduced form for
every purpose except type-mapping
…e safety
extend the symbolic-type-op transpiler pass to fold `Compare` (rich operators) and
positional method `Call` expressions in type positions to the type ty resolves them
to, matching the existing binary/unary folding. this keeps deferred-operation return
annotations like `-> I < 10` and `-> S.startswith("foo")` runtime-safe (they lower to
`-> bool`) instead of leaking a `TypeVar` operation that crashes at import
also give the deferred-type mdtest blocks real (non-raising) bodies so the runtime
divergence harness can execute them
…resolves `Type::Deferred` is a public enum variant, so `cargo doc -D warnings` rejects its doc comment linking to the `pub(crate)`-re-exported `DeferredType` (private-intra-doc-links). re-export `DeferredType`/`DeferredOperation` with `pub`, matching `OverlappingType`
KotlinIsland
force-pushed
the
generic-type-ops
branch
from
July 22, 2026 23:57
57bfb39 to
de550f2
Compare
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.
No description provided.