aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorWes Hardee <weshardee@gmail.com>2022-07-09 18:09:21 -0500
committerGitHub <noreply@github.com>2022-07-09 18:09:21 -0500
commit00739bf06dc73a88a320baec01a3844fbf9f59a9 (patch)
tree157cca02510cd90f6c092ae99c50056342bc7532 /src/check_stmt.cpp
parent23842a8950be99afca4f4180aca95a7c2da771dc (diff)
parente8148055ad78489832c55aab9b81edd694440d63 (diff)
Merge branch 'odin-lang:master' into master
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index f061b4961..a6f6f1a7d 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -2142,7 +2142,26 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
}
if (new_name_count == 0) {
- error(node, "No new declarations on the lhs");
+ begin_error_block();
+ error(node, "No new declarations on the left hand side");
+ bool all_underscore = true;
+ for_array(i, vd->names) {
+ Ast *name = vd->names[i];
+ if (name->kind == Ast_Ident) {
+ if (!is_blank_ident(name)) {
+ all_underscore = false;
+ break;
+ }
+ } else {
+ all_underscore = false;
+ break;
+ }
+ }
+ if (all_underscore) {
+ error_line("\tSuggestion: Try changing the declaration (:=) to an assignment (=)\n");
+ }
+
+ end_error_block();
}
Type *init_type = nullptr;