mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Improve error message on undefined operators
This commit is contained in:
+4
-5
@@ -2455,12 +2455,11 @@ gb_internal void check_comparison(CheckerContext *c, Ast *node, Operand *x, Oper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!defined) {
|
if (!defined) {
|
||||||
if (x->type == err_type && is_operand_nil(*x)) {
|
gbString xs = type_to_string(x->type, temporary_allocator());
|
||||||
err_type = y->type;
|
gbString ys = type_to_string(y->type, temporary_allocator());
|
||||||
}
|
|
||||||
gbString type_string = type_to_string(err_type, temporary_allocator());
|
|
||||||
err_str = gb_string_make(temporary_allocator(),
|
err_str = gb_string_make(temporary_allocator(),
|
||||||
gb_bprintf("operator '%.*s' not defined for type '%s'", LIT(token_strings[op]), type_string));
|
gb_bprintf("operator '%.*s' not defined between the types '%s' and '%s'", LIT(token_strings[op]), xs, ys)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
Type *comparison_type = x->type;
|
Type *comparison_type = x->type;
|
||||||
if (x->type == err_type && is_operand_nil(*x)) {
|
if (x->type == err_type && is_operand_nil(*x)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user