Skip to content

Codegen silent fallbacks: when a default trait method, closure or global-initializer body can't place its terminator, the emitter returns a constant 0 #2006

Closed

Description

@ehartford

Found fixing stack #1992 (wave-sema 8aac1e66). CodegenTraits.generate_default_trait_method_for_impl, and the closure and global-initializer emitters, return a constant 0 when they cannot emit the body's terminator. CLAUDE.md 'No Silent Fallbacks': emitting a placeholder value when translation fails is forbidden — it must be a loud BUG with the function's name and source location and a non-zero exit. Find all three sites (and any sibling that returns const 0 / undef on failure — rg -n 'wl_const_int\(.*0, 0\)' src/Codegen*.w near a 'no terminator' path), make each a sema/codegen phase bug naming the function, and add an internals/phase test that reaches each failure path (or, if it is unreachable, a comment with the proof and a BUG that fires if it ever is).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions