ADR 0004: Lyth checker first, `go/types` validation second
Status: Accepted
Context
Section titled “Context”Diagnostics must be in Lyth terms at Lyth spans, but a young checker will miss
cases, and silently passing invalid Go to go build would produce confusing
errors.
Decision
Section titled “Decision”- The Lyth checker is the primary source of diagnostics.
- After emission, each generated package is type-checked in-process with
go/types, reusing the loaded dependency types. Errors are mapped through the exact source map and reported as E0902, with the original Go message kept. - Only then is
go buildinvoked. Its errors (rare by then) are mapped through//line(E0903/E0904).
Alternatives
Section titled “Alternatives”- Rely on
go buildonly: text parsing, line-level positions, slow feedback. - Trust the Lyth checker fully: unsafe while it matures.
Consequences
Section titled “Consequences”A safety net that turns checker gaps into located diagnostics. It costs a second, fast type check per package and keeps the checker honest in tests, because every golden program must pass validation.