aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-10-27 19:42:21 +0000
committergingerBill <bill@gingerbill.org>2019-10-27 19:42:21 +0000
commit416ff149bd0f3ae1ff7d8093450cf42fc4aa3994 (patch)
treeae125b40cd3d7375aafdd714abd39713060cb8ab /src/check_type.cpp
parent233c6e2d3ac28c930483ebebcb6251a8eca997cc (diff)
Fix procedure group "best fit" algorithm for polymorphic procedures
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index da6419877..de33cc1a5 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1263,20 +1263,21 @@ bool check_type_specialization_to(CheckerContext *ctx, Type *specialization, Typ
Type *determine_type_from_polymorphic(CheckerContext *ctx, Type *poly_type, Operand operand) {
bool modify_type = !ctx->no_polymorphic_errors;
+ bool show_error = modify_type && !ctx->hide_polymorphic_errors;
if (!is_operand_value(operand)) {
- if (modify_type) {
+ if (show_error) {
error(operand.expr, "Cannot determine polymorphic type from parameter");
}
return t_invalid;
}
if (is_polymorphic_type_assignable(ctx, poly_type, operand.type, false, modify_type)) {
- if (modify_type) {
+ if (show_error) {
set_procedure_abi_types(ctx, poly_type);
}
return poly_type;
}
- if (modify_type) {
+ if (show_error) {
gbString pts = type_to_string(poly_type);
gbString ots = type_to_string(operand.type);
defer (gb_string_free(pts));