diff options
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | parse.c | 12 | ||||
-rw-r--r-- | test.toc | 2 | ||||
-rw-r--r-- | types.c | 8 |
4 files changed, 4 insertions, 19 deletions
@@ -8,7 +8,6 @@ /* TODO: -make sure varargs works with inference #foreign variadic fns EXPR_VALs don't always need temp variables where @@ -545,10 +545,6 @@ static Status parse_type(Parser *p, Type *type, Location *where) { err_print(slice_where, "You cannot have a slice of tuples."); return false; } - if (type_is_builtin(type->slice, BUILTIN_VARARGS)) { - err_print(slice_where, "You cannot have a slice of varargs."); - return false; - } break; } Token *end = expr_find_end(p, 0); @@ -562,10 +558,6 @@ static Status parse_type(Parser *p, Type *type, Location *where) { err_print(of_where, "You cannot have an array of tuples."); return false; } - if (type_is_builtin(type->arr.of, BUILTIN_VARARGS)) { - err_print(of_where, "You cannot have an array of varargs."); - return false; - } } break; case KW_LT: /* tuple! */ @@ -608,10 +600,6 @@ static Status parse_type(Parser *p, Type *type, Location *where) { err_print(ptr_where, "You cannot have a pointer to a tuple."); return false; } - if (type_is_builtin(type->ptr, BUILTIN_VARARGS)) { - err_print(ptr_where, "You cannot have a pointer to varargs."); - return false; - } } break; case KW_STRUCT: { /* struct */ @@ -1,6 +1,6 @@ #include "std/io.toc"; -g ::= fn(modulator: int, x : ..) int { +g ::= fn(modulator:: int, x : ..) int { total := 0; for e := x { total += modulator * (e as int); @@ -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(¶m->type, BUILTIN_VARARGS)) { + /* add to stuff infer can use */ Type **p = arr_add(&decl_types); *p = ¶m->type; Type **q = arr_add(&arg_types); |