Improve type inferencing of literals when calling proc groups

This commit is contained in:
Tohei Ichikawa
2025-09-15 20:40:20 -04:00
parent 935d9657a3
commit 403ca2fb2e
2 changed files with 148 additions and 0 deletions

View File

@@ -6977,6 +6977,10 @@ gb_internal CallArgumentData check_call_arguments_proc_group(CheckerContext *c,
array_unordered_remove(&procs, proc_index);
continue;
}
if (!pt->Proc.variadic && max_arg_count != ISIZE_MAX && param_count < max_arg_count) {
array_unordered_remove(&procs, proc_index);
continue;
}
proc_index++;
}
}
@@ -7014,6 +7018,8 @@ gb_internal CallArgumentData check_call_arguments_proc_group(CheckerContext *c,
{
// NOTE(bill, 2019-07-13): This code is used to improve the type inference for procedure groups
// where the same positional parameter has the same type value (and ellipsis)
//TODO: get rid of proc_arg_count. make lhs as long as longest proc with most params. watch out for null safety
isize proc_arg_count = -1;
for (Entity *p : procs) {
Type *pt = base_type(p->type);