From d4e6f18941c71886ec3f6ac55eb430096ffe4eeb Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Mon, 2 Sep 2019 00:58:35 +0200 Subject: [PATCH] :art: check.c coverage --- src/parse/check.c | 3 +-- tests/error/call_non_template.gw | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 tests/error/call_non_template.gw diff --git a/src/parse/check.c b/src/parse/check.c index 35b17ccd..9b523c7e 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -825,8 +825,7 @@ ANN static Type check_exp_call(const Env env, Exp_Call* exp) { CHECK_OO(check_exp(env, exp->func)) const Type t = actual_type(exp->func->type); const Value v = nspc_lookup_value1(t->e->owner, insert_symbol(t->name)); - if(!v) - ERR_O(exp_self(exp)->pos, _("template call of non-existant function.")) + assert(v); if(!GET_FLAG(v, func) && !GET_FLAG(exp->func->type, func)) ERR_O(exp_self(exp)->pos, _("template call of non-function value.")) if(!v->d.func_ref->def->base->tmpl) diff --git a/tests/error/call_non_template.gw b/tests/error/call_non_template.gw new file mode 100644 index 00000000..ea998b0f --- /dev/null +++ b/tests/error/call_non_template.gw @@ -0,0 +1,3 @@ +#! [contains] template call of non-template function +fun void test(){} +test<~int~>(); -- 2.43.0