Type system and inference rules
- Deterministic typing for CLIF lowering.
- Minimal implicit behavior; prefer explicit casts.
Type inference strategy
Section titled “Type inference strategy”- Constraint-based inference (HM-lite) for locals and non-generic expressions.
- Generics resolved during type checking using declared bounds.
Literal typing (decision)
Section titled “Literal typing (decision)”- Integer literals default to
i32. - Float literals default to
f64. - Boolean literals map to
bool. - String literals map to
{ptr, len}at runtime,stringin HIR.
Numeric coercions
Section titled “Numeric coercions”- Implicit widening allowed only for:
i32->i64f32->f64
- All other conversions require explicit
cast. - Mixed int/float expressions require explicit cast.
Type checking phases
Section titled “Type checking phases”- Collect declarations.
- Resolve names (module + local scopes).
- Solve type constraints.
- Insert explicit
Castnodes.
Error reporting
Section titled “Error reporting”- Unknown type:
TypeNotFound. - Incompatible types:
TypeMismatch. - Ambiguous inference:
TypeInferenceAmbiguous.