diff --git a/ic3/.ic3_history b/ic3/.ic3_history
index be20bb9..93faa4e 100644
--- a/ic3/.ic3_history
+++ b/ic3/.ic3_history
@@ -1,4 +1,3 @@
-type(beaucoup)
beacoup
beaucoup
1 / 4
@@ -97,3 +96,5 @@ Plop.sq(4)
defmodule Plop do defoperator :operator_add :+ cfn Tag "tag_mul" (Tag, Tag, Result) 10 :left end
defmodule Plop do def sq = fn (x) { x + x } end
Plop.sq(4)
+defoperator :operator_add :+ cfn Tag "tag_mul" (Tag, Tag, Result) 10 :left
+
diff --git a/libc3/env.c b/libc3/env.c
index c5517f4..7d57dba 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -186,14 +186,18 @@ s_tag * env_defoperator (s_env *env, const s_sym **name,
*operator_associativity);
facts_add_tags(&env->facts, &tag_module_name, &tag_operator,
&tag_ident);
- facts_add_tags(&env->facts, &tag_ident, &tag_is_a, &tag_operator);
- facts_add_tags(&env->facts, &tag_ident, &tag_symbol, &tag_sym);
- facts_add_tags(&env->facts, &tag_ident, &tag_arity_sym, &tag_arity_u8);
- facts_add_tags(&env->facts, &tag_ident, &tag_symbol_value, symbol_value);
- facts_add_tags(&env->facts, &tag_ident, &tag_operator_precedence_sym,
- &tag_operator_precedence_u8);
- facts_add_tags(&env->facts, &tag_ident, &tag_operator_associativity_rel,
- &tag_operator_associativity_value);
+ facts_replace_tags(&env->facts, &tag_ident, &tag_is_a, &tag_operator);
+ facts_replace_tags(&env->facts, &tag_ident, &tag_symbol, &tag_sym);
+ facts_replace_tags(&env->facts, &tag_ident, &tag_arity_sym,
+ &tag_arity_u8);
+ facts_replace_tags(&env->facts, &tag_ident, &tag_symbol_value,
+ symbol_value);
+ facts_replace_tags(&env->facts, &tag_ident,
+ &tag_operator_precedence_sym,
+ &tag_operator_precedence_u8);
+ facts_replace_tags(&env->facts, &tag_ident,
+ &tag_operator_associativity_rel,
+ &tag_operator_associativity_value);
*dest = tag_ident;
return dest;
}
diff --git a/test/ic3/defoperator.in b/test/ic3/defoperator.in
new file mode 100644
index 0000000..8a9a6f7
--- /dev/null
+++ b/test/ic3/defoperator.in
@@ -0,0 +1,10 @@
+quote defoperator :operator_muul :**** cfn Tag "tag_mul" (Tag, Tag, Result) 11 :left
+defoperator :operator_muul :**** cfn Tag "tag_mul" (Tag, Tag, Result) 11 :left
+quote 4 **** 4
+4 **** 4
+quote defmodule Plop do
+ defoperator :operator_addd :++++ cfn Tag "tag_add" (Tag, Tag, Result) 10 :left
+ def double = fn (x) { x ++++ x }
+end
+quote Plop.double(21)
+Plop.double(21)
diff --git a/test/ic3/defoperator.out.expected b/test/ic3/defoperator.out.expected
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/test/ic3/defoperator.out.expected
@@ -0,0 +1 @@
+
diff --git a/test/ic3/defoperator.ret.expected b/test/ic3/defoperator.ret.expected
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/ic3/defoperator.ret.expected
@@ -0,0 +1 @@
+0