Skip to content

audit:all is red on the compiler's own source: 35 resolution violations and 5 frozen-phase re-entries #3423

Closed

Description

@ehartford

with analyze src/main.w audit:all on main reports violations in the compiler itself. No gate runs it (it takes about four minutes), so they accumulated. audit:mir was made clean in #3422 and the shift-count class (36 false violations) is fixed in the PR that references this issue. What is left, measured with a dev build (corpora from source):

Resolution: an expression lowered to an operand of another type (35)

MIR Sema node count example
&i32 i32 field access 24 src/MirLower.w:2884: if success: self.sema.syms.some else: self.sema.syms.none
&i64 i64 field access 4 src/Codegen.w:7684: if some: self.option_some_tag else: self.option_none_tag
i32 i64 unary 4 Memo.get instances, reported at src/main.w:78:75 (a wrong location too)
&str str field access 2 src/CodegenDispatch.w:18208: a tail self.current_decl_source_file
ListIter[str] List[str] call 1 src/compiler/Compilation.w:1610: `embedded_bundle_prefixes()

The &T rows are one shape: a field read through self in a value-position arm or tail yields a view that is materialized at the join; the lowering records the view against the node and Sema recorded no adjustment for it (D22 contextual copy). Either Sema records the adjustment, or the lowering records after it materializes; the audit must not learn to accept &T for T in general.

Frozen phase: mutable Sema re-entry (5)

  • Codegen.sig_abi_param_flags -> Sema.sig_is_drop_body
  • Codegen.sema_type_level_arg -> Sema.type_level_arg_in_body
  • CCodegen.emit_builtin_generic_call_term -> Sema.type_level_arg_in_body
  • CCodegen.collect_used_struct_types -> Sema.type_level_arg_in_body
  • CCodegen.drop_runs_user_code -> Sema.type_carries_user_drop

Done when audit:all reports zero on src/main.w and a gate keeps it there (a battery check, given the run time).

Activity

  1. ehartford commented on Nov 18, 2026

    @ehartford
    ContributorAuthor

    #3424 and #3425 merged: the shift-count class (36) and the copy-out join arm class (30) were both bookkeeping, fixed where the lowering records an expression's operand; the audit rule is unchanged. audit:all on src/main.w is at 10.

    What is left:

    • 4, Memo.get instances (lib/std/memo.w, Some(*v); reported at src/main.w:78:75, which is also a wrong location): the generic method's *v node carries the type of another instantiation when this one is lowered (MIR i32, Sema i64). typed_expr_types is per node, not per instance; this is the weakness typed_expr_types per-arm recording has no completeness or safety contract (6 gap instances; 1 unsafe insert) #767 describes.
    • 1, a pipeline (src/compiler/Compilation.w:1610, embedded_bundle_prefixes() |> any(…)): MIR ListIter[str], Sema List[str]; the into-iterator conversion is not a recorded adjustment.
    • 5 frozen-phase re-entries: codegen calls Sema.sig_is_drop_body, Sema.type_level_arg_in_body (three callers) and Sema.type_carries_user_drop, which are declared mut fn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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