summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-03-11 18:00:39 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-03-11 18:00:39 -0400
commit57ee07f1261684171731b231f0b6ef100420d262 (patch)
treefd57a8711d68cbf9ec0d9049dbd4aaeeffde5488 /types.c
parent91b74e90fb1e3b59058a7dc7045795c32e53c5a5 (diff)
cleanup and varargs bugfix
Diffstat (limited to 'types.c')
-rw-r--r--types.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/types.c b/types.c
index 2e02b49..c1acac9 100644
--- a/types.c
+++ b/types.c
@@ -1217,7 +1217,7 @@ static Status call_arg_param_order(FnExpr *fn, Type *fn_type, Argument *args, Lo
arr_foreach(fn->params, Declaration, decl) {
arr_foreach(decl->idents, Identifier, ident) {
if (order[param_idx] == -1) {
- if (type_is_builtin(&decl->type, BUILTIN_VARARGS)) {
+ if ((decl->flags & DECL_ANNOTATES_TYPE) && type_is_builtin(&decl->type, BUILTIN_VARARGS)) {
order[param_idx] = (I16)nargs;
} else if (!(decl->flags & DECL_HAS_EXPR) && !(decl->flags & DECL_INFER)) {
char *s = ident_to_str(*ident);
@@ -2220,10 +2220,8 @@ static Status types_expr(Typer *tr, Expression *e) {
if (param->flags & DECL_INFER) {
*(Identifier *)arr_add(&inferred_idents) = *ident;
} else if ((param->flags & DECL_ANNOTATES_TYPE)
- && !(param->flags & DECL_HAS_EXPR)) {
- if (param->type.kind == TYPE_TUPLE)
- err_print(param->where, "Parameters cannot have tuple types.");
-
+ && !type_is_builtin(&param->type, BUILTIN_VARARGS)) {
+ /* add to stuff infer can use */
Type **p = arr_add(&decl_types);
*p = &param->type;
Type **q = arr_add(&arg_types);