diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-27 10:58:54 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-10-27 10:58:54 +0000 |
| commit | 43529dda3806616e4ba0da3aa3079a9d56445df6 (patch) | |
| tree | 57a93fea0ded7556e9a89f28c75935cc5c8400fa /src/check_type.cpp | |
| parent | 81375e52ce89af8ce95ec933312ad3b2cb30311b (diff) | |
Improve error message for missing `&` in some parapoly messages
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 0819de217..f1a2e9e22 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1611,6 +1611,12 @@ gb_internal Type *determine_type_from_polymorphic(CheckerContext *ctx, Type *pol error_line("\tSuggestion: Try slicing the value with '%s[:]'\n", os); gb_string_free(os); } + } else if (is_type_pointer(poly_type)) { + if (is_polymorphic_type_assignable(ctx, type_deref(poly_type), operand.type, /*compound*/false, /*modify_type*/false)) { + gbString os = expr_to_string(operand.expr); + error_line("\tSuggestion: Did you mean '&%s'?\n", os); + gb_string_free(os); + } } } return t_invalid; |