Skip to content

Codegen returns undef on an invalid MIR id and says so only under WITH_DEBUG_FALLBACK #2199

Closed

Description

@ehartford

AGENTS.md "No Silent Fallbacks": when code cannot be generated correctly, the only acceptable behavior is a loud diagnostic and a non-zero exit.

src/CodegenDispatch.w:

  • mir_const_value: invalid const_id → return wl_get_undef(fallback_ty)
  • mir_eval_operand: invalid operand_id → return wl_get_undef(fallback_ty)
  • mir_eval_rvalue: invalid rval_id → return wl_get_undef(fallback_ty)

Each warns (warning: [fallback] ...) only when WITH_DEBUG_FALLBACK is set; without it the program compiles with an undef where a value was. Same shape in src/Codegen.w (the noalias attribute walk on a non-function value is a "loud skip" that prints only under WITH_MIR_AUDIT).

Expected: an internal compiler error naming the body and the id, had_error = 1, always. A debug switch may add detail, never decide whether the failure is reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions