Hare's rule (harec check.c binarithm): % and the bitwise/shift five are integer-only; + - * / need numeric operands. ww grouped % with the numeric ops, and compound assigns never op-checked at all, so `a % b` on floats compiled half-lowered (live cs!=ww divergence), `a %= 2.0` plain-stored the rhs (op silently dropped, both stages), and `s += "cd"` garbled str headers. Gate both at the checker, both stages; the cgen float-compound fallbacks and the three unknown- compound legacy defaults (deref/global/local) demote to rule-7 hard stops. 34 compound-on-tagged/str/slice fixtures re-pin from the old cgen "not wired" stops to the earlier checker diagnostics; 3 new reject fixtures pin the closed shapes.
16 lines
660 B
Plaintext
16 lines
660 B
Plaintext
//ww:error "arithmetic on non-numeric type"
|
|
// Lifted from test/wcc/949_idxfield_compound_run.c reject row "fld_he_slice"
|
|
// (#33/rule-7): a compound assign on an indexed-element SLICE field is unwired
|
|
// in both stages and MUST loud-fail. The substring is the shared diagnostic
|
|
// body — byte-identical on both stages, pinned to "slice field" so it cannot
|
|
// also match the float/str/tagged rows (no file:line, no cstage "ww: " prefix
|
|
// — both differ cs vs ww).
|
|
package main;
|
|
type S = struct { f: []u8, g: i32 };
|
|
export fn main() i32 = {
|
|
let b: [2]u8 = [1u8, 2u8];
|
|
let xs: [2]S = [S{f=b[0:2], g=0}, S{f=b[0:2], g=0}];
|
|
xs[0].f += b[0:1];
|
|
return 0;
|
|
};
|