fix: diagnose unknown generic #builtin instead of silently returning 0 (issue 0144)

A bodiless #builtin with a $T: Type param routes through monomorphization.
When resolveBuiltin returned null for an unrecognized name, the builtin-body
branch fell through to ensureTerminator's constInt(0) -- a silent-fallback
default the CLAUDE.md REJECTED PATTERNS forbid. Emit a loud
'error: unknown #builtin <name>' diagnostic instead.

Regression: examples/1189-diagnostics-unknown-builtin.sx
This commit is contained in:
agra
2026-06-21 09:10:38 +03:00
parent 6ed29621ad
commit ad45ae07ef
6 changed files with 41 additions and 0 deletions

View File

@@ -1,5 +1,13 @@
# 0144 — unrecognized `$T`-param `#builtin` silently returns 0
> **RESOLVED.** The generic monomorphization path (`monomorphizeFunction`'s
> `builtin_expr` body branch in `src/ir/lower/generic.zig`) no longer falls
> through to `ensureTerminator`'s silent `constInt(0)` when `resolveBuiltin`
> returns null for an unknown name. It now emits a loud
> `error: unknown #builtin '<name>'` diagnostic — removing exactly the
> silent-fallback-default the CLAUDE.md REJECTED PATTERNS forbid. Regression
> test: `examples/1189-diagnostics-unknown-builtin.sx`.
## Symptom
A **bodiless `#builtin`** whose signature takes a `$T: Type` parameter, when the