Skip to content

Morrow v2.4.13 — Isolating the generic-result loss; no checker changes

Choose a tag to compare

@LeTrollologist LeTrollologist released this 02 Nov 09:17
· 28 commits to main since this release

Morrow v2.4.13 — Isolating the generic-result loss; no checker changes

Release date: 2026-11-02
Toolchain: forge 2.4.13 (morrow standalone 2026)
Self-hosting fixed point: 65E43B0AFBF6FCD8A8C17C029E8829DFB1D75DB9A31AB8446F11D141DB57C245
(stage2.ll == stage3.ll, stage2.exe == stage3.exe, 467968 bytes)

Tests and analysis only. The typechecker was not changed — the corpus now isolates the
problem, and locating it changed the plan.

Six new isolation cases (corpus: 20 files)

Attribution is now measured, not assumed: baseline_import_collections.mw reports 1
finding from std alone (want=String got=u8 :: hashmap_insert), and each case's own count
is total − baseline.

Case Situation Today (own) Target
14 want_string(id::<String>("hi")) 1 false positive 0
15 want_int(id::<i64>(7)) 0 0
16 want_string(vec_get(&v,0)) over Vec<String> 1 false positive 0
17 want_int(vec_get(&v,0)) over Vec<i64> 0 0
18 hashmap_insert(&mut m, "key", 1) 0 0
19 want_string(vec_get(&v,0)) over Vec<i64> 1 1 (must report)

Cases 15 and 17 pass by accident — the placeholder kind int happens to match i64.
They are in the corpus so any future fix must keep them passing.

The shared point, and why it is not one fix

The call-result type is produced in exactly one place per callee kind:

typeck.mw:737   let ret_sym = target_fn.ret_ty_sym;
typeck.mw:738   return tc_resolve_type(tc, types, struct_defs, ret_sym);
typeck.mw:745   let ret_sym = ext.ret_ty_sym;        (extern functions)

tc_resolve_type knows aliases and struct names only; T is neither, so it becomes
ty_int. Every generic-returning callee collapses there — one shared point, so no
vec_get/hashmap_insert special case is needed.

But the two false positives arrive with different information:

  • case 14 carries its instantiation in the turbofish, already stored in
    expr.int_val. A substitution at line 737 is sufficient, needs no new state, and is
    provably correct for that class.
  • case 16 has no turbofish. T is only knowable from the container's element type,
    which TcType does not record for struct instantiations (Vec stores data, len,
    cap, arena — not T). No lookup at line 737 can recover it. It needs element-type
    tracking, which is a representation change, not a rule.

A helper table of "functions that return their first argument's element" would make case 16
green while encoding the same kind of knowledge the project keeps deleting. Rejected on
purpose, and recorded as rejected.

Verification

Gate Result
Corpus 20 files; six new cases measured with own/baseline attribution
Native / compile-fail suites 23/23, 18/18
Checker changes none
Fixed point 3-stage closure, stage2.exe == stage3.exe