aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-05-22 22:22:41 +0100
committergingerBill <bill@gingerbill.org>2024-05-22 22:22:41 +0100
commit7dc1f114b96b9e25dfc2537ab153fe655e65affc (patch)
treea0fc28cb79408e62be85423589282a8b902ea5e8 /src
parentf3f08c264f2baa958551030a9f4af509010bf0a4 (diff)
Add shadow suggestion
Diffstat (limited to 'src')
-rw-r--r--src/check_stmt.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 2083dbf11..866cdb5a1 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -565,7 +565,11 @@ gb_internal Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, O
} else {
error(lhs->expr, "Cannot assign to '%s' which is a procedure parameter", str);
}
- error_line("\tSuggestion: Did you mean to pass '%.*s' by pointer?\n", LIT(e->token.string));
+ if (is_type_pointer(e->type)) {
+ error_line("\tSuggestion: Did you mean to shadow it? '%.*s := %.*s'?\n", LIT(e->token.string), LIT(e->token.string));
+ } else {
+ error_line("\tSuggestion: Did you mean to pass '%.*s' by pointer?\n", LIT(e->token.string));
+ }
show_error_on_line(e->token.pos, token_pos_end(e->token));
} else {
ERROR_BLOCK();