From 2ec0ae1a6e8aff872d8fc63f7bd61e925c168afe Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Fri, 20 Mar 2020 15:03:09 -0400 Subject: fixed small bug caused by varargs --- types.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types.c b/types.c index c66cd6a..b9c9ebd 100644 --- a/types.c +++ b/types.c @@ -490,7 +490,10 @@ static Status type_of_fn(Typer *tr, FnExpr *f, Type *t, U16 flags) { } for (size_t i = 0; i < arr_len(param->idents); ++i) { Type *param_type = typer_arr_add(tr, &t->fn.types); - *param_type = param->type; + if (param->flags & (DECL_ANNOTATES_TYPE|DECL_FOUND_TYPE)) + *param_type = param->type; + else + param_type->kind = TYPE_UNKNOWN; if (has_constant_params) { Constness constn; if (param->flags & DECL_IS_CONST) { @@ -2087,7 +2090,6 @@ static Status types_expr(Typer *tr, Expression *e) { goto ret; } fn_decl = val.fn; - if (has_varargs) fn_decl->flags |= FN_EXPR_HAS_VARARGS; } Type *ret_type = f->type.fn.types; -- cgit v1.2.3