From 71408de2e2b2aace1982c5a24b1ffc61229866c1 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sat, 14 Dec 2019 11:40:33 -0500 Subject: small bug fix (arr_clear => arr_cleara) --- parse.c | 2 -- types.c | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/parse.c b/parse.c index 7599a97..087ae73 100644 --- a/parse.c +++ b/parse.c @@ -2021,8 +2021,6 @@ static void fprint_arg_exprs(FILE *out, Expression *args) { fprintf(out, "("); arr_foreach(args, Expression, arg) { if (arg != args) fprintf(out, ", "); - Expression *last = arr_last(args); - assert(arg<=last); fprint_expr(out, arg); } fprintf(out, ")"); diff --git a/types.c b/types.c index 5e9fb6e..2c6c654 100644 --- a/types.c +++ b/types.c @@ -1367,7 +1367,10 @@ static bool types_expr(Typer *tr, Expression *e) { c->instance = instance_table_adda(tr->allocr, &original_fn->instances, table_index, &table_index_type, &instance_already_exists); - if (!instance_already_exists) { + if (instance_already_exists) { + arr_cleara(&table_index_type.tuple, tr->allocr); + arr_cleara(&table_index.tuple, tr->allocr); + } else { copy_block(&cop, &fn_copy.body, &original_fn->body); c->instance->fn = fn_copy; /* fix parameter and return types (they were kind of problematic before, because we didn't know about the instance) */ @@ -1380,7 +1383,7 @@ static bool types_expr(Typer *tr, Expression *e) { bool success = types_fn(tr, &c->instance->fn, &f->type, e->where, c->instance); arr_remove_last(&err_ctx->instance_stack); if (!success) return false; - arr_clear(&table_index_type.tuple); + arr_cleara(&table_index_type.tuple, tr->allocr); } } -- cgit v1.2.3