Fix procedure group compiler assert with no matching arguments #393

This commit is contained in:
gingerBill
2019-06-21 22:55:00 +01:00
parent aaa24894b6
commit 8b8cada33e
+5 -10
View File
@@ -5170,19 +5170,13 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
if (valid_count == 0) { if (valid_count == 0) {
bool all_invalid_type = true;
for_array(i, operands) {
Operand o = operands[i];
if (o.type != t_invalid) {
all_invalid_type = false;
break;
}
}
if (!all_invalid_type) {
begin_error_block(); begin_error_block();
defer (end_error_block()); defer (end_error_block());
error(operand->expr, "No procedures or ambiguous call for procedure group '%s' that match with the given arguments", expr_name); error(operand->expr, "No procedures or ambiguous call for procedure group '%s' that match with the given arguments", expr_name);
if (operands.count == 0) {
error_line("\tNo given arguments\n");
} else {
error_line("\tGiven argument types: ("); error_line("\tGiven argument types: (");
for_array(i, operands) { for_array(i, operands) {
Operand o = operands[i]; Operand o = operands[i];
@@ -5192,6 +5186,7 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
error_line("%s", type); error_line("%s", type);
} }
error_line(")\n"); error_line(")\n");
}
if (procs.count > 0) { if (procs.count > 0) {
error_line("Did you mean to use one of the following:\n"); error_line("Did you mean to use one of the following:\n");
@@ -5227,7 +5222,7 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
if (procs.count > 0) { if (procs.count > 0) {
error_line("\n"); error_line("\n");
} }
}
result_type = t_invalid; result_type = t_invalid;
} else if (valid_count > 1) { } else if (valid_count > 1) {
begin_error_block(); begin_error_block();