Files
ww/test/wcc/data/r805_reject_agg_compound/case.ww
Hojun-Cho f191e6e0e2 wcc: modulo is integer-only; compound ops carry their operand class
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.
2026-08-09 00:32:41 +09:00

14 lines
385 B
Plaintext

//ww:error "arithmetic on non-numeric type"
package main;
type capture = struct { content: str, start: size, end: size };
type t = struct { pc: size, cap: capture };
fn addcap(ts: *[]t, i: size, src: capture) void = {
(*ts)[i].cap += src;
};
export fn main() i32 = {
let ts: []t = [];
let a: capture = capture { content = "", start = 0, end = 0 };
addcap(&ts, 0, a);
return 0;
};