]> Nishi Git Mirror - gwion.git/commitdiff
:art: Prevent writing same template
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Sun, 24 May 2020 23:24:16 +0000 (01:24 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Sun, 24 May 2020 23:24:16 +0000 (01:24 +0200)
src/parse/scan2.c

index 8b066b69b2af64dc8cca4a15b8d5b059fc3c7e69..3bb0c31e5cd10b3ddaa8209926d7d27db84b1772 100644 (file)
@@ -373,8 +373,9 @@ ANN2(1, 2) static m_bool scan2_fdef_tmpl(const Env env, const Func_Def f, const
           ++i;
           continue;
         }
-        m_bool ret = compat_func(ff->def, f);
-        if(ret > 0) {
+        if(compat_func(ff->def, f) > 0) {
+          if(ff->value_ref->from->owner == env->curr)
+            ERR_B(f->pos, "template function '%s' already defined with those arguments in this namespace", name)
           const Symbol sym = func_symbol(env, env->curr->name, name,
             "template", ff->vt_index);
           nspc_add_value(env->curr, sym, value);