Commit 72e97a94f188293cda04ab4f2cbb17d7ed856e66

Thomas de Grivel 2023-08-09T16:32:52

test equal (=)

diff --git a/libc3/env.c b/libc3/env.c
index fd10d3a..b6054ff 100644
--- a/libc3/env.c
+++ b/libc3/env.c
@@ -374,12 +374,12 @@ bool env_eval_equal_tag (s_env *env, const s_tag *a, const s_tag *b,
   }
   if (is_unbound_a) {
     tag_copy(b, dest);
-    frame_binding_new(env->frame, a->data.ident.sym, dest);
+    frame_binding_new(env->frame, a->data.ident.sym, tag_new_copy(b));
     return true;
   }
   if (is_unbound_b) {
     tag_copy(a, dest);
-    frame_binding_new(env->frame, b->data.ident.sym, dest);
+    frame_binding_new(env->frame, b->data.ident.sym, tag_new_copy(a));
     return true;
   }
   if (a->type != b->type) {
diff --git a/test/ic3/equal.err.expected b/test/ic3/equal.err.expected
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/ic3/equal.err.expected
diff --git a/test/ic3/equal.in b/test/ic3/equal.in
new file mode 100644
index 0000000..74624a2
--- /dev/null
+++ b/test/ic3/equal.in
@@ -0,0 +1,4 @@
+a = 1
+b = 1
+a = b
+(a, c) = (c, b)
diff --git a/test/ic3/equal.out.expected b/test/ic3/equal.out.expected
new file mode 100644
index 0000000..85ecfff
--- /dev/null
+++ b/test/ic3/equal.out.expected
@@ -0,0 +1,4 @@
+1
+1
+1
+(1, 1)
diff --git a/test/ic3/equal.ret.expected b/test/ic3/equal.ret.expected
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/ic3/equal.ret.expected
@@ -0,0 +1 @@
+0