Use this after making fixes. Only check an item when the Problematic state is gone and the Should look like condition is true.
-
expectfailure path in dev codegen must be non-returning. Problematic state:expectfailure callsroc_crashedbut can continue if that callback returns (src/backend/dev/LirCodeGen.zigaround lines 10020/10024; callback isvoidinsrc/builtins/host_abi.zigaround line 83). Should look like: Anyexpectfailure path is guaranteed to stop control flow immediately (e.g. explicit trap/unreachable after callback, or ABI-level non-returning contract enforced end-to-end). How to verify: InLirCodeGen.zig, there is no reachable continuation path after emitting/calling the crash routine. -
Runtime-error path in
generateLookupCallmust not return dummy values. Problematic state: On error, code emits crash call and then returns placeholderi64(src/backend/dev/LirCodeGen.zigaround lines 12980-12983). Should look like: Runtime-error path is terminal and never fabricates a value to keep execution going. How to verify:generateLookupCallhas no "crash + fallback return value" branch. -
Unresolved-symbol codegen path must not rely on raw
unreachableas recovery. Problematic state: Unresolved symbol path usesunreachable(src/backend/dev/LirCodeGen.zigaround line 5001). Should look like: Either the invariant is proven before codegen entry, or there is an explicit debug-only assertion at the invariant boundary with no late-stage recovery branch. How to verify: Unresolved-symbol handling is removed from deep codegen path or replaced by a clear invariant assertion point. -
Unimplemented low-level ops must not runtime-panic in the backend. Problematic state: Several low-level ops hit panic paths at codegen time (
src/backend/dev/LirCodeGen.zigaround lines 3692-3705). Should look like: Unsupported ops are rejected earlier by invariant checks, and backend codegen no longer contains runtime panic fallback for these ops. How to verify: No "TODO/unimplemented panic" branch remains for those low-level op cases. -
Discriminant switch generation TODO fallback must be eliminated. Problematic state: Codegen still has a TODO fallback
if/elsechain for discriminants (src/backend/dev/LirCodeGen.zigaround lines 10401-10403). Should look like: Deterministic, complete discriminant-switch lowering with no temporary fallback logic. How to verify: TODO fallback branch is gone and replaced by final switch strategy. -
Procedure lookup must not silently degrade to O(N) scan. Problematic state: Call path falls back to linear scan over procedures (
src/backend/dev/LirCodeGen.zigaround lines 13010-13020). Should look like: Call resolution is deterministic via direct index/map, and missing entries fail fast via invariant assertion (no silent slow-path recovery). How to verify: No O(N) scan fallback remains in normal call emission path. -
str_inspectnaming must not degrade to"?"placeholders. Problematic state: Multiple MIR->LIR locations hardcode unknown names as"?"(src/lir/MirToLir.zigaround lines 2013, 2077, 2250, 2296-2297, 2314). Should look like: Either stable identifier-free formatting is used by design, or real names are propagated from allowed data sources; no placeholder fallback strings. How to verify: No production path hardcodes"?"for inspect-name recovery. -
lookup_requiredresolution must not be string-name heuristics plus runtime error type fallback. Problematic state:lookup_requiredlogic matches names by text and falls back toruntime_err_type(src/mir/Lower.zigaround lines 642, 652, 661). Should look like: Resolution uses explicit typed identity, and unresolved cases fail via invariant checks instead of type-level recovery placeholders. How to verify: No text-based matching +runtime_err_typerecovery remains in this path. -
Method dispatch misses in MIR must not fabricate
runtime_err_type. Problematic state: Dispatch miss cases fall back toruntime_err_type(src/mir/Lower.zigaround lines 1752, 1973). Should look like: Dispatch table must be complete for reachable calls; misses trigger invariant failure at construction time. How to verify: Miss branches no longer return/propagateruntime_err_type. -
Pending/external lookup error paths must not end in generic
unreachable. Problematic state:e_lookup_pendingand unresolved external import paths currently useunreachable(src/mir/Lower.zigaround lines 580-581, 632-636). Should look like: These are prevented or explicitly diagnosed at an earlier invariant boundary with loud debug assertions. How to verify: No rawunreachableremains for user-reachable unresolved lookup states. -
Typed fraction fallback must not default silently to
Dec. Problematic state: One typed-frac path falls back toDec(src/mir/Lower.zigaround lines 341-347). Should look like: Fraction type is derived from real constraints or rejected by invariant assertion; no silent default type substitution. How to verify: No "if unknown then Dec" fallback behavior remains. -
Nominal compatibility must not default
truefor non-builtin nominals. Problematic state: Compatibility check returns unconditionaltrueoutside builtin cases (src/mir/Lower.zigaround lines 2368-2377). Should look like: Compatibility is computed from explicit nominal identity/rules; unknown cases fail invariant checks instead of permissive success. How to verify: No unconditional success branch for non-builtin nominal compatibility. -
Def lookup by symbol must not match only
ident.idx. Problematic state:findDefExprBySymboleffectively matches only identifier index and ignores attributes (src/mir/Lower.zigaround lines 2137-2139). Should look like: Symbol identity comparison is complete and collision-safe for all fields that define uniqueness. How to verify: Lookup key includes full symbol identity, not a partial projection. -
Missing symbol metadata must not depend on debug panic + release
unreachable. Problematic state: Lowering path can panic in debug and hitunreachablein release when symbol metadata is missing (src/mir/Lower.zigaround lines 284-291). Should look like: Missing metadata is impossible by construction at this stage, with checks concentrated at data-construction boundaries. How to verify: No deep lowering path has to recover from or branch on absent symbol metadata. -
Type-var seeding must not silently ignore OOM/error (
catch {}/catch return). Problematic state: OOM/error is dropped in several type-var seeding paths (src/mir/Lower.zigaround lines 1777, 2333, 2345). Should look like: Allocation failures are propagated or explicitly surfaced; invariants are not silently weakened on allocation error. How to verify: No emptycatchor silent early-return remains in these seeding paths. -
Monotype flex/rigid fallback defaults must be removed. Problematic state: Flex/rigid type handling can default to
unit/dec(src/mir/Monotype.zigaround lines 347-356). Should look like: Flex/rigid are resolved by constraints or rejected; no fallback concrete-type substitution. How to verify: No branch maps unresolved flex/rigid directly to default concrete monotypes. -
Tag-union row-extension walk must not truncate on alias/flex/rigid/error fallback nodes. Problematic state: Row-extension traversal stops on alias/flex/rigid/err-like states (
src/mir/Monotype.zigaround lines 537-549). Should look like: Traversal either fully resolves row tails or reports invariant violation; no partial truncation fallback. How to verify: Traversal no longer treats unresolved tails as successful termination. -
NominalHintmetadata must not leak module identity into monotype-era logic. Problematic state:NominalHintstores module-indexed identity (src/mir/Monotype.zigaround lines 184-187, 194, 680-683) and is consumed in Lower (src/mir/Lower.zigaround lines 2087-2092). Should look like: MIR/monotype nominal identity is module-agnostic (or opaque symbol-based) post-lowering; module provenance does not survive as a required runtime key. How to verify: No MIR/monotype API requires module index to interpret nominal identity. -
LIR symbol-def registration must not permit overwrite in release. Problematic state: LIR store has debug-only duplicate assert but can overwrite in release (
src/lir/LirExprStore.zigaround lines 389-391). Should look like: Duplicate registrations are structurally impossible or hard-failed before insert; release behavior cannot silently replace existing entries. How to verify: Insert path enforces uniqueness in all build modes. -
MIR symbol-def registration must not unconditionally overwrite prior mapping. Problematic state: MIR registration overwrites existing mapping without guard (
src/mir/MIR.zigaround lines 709-711). Should look like: Duplicate symbol definitions are rejected as invariant violations, not "last write wins." How to verify: Registration logic checks and rejects duplicates deterministically.