Summary
Direct backend lowering diagnostics reported a generic
direct backend local type is unsupported message regardless of the
actual target, even though the expected and help fields already
named the target correctly. The fix substitutes the generic
direct backend prefix with a target-specific label
(COFF x64, ELF64, AArch64 Mach-O, x86_64 Mach-O, COFF AArch64,
AArch64 ELF) when the IR lowering message is wrapped into a
buildability diagnostic.
The bug was originally surfaced as part of the agent-surface
repros in #68, where the message stayed target-blind in spite of
the target-correct expected and help strings. The agent-surface
classification for the owned-drop-direct-backend-unsupported
fixture already called out "keep backend diagnostics target-correct"
as a follow-up.
Changes
- Add
z_direct_backend_target_labelhelper intarget_backend.c. - Use it in
init_lowering_backend_diag(the message-rewrite site hit by thetargetReadinessJSON for lowering blockers) and inz_build_diag(thez_direct_buildability_checkfunnel). - Leave messages that do not start with the
direct backendprefix untouched so callers that already pass a target-aware message are unaffected. - Bump the file-line budgets in
scripts/compiler-metrics.mtsto cover the new helper and the rewritten branch. - Add regression assertions in
conformance/run.mjscoveringlinux-musl-x64,win32-x64.exe, anddarwin-x64against the existingowned-drop-direct-backend-unsupported.0fixture, so a future regression to the generic prefix fails conformance.
Verification
./.zero/bin/zero check --json --emit obj --target <tgt> conformance/agent-surface/fixtures/owned-drop-direct-backend-unsupported.0forlinux-musl-x64,linux-x64,linux-musl-arm64,win32-x64.exe,darwin-x64,darwin-arm64now reportsdirect ELF64 local type is unsupported,direct ELF64 local type is unsupported,direct AArch64 ELF local type is unsupported,direct COFF x64 local type is unsupported,direct x86_64 Mach-O local type is unsupported, anddirect AArch64 Mach-O local type is unsupportedrespectively.node --experimental-strip-types --disable-warning=ExperimentalWarning scripts/compiler-metrics.mtsreports zero budget violations.ZERO_NATIVE_TEST_ALLOW_LOCAL=1 node conformance/run.mjsreportsconformance ok, including the new target-aware message assertions.
Out of scope
The same generic prefix is also used in emit_*.c files
(emit_elf64.c, emit_coff.c, emit_macho64.c, ...) that
report CGEN004 from the emit layer. Those code paths are only
hit if buildability passes and emission later fails, which is a
different surface than the agent-surface fixture. They are not
covered here to keep the change scoped to the buildability path
that the user-visible diagnostic flows through today.
@TumCucTom is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.