summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-12-15 17:26:52 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2019-12-15 17:26:52 -0500
commit054fec911b18dc0c8ec0180858b0bd00f60be90b (patch)
tree1d27f15bdc345044ea293e8c5ff3da6cda439861 /types.c
parente637aa3a416e0c90273f127a8d11b918356dfcc4 (diff)
bug fixes for inference
Diffstat (limited to 'types.c')
-rw-r--r--types.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/types.c b/types.c
index d4bac24..c57cc71 100644
--- a/types.c
+++ b/types.c
@@ -754,11 +754,19 @@ static bool call_arg_param_order(Allocator *allocr, FnExpr *fn, Location fn_wher
return false;
}
param_idx = index;
- } else if ((param->flags & (DECL_HAS_EXPR | DECL_INFER)) && param < last_param_without_default_value) {
- /* this param must be named; so this is referring to a later parameter */
- --arg;
} else {
- param_idx = p;
+ if (param > (Declaration *)arr_last(fn->params)) {
+ err_print(arg->where, "Too many arguments to function!");
+ info_print(fn_where, "Declaration is here.");
+ return false;
+ }
+
+ if ((param->flags & (DECL_HAS_EXPR | DECL_INFER)) && param < last_param_without_default_value) {
+ /* this param must be named; so this is referring to a later parameter */
+ --arg;
+ } else {
+ param_idx = p;
+ }
}
if (param_idx != -1) {