diff options
| author | gingerBill <bill@gingerbill.org> | 2024-03-23 16:53:40 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-03-23 16:53:40 +0000 |
| commit | eb51cc6835a202d0a5fde297d87277041fc433e7 (patch) | |
| tree | 64a2154cc00703e8ba97a70c85311fdfafe68d8b /src/check_expr.cpp | |
| parent | 1d46adb598328b4977d5b4cfad2a1dc679b05a21 (diff) | |
Improve error propagation for `(*x).y` style errors from C-programmers
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index f09c8fe3c..ab8fe78fc 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1807,9 +1807,11 @@ gb_internal bool check_unary_op(CheckerContext *c, Operand *o, Token op) { if (is_type_pointer(o->type)) { str = expr_to_string(o->expr); error_line("\tSuggestion: Did you mean '%s^'?\n", str); + o->type = type_deref(o->type); } else if (is_type_multi_pointer(o->type)) { str = expr_to_string(o->expr); error_line("\tSuggestion: The value is a multi-pointer, did you mean '%s[0]'?\n", str); + o->type = type_deref(o->type, true); } } break; |