aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-03-24 13:40:10 +0000
committergingerBill <bill@gingerbill.org>2024-03-24 13:40:10 +0000
commit6da6393735dd18d68b1f4662a157f6044f87b470 (patch)
treef5b26b4b7e145d60ba8b6067f32f4cd1d34e67d7 /src/check_expr.cpp
parent87688936c6756c3709a04818b442d10e06628854 (diff)
Fix #3320
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index ecc8a804c..bd2c576cf 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -1174,6 +1174,16 @@ gb_internal void check_assignment(CheckerContext *c, Operand *operand, Type *typ
type_str, type_extra,
LIT(context_name));
check_assignment_error_suggestion(c, operand, type);
+
+ if (context_name == "procedure argument") {
+ Type *src = base_type(operand->type);
+ Type *dst = base_type(type);
+ if (is_type_slice(src) && are_types_identical(src->Slice.elem, dst)) {
+ gbString a = expr_to_string(operand->expr);
+ error_line("\tSuggestion: Did you mean to pass the slice into the variadic parameter with ..%s?\n\n", a);
+ gb_string_free(a);
+ }
+ }
}
break;
}
@@ -5905,16 +5915,7 @@ gb_internal CallArgumentError check_call_arguments_internal(CheckerContext *c, A
s = assign_score_function(MAXIMUM_TYPE_DISTANCE);
} else {
if (show_error) {
- ERROR_BLOCK();
check_assignment(c, o, param_type, str_lit("procedure argument"));
-
- Type *src = base_type(o->type);
- Type *dst = base_type(param_type);
- if (is_type_slice(src) && are_types_identical(src->Slice.elem, dst)) {
- gbString a = expr_to_string(o->expr);
- error_line("\tSuggestion: Did you mean to pass the slice into the variadic parameter with ..%s?\n\n", a);
- gb_string_free(a);
- }
}
err = CallArgumentError_WrongTypes;
}