mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-21 13:55:19 +00:00
Improve error message when trying to pass a parapoly type to value parameter
This commit is contained in:
@@ -1621,11 +1621,18 @@ gb_internal Type *determine_type_from_polymorphic(CheckerContext *ctx, Type *pol
|
||||
bool show_error = modify_type && !ctx->hide_polymorphic_errors;
|
||||
if (!is_operand_value(operand)) {
|
||||
if (show_error) {
|
||||
ERROR_BLOCK();
|
||||
|
||||
gbString pts = type_to_string(poly_type);
|
||||
gbString ots = type_to_string(operand.type, true);
|
||||
defer (gb_string_free(pts));
|
||||
defer (gb_string_free(ots));
|
||||
error(operand.expr, "Cannot determine polymorphic type from parameter: '%s' to '%s'", ots, pts);
|
||||
|
||||
if (operand.mode == Addressing_Type) {
|
||||
error_line("\tSuggestion: Are you trying to pass a type to a value parameter?\n");
|
||||
}
|
||||
|
||||
}
|
||||
return t_invalid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user