Skip to content

typed_expr_types per-arm recording has no completeness or safety contract (6 gap instances; 1 unsafe insert) #767

Closed

Description

@ehartford

check_expr records result types per-arm with no convention enforcement. SIX arms found missing records this campaign (async block, ?? join, &raw of wrapped place, plain & refs, bitnot — each producing MirLower void-fallback type skew caught by the typed validator), fixed individually EXCEPT bitnot: inserting the bitnot record (07b65c2, reverted in 93c4598) broke EVERY stage1-built program's BUILD path (Vec OOB in codegen even for print-only programs; check unaffected) — some consumer treats presence/absence of the record as semantic. behav_comptime_unsigned_arith remains red on this (evaluator's node_type_or falls back to the operand's i32 for ~0 in a u32 fn; the eval-side mask 604485b is in place and works once the type is visible).

Needed: (a) a stated contract for WHEN an arm must/must-not record; (b) an audit lane (analyze audit: or a WITH_MIR_AUDIT check comparing sema-recorded vs MirLower-derived types across a corpus); (c) root-cause WHICH consumer breaks on the bitnot record before re-landing it.

Activity

  1. ehartford commented on Aug 10, 2026

    @ehartford
    ContributorAuthor

    Resolved ask (c) — the bitnot-record 'consumer breakage' was a misattribution: 07b65c2 bundled the record WITH the get_string(node) diagnostic bug (#660 id-confusion class, fixed in 2a7fb64); the revert blamed the record. Re-landed in ae91424 with a green trivial-build probe, plus the missing piece: fold-order const evaluation runs before body checking, so apply_implicit_default_return now adapts CV_INT values to the declared return type. behav_comptime_unsigned_arith green; full behav_comptime_* sweep green.

    Recording-gap instances found this campaign now number SEVEN (async block, ?? join, &raw, plain refs, bitnot, shift result — e7e9248 — and the fold-order tail). Asks (a) recording contract and (b) audit lane remain open — re-scoping this issue to exactly those.

  2. ehartford commented on Aug 31, 2026

    @ehartford
    ContributorAuthor

    Triage re-scope 2026-08-31: item (c) is done — ae91424 re-landed the bitnot record after 2a7fb64 root-caused the breaker (node-id/string-index confusion), and behav_comptime_unsigned_arith is green. Remaining scope: typed_expr_types per-arm recording still has no stated completeness contract and no audit lane. Needed: (a) a stated contract for when an arm must/must-not record; (b) an audit lane comparing sema-recorded vs MirLower-derived types across a corpus.

  3. added 2 commits that reference this issue on Sep 4, 2026
  4. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): still open. The bitnot item (c) landed (ae91424); there is still no stated completeness contract for typed_expr_types per arm, and no audit checks it (src/Analysis.w's audit:* list has none).

    post-release: Sema hardening (mir-sema-hardening.md).

  5. added this to the post-v0.16.0 milestone on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions