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.
This commit is contained in:
12
test/wcc/data/float_modeq_reject/case.ww
Normal file
12
test/wcc/data/float_modeq_reject/case.ww
Normal file
@@ -0,0 +1,12 @@
|
||||
//ww:error "modulo on non-integer type"
|
||||
// Compound ops carry their binary op's operand class: %= on a float
|
||||
// lvalue plain-stored the rhs pre-gate (`a %= 2.0` became `a = 2.0`,
|
||||
// silently, both stages).
|
||||
package main;
|
||||
let g: f64 = 9.0;
|
||||
export fn main() i32 = {
|
||||
let a: f64 = 7.0;
|
||||
a %= 2.0;
|
||||
g %= 2.0;
|
||||
return 0;
|
||||
};
|
||||
Reference in New Issue
Block a user