]> Nishi Git Mirror - gwion.git/commitdiff
:art: template coverage
authorfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 9 Oct 2019 20:31:47 +0000 (22:31 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 9 Oct 2019 20:31:47 +0000 (22:31 +0200)
src/parse/template.c
tests/tree/template_class_invalid_type_number.gw [new file with mode: 0644]
tests/tree/template_self.gw [new file with mode: 0644]

index 3a60b28582154a7d698244415e754b5559c9bbf8..04b7d1b0365db23b7bb108fdd366a2cbcce4b172 100644 (file)
@@ -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 (file)
index 0000000..00ee497
--- /dev/null
@@ -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 (file)
index 0000000..eb852dd
--- /dev/null
@@ -0,0 +1,7 @@
+class <~A~>C {
+  fun void test() {
+    <~A~>C c;
+  }
+}
+
+<~int~>C c;