From 2f94e237e6a8f5049e8059a99aef1d79f6f56f91 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Wed, 9 Oct 2019 22:31:47 +0200 Subject: [PATCH] :art: template coverage --- src/parse/template.c | 3 +-- tests/tree/template_class_invalid_type_number.gw | 2 ++ tests/tree/template_self.gw | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tests/tree/template_class_invalid_type_number.gw create mode 100644 tests/tree/template_self.gw diff --git a/src/parse/template.c b/src/parse/template.c index 3a60b285..04b7d1b0 100644 --- a/src/parse/template.c +++ b/src/parse/template.c @@ -105,8 +105,7 @@ ANN m_bool template_push_types(const Env env, const Tmpl *tmpl) { if(!call) break; const Type t = known_type(env, call->td); - if(!t) - POP_RET(-1); + assert(t); // was if(!t)POP_RET(-1); nspc_add_type(env->curr, list->xid, t); call = call->next; } while((list = list->next)); diff --git a/tests/tree/template_class_invalid_type_number.gw b/tests/tree/template_class_invalid_type_number.gw new file mode 100644 index 00000000..00ee4972 --- /dev/null +++ b/tests/tree/template_class_invalid_type_number.gw @@ -0,0 +1,2 @@ +class <~A~>C {} +<~int, float~>C c; diff --git a/tests/tree/template_self.gw b/tests/tree/template_self.gw new file mode 100644 index 00000000..eb852ddc --- /dev/null +++ b/tests/tree/template_self.gw @@ -0,0 +1,7 @@ +class <~A~>C { + fun void test() { + <~A~>C c; + } +} + +<~int~>C c; -- 2.43.0