mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix comparisons with union
This commit is contained in:
+2
-2
@@ -1531,7 +1531,7 @@ void check_comparison(CheckerContext *c, Operand *x, Operand *y, TokenKind op) {
|
|||||||
switch (op) {
|
switch (op) {
|
||||||
case Token_CmpEq:
|
case Token_CmpEq:
|
||||||
case Token_NotEq:
|
case Token_NotEq:
|
||||||
defined = is_type_comparable(x->type) ||
|
defined = (is_type_comparable(x->type) && is_type_comparable(y->type)) ||
|
||||||
(is_operand_nil(*x) && type_has_nil(y->type)) ||
|
(is_operand_nil(*x) && type_has_nil(y->type)) ||
|
||||||
(is_operand_nil(*y) && type_has_nil(x->type));
|
(is_operand_nil(*y) && type_has_nil(x->type));
|
||||||
break;
|
break;
|
||||||
@@ -1539,7 +1539,7 @@ void check_comparison(CheckerContext *c, Operand *x, Operand *y, TokenKind op) {
|
|||||||
case Token_Gt:
|
case Token_Gt:
|
||||||
case Token_LtEq:
|
case Token_LtEq:
|
||||||
case Token_GtEq:
|
case Token_GtEq:
|
||||||
defined = is_type_ordered(x->type);
|
defined = is_type_ordered(x->type) && is_type_ordered(y->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user