Browse Source

Add suggestion for `x: ^T; y = x` to be `x^`

gingerBill 1 year ago
parent
commit
ba77a9464c
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/check_expr.cpp

+ 5 - 0
src/check_expr.cpp

@@ -2254,6 +2254,11 @@ gb_internal void check_assignment_error_suggestion(CheckerContext *c, Operand *o
 		gbString s = expr_to_string(o->expr);
 		error_line("\tSuggestion: Did you mean `&%s`\n", s);
 		gb_string_free(s);
+	} else if (is_type_pointer(o->type) &&
+	           are_types_identical(type_deref(o->type), type)) {
+		gbString s = expr_to_string(o->expr);
+		error_line("\tSuggestion: Did you mean `%s^`\n", s);
+		gb_string_free(s);
 	}
 }