Skip to content

Morrow v2.4.16 — Instantiation identity exists; the consumer does not

Choose a tag to compare

@LeTrollologist LeTrollologist released this 02 Nov 12:10
· 19 commits to main since this release

Morrow v2.4.16 — Instantiation identity exists; the consumer does not

Release date: 2026-11-02
Toolchain: forge 2.4.16 (morrow standalone 2026)
Self-hosting fixed point: D9217D1E573A2837A2FEDCA46DCDCACD03F8E0255B835CA15218FA344D69F810
(stage2.ll == stage3.ll, stage2.exe == stage3.exe, 471552 bytes)

The representation change is in. It does not yet satisfy the acceptance criteria, and
this note says exactly which ones and why.

What changed

  • parse_type no longer discards a type's argument list: Vec<String>, Vec<i64> and
    Vec<Vec<String>> are interned as distinct symbols at parse time.
  • tc_resolve_type resolves a declaration by the bare name but keeps the concrete symbol
    on the resulting type, so Vec<i64> and Vec<String> are distinguishable types.
  • The two struct-field paths (expr_field, stmt_field_assign) look fields up by bare name.
  • codegen never resolves types by name (no struct_defs reference at all), so this is
    confined to the typecheck layer.

Acceptance criteria — measured, not asserted

# Criterion Result
1 Vec<String> vs Vec<i64> distinct identities Met — two symbols, carried on TcType.sym
2 vec_get from Vec<String> → String Not met — see below
3 vec_get from Vec<i64> → i64 Not met — same reason
4 Wrong String/i64 pairing → diagnostic Met, unchanged (case 19: 1 own finding)
5 &Vec<String> reference preserved Not met — &/*mut are still stripped, exactly as before this release
6 &mut Vec<String> mutable reference preserved Not met — same
7 u8[0..100] refinement behavior Met — refinement suites pass unchanged
8 forge check without monomorphization Met — check/argkinds/lsp paths untouched
— Nested generics do not collapse Met at identity level (Vec<Vec<String>> keeps both brackets)

Why 2 and 3 cannot pass yet

alloc_stmt_let(arena, sym, expr) carries only a name and an initializer — a binding's
declared type is not in the AST at all. So

let mut v: Vec<String> = vec_new();   // annotation parsed, interned ... then dropped

v's type comes from vec_new()'s return (Vec, bare), and vec_get(&v, 0) sees no
element type. The element-substitution code is written and in place, but it has nothing to
read.

I attempted to let the report compare struct symbols anyway to satisfy criterion 1 visibly,
and the corpus rejected it immediately: vec_push/vec_get produced
want=struct got=struct for every call, because a param declared &mut Vec<T> now interns
as Vec<T> while an argument carries Vec. That is template-vs-instantiation noise, not a
mismatch, so the comparison is disabled and the reason is written into the code.

What the next change must be (not smuggled into this one)

One AST field: the declared type symbol on stmt_let (and the same for parameters and
returns, which already have ty_sym). With it, criteria 2, 3 and the refs in 5/6 become
implementable — the identity machinery they need already exists.

Verification

Gate Result
IR parity stage2.ll == stage3.ll = D9217D1E…4D69F810
Executable parity stage2.exe == stage3.exe, 471552 bytes
Native / compile-fail suites 23/23, 18/18
Corpus back to the v2.4.13 baseline: 16 → 2, 17 → 1, 19 → 2 (each includes the 1 std baseline line), case14 → 0
Examples / benchmarks 22/22 built, all benchmarks complete