Skip to content

Generic type ops - #42

Merged
KotlinIsland merged 3 commits into
mainfrom
generic-type-ops
Jul 23, 2026
Merged

Generic type ops#42
KotlinIsland merged 3 commits into
mainfrom
generic-type-ops

Conversation

@KotlinIsland

Copy link
Copy Markdown
Owner

No description provided.

@KotlinIsland
KotlinIsland force-pushed the main branch 6 times, most recently from 0a30a5b to a2564b5 Compare July 22, 2026 08:38
…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
KotlinIsland merged commit f8e6c11 into main Jul 23, 2026
60 of 61 checks passed
@KotlinIsland
KotlinIsland deleted the generic-type-ops branch July 23, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant