check: type the N_BIN operand of as in the wwstage
An enum OR-fold under `as` ((m.A|m.B) as u32) was never typed: scruttype resolves IDENT/DOT only, and the post-order restamp then re-derived the folded member literals as untyped_int. The unstamped operand missed cgtypeassert's #27b enum-reinterpret gate and lowered as a phantom tagged assert — unconditional exit 1 at runtime on the wwstage leg. checkisas now types an N_BIN lhs and the N_BIN restamp preserves an existing enum stamp. Graduates the #59.9 stattest pin.
This commit is contained in:
16
test/wcc/data/r599_enum_orfold_as/case.ww
Normal file
16
test/wcc/data/r599_enum_orfold_as/case.ww
Normal file
@@ -0,0 +1,16 @@
|
||||
//ww:run
|
||||
// #59.9: an enum member OR-fold under `as`. The pre-fix wwstage
|
||||
// checker never typed the N_BIN operand, so cgtypeassert's enum
|
||||
// reinterpret gate missed and lowered a phantom tagged assert that
|
||||
// unconditionally exited 1.
|
||||
package main;
|
||||
|
||||
type mask = enum u32 { A = 1, B = 2, C = 4 };
|
||||
|
||||
fn main() i32 = {
|
||||
let w: u32 = (mask.A | mask.B | mask.C) as u32;
|
||||
if (w != 7u32) { return 1; };
|
||||
let v: u32 = (mask.A | mask.C) as u32;
|
||||
if (v != 5u32) { return 2; };
|
||||
return 0;
|
||||
};
|
||||
Reference in New Issue
Block a user