Repository navigation
Morrow v2.4.17 — Formatter Safety and Dynamic Effect Dispatch
Morrow v2.4.17 — Formatter Safety and Dynamic Effect Dispatch
Release date: 2026-11-09
Toolchain: forge 2.4.17 (morrow standalone 2026)
Self-hosting fixed point: D3310C7410197C6934B91165FFC6B11E2BE6CE6F2C526EB62C2F6F48C6A15F6D
(stage2.ll == stage3.ll, stage2.exe == stage3.exe, 492,544 bytes)
This is a correctness patch for the two Critical findings in
docs/AUDIT-2026-11-08.md. There are no syntax changes.
C-01 — forge fmt no longer destroys source
forge fmt previously dropped imports, effect declarations, pub, yields,
comments, and pointer/reference spelling, and could write a partial file after a parse
error. It now:
- refuses to write when tokenization or parsing reports an error;
- refuses comments, and refuses any file whose formatted output would change the token
stream (ignoring only semicolons and trailing commas); - validates that the formatted candidate parses before touching the original;
- preserves
let/varand->, re-escapes string literals, and preserves refined
type aliases; - replaces files via temp file + backup + restore, never deleting an existing backup.
Files containing constructs the printer cannot represent yet (imports, effects,
pub, pointers, struct literals, handlers) are refused with a diagnostic and left
byte-for-byte unchanged. Full lossless printing remains Phase 15 P0-1 in the roadmap.
C-02 — handlers now win for IO, FS, and Process
The TIR pass used to rewrite built-in effects to runtime calls whenever the perform
was not lexically inside a handle in the same function. That bypassed handlers
around callees and compiled IO.print(i64) as puts((char*)i64).
Every perform is now dynamic. morrow_effect_find_handler searches the user handler
stack first, then returns a static default frame. Defaults are installed only for the
canonical signatures:
FS: all six standard operations;Process:spawn(String, String);IO.print:String.
Default dispatch performs the real runtime operation and resumes the continuation.
generics_and_relational.mw now runs, FS.read_file under a handler returns the
mock value, and IO.print(i64)/Process.spawn dispatch to user handlers.
Verification
| Gate | Result |
|---|---|
| Native suites | 23 positive |
| Compile-fail suites | 18 |
| Examples | 22/22 build in the local pipeline |
| Bootstrap | stage2/stage3 IR and executable byte-identical |
| Distribution | Morrow-v2.4.17-win64.zip, forge.exe, mwc.exe, SHA256SUMS.txt |
New regression tests:
tests/formatter_tests.mw: safe file formats; comments, parse errors, effects,
and struct literals are refused unchanged; no temp/backup left behind.tests/effects_test.mw:IO/FS/Process-shaped effects performed in a callee
under a handler dispatch to that handler. The suite fails on v2.4.16.
Compatibility
Source-compatible patch. forge fmt is now deliberately conservative: it may refuse
a file it previously (incorrectly) "formatted". Rebuild downstream tooling against
this toolchain; bin/mwc.exe and bin/forge.exe are rebuilt from the fixed sources.