Type checking defers only judgments that depend on unknown facts
Adopted November 19, 2026 · 6.0.0 · In progress
Problem
A misspelled type could produce several diagnostics for the same underlying error. An independent error could also be missed when it concerned a field whose type was still known.
Decision
- During checking, report each distinct failed obligation once. An unresolved type name is one cause of TPZ5022.
- Answer each judgment yes, no, or undetermined. Defer follow-up diagnostics only when facts needed for the answer are undetermined.
- Continue checking nominal declarations, variant names, arity, and known field types. Use TPZ5020 for a definite lack of inference context and TPZ5001 for a definite contradiction.
- Use the same rule for constructors, protocol conformance, derivation, uses, and public interfaces. Report errors proved by facts independent of the cause.
- Keep field and payload combinations together when checking patterns. Report independently provable gaps with TPZ5021 and unreachable branches with TPZ5713.
- If the cause makes checking fail, execution does not start.
Alternatives considered
- Handle recovery separately at every use, or consider the entire type undetermined. Local recovery can cascade or repeat diagnostics, while discarding the whole type loses useful facts.
- Stop all other diagnostics for the affected module. Independent errors in the same module would be hidden.
Why
Fixes can focus on the original error while independent problems remain visible.
Generic functions keep their polymorphism in bindings
Adopted November 19, 2026 · 6.0.0 · In progress
Problem
A generic function can be given another name and called at several types. Previously, assigning a monomorphic function to a polymorphic binding could pass checking and fail at runtime.
Decision
- An eligible unannotated binding preserves the generic signature. Ordinary function values, record fields, and array elements have monomorphic types.
- Instantiate each value use afresh. A later operation in the same expression may resolve its type, but a slot left open when the binding or statement closes produces TPZ5020 at check time.
- A replacement for a mutable generic binding must accept all calls the binding permits. An incompatible monomorphic replacement produces TPZ5001 during checking.
- Turning
json.parseAs into a monomorphic value without explicit type arguments produces TPZ5534 at check time. Check the json.stringify JSON requirement at instantiation as well. - A private bound exposed by a public binding produces TPZ5524 at check time.
Alternatives considered
- Restrict every mutable binding to a monomorphic type. A valid generic alias could no longer serve multiple types merely because it was mutable.
- Store polymorphism in array element or record field types. Inference would need new rules for transporting polymorphic types through type arguments and storage.
- Erase unused type parameters or close inference at container construction. Erasure would require proofs that survive reassignment, while closing at construction would block resolution later in the same expression.
- Keep the current behavior. A checked program could still hit a runtime type error, and public bounds would leak.
- Use unrestricted impredicative inference. Inference, sealed plans and the runtime would all need new transport rules.
- Make
parseAs use the context type. It changes the explicit type argument contract, which needs its own decision.
Why
Valid generic aliases keep working, while incompatible assignments and unresolved type arguments are detected before execution.
Standard library constructor and cost faults point to the public call
Adopted November 7, 2026 · 6.0.0 · Being verified
Problem
A constructor or cost calculation can fail inside the library. An internal operation location leaves the caller to trace it back to the supplied value.
Decision
Use the public call site as the primary location of faults from standard library constructors and cost calculations.
Alternatives considered
- Keep the internal arithmetic or intrinsic location. The caller would have to find the source call to repair its input.
Why
The diagnostic points directly to the call and values to inspect.