mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Give error message suggestion when doing ^x instead of x^ if x is an r-value
This commit is contained in:
@@ -3337,6 +3337,10 @@ gb_internal bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, T
|
|||||||
gbString s = expr_to_string(pt->type);
|
gbString s = expr_to_string(pt->type);
|
||||||
error(e, "^ is used for pointer types, did you mean '&%s'?", s);
|
error(e, "^ is used for pointer types, did you mean '&%s'?", s);
|
||||||
gb_string_free(s);
|
gb_string_free(s);
|
||||||
|
} else if (is_type_pointer(o.type)) {
|
||||||
|
gbString s = expr_to_string(pt->type);
|
||||||
|
error(e, "^ is used for pointer types, did you mean a dereference: '%s^'?", s);
|
||||||
|
gb_string_free(s);
|
||||||
} else {
|
} else {
|
||||||
// NOTE(bill): call check_type_expr again to get a consistent error message
|
// NOTE(bill): call check_type_expr again to get a consistent error message
|
||||||
elem = check_type_expr(&c, pt->type, nullptr);
|
elem = check_type_expr(&c, pt->type, nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user