Skip to content

Morrow v2.4.14 — Explicit generic return substitution (result only)

Choose a tag to compare

@LeTrollologist LeTrollologist released this 02 Nov 11:19
· 25 commits to main since this release

Morrow v2.4.14 — Explicit generic return substitution (result only)

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

One small change at the shared call-result point, and the corpus decides whether it is
right.

The change

typeck.mw (call result, user functions): if the declared return type is the callee's
type parameter and the caller wrote ::<T>, the call's result type comes from that
instantiation instead of resolving T to the int placeholder.

fn id<T>(x: T) -> T
id::<String>("hello")   // result: String   (was int)
id::<i64>(7)            // result: i64      (was int, matched by accident)

Substitution is not argument validation

The substitution touches the result type only. Argument checking happens earlier, per
argument, against the declared parameters, and is untouched — which the corpus verifies
directly:

Case Expectation Before After
case3_generic_string — id::<String>("hi") 0 findings 0 0
case3b_generic_turbofish_mismatch — id::<i64>("hi") 1 finding 1 1 ✓ still reported
case14_generic_result_string_ok — want_string(id::<String>("hi")) 0 findings 1 (false positive) 0 ✓ fixed
case15_generic_result_int_ok — want_int(id::<i64>(7)) 0 findings 0 0 ✓ unchanged

id::<i64>("hi") remains reported after the change: the return type is now derived from the
instantiation while the argument is still checked on its own. That pair is the reason the
change is trustworthy.

What this does not fix

The accessor class is untouched, exactly as predicted:

Case Before After
case16_accessor_string_ok — want_string(vec_get(&v,0)) over Vec<String> 1 own 1 own (still a false positive)
case19_incompatible_must_report — same over Vec<i64> 1 own 1 own (still correctly reported)

And the aggregate over compiler/main.mw is 229, unchanged. That is the point: success
here is not a smaller count. The count did not move because the compiler's own findings are
arguments whose expressions are int-inferred, not turbofish results — a different class.

Verification

Gate Result
Corpus 21 files; the four affected cases measured before/after
Argument checking independent case3b still reports, by design
Native / compile-fail suites 23/23, 18/18
Fixed point 3-stage closure, stage2.exe == stage3.exe