The arithmetic-only check from the previous commit shared a hole with the comparison and bitwise/shift ops: lowerBinaryOp derives the result type from the LHS, so `s64 < string` fed mismatched types to `icmp` (LLVM verifier failure) and `s64 & string` reinterpreted the string's bytes. Add isOrderingOperand (numeric / enum / pointer / bool / vector) and isBitwiseOperand (integer / enum / bool / vector), and route `< <= > >=` and `& | ^ << >>` through them alongside the existing arithmetic check, all sharing one diagnostic + placeholder-sentinel path. Flags-enum bitwise (`.read | .write`, `perm & .read`), enum/pointer comparison, and int literals stay legal (50-smoke unaffected). Equality `== / !=` is deliberately left unchecked — its path is heavily special-cased (str_eq, Any unbox, optional == null); folding a check in without regressing those is a separate change, noted in the issue. Regression test renamed arith→binop and broadened to cover `+ * < & <<` against a string operand: examples/214-binop-operand-type-check.sx.
2 lines
2 B
Plaintext
2 lines
2 B
Plaintext
1
|