Summary
winn_transform.erl is the most complex file in the compiler at 689 lines, running 7 ordered desugaring passes. Each pass assumes specific invariants from prior passes (e.g., multi-clause merge depends on case-wrapping, import rewriting runs last). As features interact in new ways, subtle ordering bugs can emerge.
Proposed Work
- Add explicit integration tests that exercise pass interactions, not just individual features:
- Import + pipe + pattern matching combined
- Schema + protocol + default params on the same module
- Use directive + multi-clause merge + guard functions
- Struct + impl + import rewriting
- Document the invariants each pass expects from prior passes (comments or a design doc)
- Consider adding an assertion/validation step between passes during debug builds to catch invariant violations early
Why
This is the file where new features are most likely to introduce regressions. The ordered-pass design is good — but the ordering contract is implicit. Making it explicit and well-tested prevents future "works in isolation, breaks in combination" bugs.
Target Version
v0.10.0 (Hardening)
Summary
winn_transform.erlis the most complex file in the compiler at 689 lines, running 7 ordered desugaring passes. Each pass assumes specific invariants from prior passes (e.g., multi-clause merge depends on case-wrapping, import rewriting runs last). As features interact in new ways, subtle ordering bugs can emerge.Proposed Work
Why
This is the file where new features are most likely to introduce regressions. The ordered-pass design is good — but the ordering contract is implicit. Making it explicit and well-tested prevents future "works in isolation, breaks in combination" bugs.
Target Version
v0.10.0 (Hardening)