diff options
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | test.toc | 20 | ||||
-rw-r--r-- | types.c | 14 |
3 files changed, 25 insertions, 11 deletions
@@ -18,8 +18,6 @@ /* TODO: -remember to free order ---- see infer.c "is resolved_to necessary" (now that ident system has changed) replace is_reference in type_resolve_ with system for checking if type is circularly dependent in a bad way, with compiler_sizeof @@ -1,11 +1,19 @@ -io ::= nms { -#include "std/io.toc"; +// io ::= nms { +// #include "std/io.toc"; +// }; + +// p ::= struct(x::Type,y::=3) { +// b:int; +// }; + +foo ::= fn(x::int) Type { + [x]int }; -p ::= struct(x::Type,y::=3) { - b:int; +z ::= fn(a::=,b:foo(a)) { }; + main ::= fn() { -z:p(int); -x:[z.y]z.x; + n:foo(3); + z(n); };
\ No newline at end of file @@ -877,8 +877,14 @@ static bool call_arg_param_order(FnExpr *fn, Type *fn_type, Argument *args, Loca nparams, plural_suffix(nparams), nargs); return false; } - - I16 *order = *orderp = err_malloc(nparams * sizeof *order); + + + I16 *order = *orderp = + /* thanks, gcc, for making me do this! (getting erroneous -Walloc-size-larger-than) */ +#if defined __GNUC__ && !defined __clang__ + nparams > PTRDIFF_MAX ? NULL : +#endif + err_malloc(nparams * sizeof *order); for (size_t i = 0; i < nparams; ++i) order[i] = -1; @@ -1684,6 +1690,7 @@ static bool types_expr(Typer *tr, Expression *e) { } else { arg_exprs[i] = args[arg_idx].val; } + ++i; } } } else { @@ -1729,7 +1736,7 @@ static bool types_expr(Typer *tr, Expression *e) { Type **arg_types = NULL; Type **decl_types = NULL; Identifier *inferred_idents = NULL; - + arr_foreach(fn->params, Declaration, param) { arr_foreach(param->idents, Identifier, ident) { if (param->flags & DECL_INFER) { @@ -1744,6 +1751,7 @@ static bool types_expr(Typer *tr, Expression *e) { *p = ¶m->type; Type **q = typer_arr_add(tr, &arg_types); *q = &arg_exprs[i].type; + print_expr(arg_exprs + i); } ++i; } |