You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
analyze audit:all fails on every ?? / unwrap_or: a downcast place typed as the enum vs codegen projecting the variant struct #1381
Found during #1363. with analyze repro.w audit:all fails on the smallest carrier eliminator:
fn main:
let o: Option[i32] = Some(3)
print(o ?? 0)
violation: place 6 in main: projection lowers to LLVM type kind 10 but its MIR type 339 (Option[i32]) is kind 10; base _3: Option[i32] (ty 339) proj[0]=kind3:0 got-int-width=-1 want-int-width=-1
compiler-analysis-audit: facts=12175 violations=1 FAILED
Two defects:
The MIR/codegen disagreement. lower_double_question, lower_unwrap_or_method, lower_unwrap_or_else_method and most Option/Result combinators in src/MirLower.w build new_downcast_place(value_place, idx, value_ty), typing the downcast place as the whole enum, while codegen (mir_place_projected_type) lowers PK_DOWNCAST to the variant struct. Match lowering passes sema type 0 (lines ~8646, ~8927), which the audit skips. One rule is needed: what type a downcast place has (the variant payload struct, or none), used by every producer.
The message: "lowers to LLVM type kind 10 but ... is kind 10" compares type identity while printing only kinds, so it reads as a contradiction. Print both LLVM type names.
Because of (1), audit:all cannot be used as a gate on any program using ??/unwrap_or (the #1363 repro fails it for this reason alone, not for its real defect).
reports place 6 in a: projection lowers to LLVM type kind 10 but its MIR type 958 (Result[i32, DbError]) is kind 10 … proj[0]=kind3:1 (and kind3:0). Found on the stage 5 facade fixtures (#1426).
Activity
MIR: a downcast place has no type of its own; audit:codegen names bot…
MIR: a downcast place has no type of its own; audit:codegen names bot…
ehartford commentedon Sep 23, 2026
The same violation shows on every
?over aResult, not only??/unwrap_or. With the seed at 8c859a7,analyze audit:allonreports
place 6 in a: projection lowers to LLVM type kind 10 but its MIR type 958 (Result[i32, DbError]) is kind 10 … proj[0]=kind3:1(andkind3:0). Found on the stage 5 facade fixtures (#1426).MIR: a downcast place has no type of its own; audit:codegen names bot…
MIR: a downcast place has no type of its own; audit:codegen names bot…
validate-ownership rejects vacated payloads and moves through referen…