aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-11 15:14:57 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-11 15:14:57 -0400
commit0b2c4180483f3b2832137bea78dc565d469f8682 (patch)
tree11c1f7ad70d1de5bc8cdc190caf4ad04c6d1b7ad
parente7035e6a861c1d5e8a4917e31b1e8b722b54d55b (diff)
Bugfix for checking argument validity with promotion (for integer
literals)
-rw-r--r--typecheck.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/typecheck.c b/typecheck.c
index 37fe6257..fb78d476 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -1441,8 +1441,8 @@ Table_t *get_arg_bindings(env_t *env, arg_t *spec_args, arg_ast_t *call_args, bo
if (!streq(call_arg->name, spec_arg->name)) continue;
type_t *spec_type = get_arg_type(env, spec_arg);
if (!(type_eq(call_type, spec_type) || (promotion_allowed && can_promote(call_type, spec_type))
- || (!promotion_allowed && call_arg->value->tag == Int && is_numeric_type(spec_type))
- || (!promotion_allowed && call_arg->value->tag == Num && spec_type->tag == NumType)))
+ || (promotion_allowed && call_arg->value->tag == Int && is_numeric_type(spec_type))
+ || (promotion_allowed && call_arg->value->tag == Num && spec_type->tag == NumType)))
return NULL;
Table$str_set(&used_args, call_arg->name, call_arg);
goto next_call_arg;
@@ -1461,8 +1461,8 @@ Table_t *get_arg_bindings(env_t *env, arg_t *spec_args, arg_ast_t *call_args, bo
if (unused_args->name) continue; // Already handled the keyword args
type_t *call_type = get_arg_ast_type(env, unused_args);
if (!(type_eq(call_type, spec_type) || (promotion_allowed && can_promote(call_type, spec_type))
- || (!promotion_allowed && unused_args->value->tag == Int && is_numeric_type(spec_type))
- || (!promotion_allowed && unused_args->value->tag == Num && spec_type->tag == NumType)))
+ || (promotion_allowed && unused_args->value->tag == Int && is_numeric_type(spec_type))
+ || (promotion_allowed && unused_args->value->tag == Num && spec_type->tag == NumType)))
return NULL; // Positional arg trying to fill in
Table$str_set(&used_args, spec_arg->name, unused_args);
unused_args = unused_args->next;