Commit 40cacf8f7cd1fe42300ddbc2af23144b5ed846ae

Thomas de Grivel 2024-10-15T17:37:13

fix {a, b} = {1, 2}

diff --git a/libkc3/buf_parse.c b/libkc3/buf_parse.c
index 24900c2..792921f 100644
--- a/libkc3/buf_parse.c
+++ b/libkc3/buf_parse.c
@@ -3684,7 +3684,8 @@ sw buf_parse_tag (s_buf *buf, s_tag *dest)
     goto restore;
   switch (c) {
   case '{':
-    if ((r = buf_parse_tag_tuple(buf, dest)) ||
+    if ((r = buf_parse_tag_call_op(buf, dest)) ||
+        (r = buf_parse_tag_tuple(buf, dest)) ||
         (r = buf_parse_tag_block(buf, dest)))
       goto end;
     goto restore;
diff --git a/libkc3/env.c b/libkc3/env.c
index 6e773c0..621fb14 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -1254,13 +1254,28 @@ bool env_eval_equal_tuple (s_env *env, bool macro, const s_tuple *a,
   assert(a);
   assert(b);
   assert(dest);
-  if (a->count != b->count)
+  if (a->count != b->count) {
+    err_write_1("env_eval_equal_tuple: tuple arity mismatch between"
+                "\n  ");
+    err_inspect_tuple(a);
+    err_write_1("\nand\n  ");
+    err_inspect_tuple(b);
+    err_write_1("\n");
+    assert(! "env_eval_equal_tuple: tuple arity mismatch");
     return false;
+  }
   tuple_init(&tmp, a->count);
   i = 0;
   while (i < a->count) {
     if (! env_eval_equal_tag(env, macro, a->tag + i, b->tag + i,
                              tmp.tag + i)) {
+      err_write_1("env_eval_equal_tuple: tuple tag mismatch between"
+                  "\n  ");
+      err_inspect_tuple(a);
+      err_write_1("\nand\n  ");
+      err_inspect_tuple(b);
+      err_write_1("\n");
+      assert(! "env_eval_equal_tuple: tuple tag mismatch");
       tuple_clean(&tmp);
       return false;
     }
diff --git a/test/ikc3/tuple.kc3 b/test/ikc3/tuple.kc3
index edb47f3..fa5eb6e 100644
--- a/test/ikc3/tuple.kc3
+++ b/test/ikc3/tuple.kc3
@@ -41,3 +41,9 @@
   , ## comment 15
   :c ## comment 16
   } ## comment 17
+quote {a, b} = {1, 2}
+{a, b} = {1, 2}
+quote a
+a
+quote b
+b
diff --git a/test/ikc3/tuple.out.expected b/test/ikc3/tuple.out.expected
index 755a2d1..09c42f2 100644
--- a/test/ikc3/tuple.out.expected
+++ b/test/ikc3/tuple.out.expected
@@ -17,3 +17,9 @@
 {{:a, :b}, {:c, :d}, {:e, :f}, {:g, :h}, {:i, :j}}
 {:a, :b, :c}
 {:a, :b, :c}
+{a, b} = {1, 2}
+{1, 2}
+a
+1
+b
+2