Commit Graph
1 Commits
Author SHA1 Message Date
Minus 48b1b84ea6 type checker, phase 1: hints are checked where concrete
First slice of the static-typing foundation (traits/generics/Sized()
will build on it).  Typing stays structural and permissive: an unknown
or opaque name is never a rejection, so existing programs keep working.

- new module cat/types/type.{h,c}: compile-time-only descriptors
  (int/float/bool/text/empty/object/function/list/memory/any + interned
  named/opaque types), with equal/assignable/join and int->float widening.
- compiler: skip_type_hint -> parse_type_hint, which returns the type of
  the first identifier in a hint (the rest of a balanced hint is still
  consumed and ignored, so `cbyte[sentinel_sized<0>]` parses).
- `local NAME : T = <literal>` is checked: assigning a known concrete
  literal of the wrong kind to a known concrete type raises at compile
  time ("line N: cannot assign text to int").  Unknown/opaque names and
  non-literal expressions stay permissive.
- FuncCtx tracks a declared/inferred type per local slot.
- tests/types.cat + suite block: ok hints, int->float widening, opaque
  names accepted, and a wrong assignment rejected.  Suite 136 -> 140.
2026-11-18 16:56:40 +00:00