aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorTohei Ichikawa <ichikawa.tohei.desu@gmail.com>2025-09-15 20:40:20 -0400
committerTohei Ichikawa <ichikawa.tohei.desu@gmail.com>2025-09-15 20:40:20 -0400
commit403ca2fb2ea97d5567a70aea43336c87cba7a348 (patch)
treee62b7c2a6b73e7cecf3feacaa5f82bc7e35ef71d /src/check_expr.cpp
parent935d9657a37ab88a2a627a6dbe67c128d4029a76 (diff)
Improve type inferencing of literals when calling proc groups
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index d2505c047..417d1b9a4 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -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);