Merge branch 'master' into bill/fixed-capacity-dynamic-array

This commit is contained in:
gingerBill
2026-03-15 11:41:01 +00:00
85 changed files with 1762 additions and 1008 deletions

View File

@@ -2971,14 +2971,21 @@ gb_internal void check_comparison(CheckerContext *c, Ast *node, Operand *x, Oper
if (check_is_assignable_to(c, x, y->type) ||
check_is_assignable_to(c, y, x->type)) {
if (x->type->failure || y->type->failure) {
// // skip any failures
x->mode = Addressing_Value;
x->type = t_untyped_bool;
return;
}
Type *err_type = x->type;
bool defined = false;
switch (op) {
case Token_CmpEq:
case Token_NotEq:
defined = (is_type_comparable(x->type) && is_type_comparable(y->type)) ||
(is_operand_nil(*x) && type_has_nil(y->type)) ||
(is_operand_nil(*y) && type_has_nil(x->type));
defined = ((is_operand_nil(*x) && type_has_nil(y->type)) ||
(is_operand_nil(*y) && type_has_nil(x->type)) ||
is_type_comparable(x->type) && is_type_comparable(y->type));
break;
case Token_Lt:
case Token_Gt:
@@ -4476,9 +4483,9 @@ gb_internal void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, Typ
truncated: r = a - b*trunc(a/b)
floored: r = a - b*floor(a/b)
IFF a/0 == 0, then (a%0 == a) or (a%%0 == a)
IFF a/0 == a, then (a%0 == 0) or (a%%0 == 0)
IFF a/0 == 0b111..., then (a%0 == a) or (a%%0 == a)
If and only if (⟺) a/0 == 0, then (a%0 == a) or (a%%0 == a)
If and only if (⟺) a/0 == a, then (a%0 == 0) or (a%%0 == 0)
If and only if (⟺) a/0 == 0b111..., then (a%0 == a) or (a%%0 == a)
*/
switch (zero_behaviour) {