Add accessors for type nodes
The type checker reads and writes the fields of type_expr directly in about 1,000 places, which ties it to the boxed mutable record. Upstream OCaml (4.14 and later) made type_expr abstract behind get_desc, get_level, get_id and Transient_expr; this adds the same layer while the record stays visible, so modules can be converted one at a time and type_expr made abstract once none reads the fields.
get_desc returns the node's own descriptor and does not call repr, so callers keep calling repr first and path compression stays where it is. get_desc, get_level and the raw setters are field primitives, which compile to the same loads and stores as field access, also in dune's dev profile, which builds with -opaque.
Review
- Does this change the representation or any output? No. The record and its field order are unchanged; only the way code reaches the fields is new.