all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: 60225@debbugs.gnu.org
Cc: Attila Lendvai <attila@lendvai.name>
Subject: [bug#60225] [PATCH v2 2/2] tests: records: Add a failing test for match-record.
Date: Wed, 21 Dec 2022 23:14:57 -0300	[thread overview]
Message-ID: <20221222021455.18632-2-attila@lendvai.name> (raw)
In-Reply-To: <20221222021455.18632-1-attila@lendvai.name>

* tests/records.scm ("match-record, syntactic interference"): New failing test.
---

i'm not sure what's going on here, but it looks like a bug to me.

i've experienced this in real code, and the error message was
not very helpful.

 tests/records.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/records.scm b/tests/records.scm
index b1203dfeb7..8a48e2fd07 100644
--- a/tests/records.scm
+++ b/tests/records.scm
@@ -561,4 +561,27 @@ (define-record-type* <foo> foo make-foo
             (make-fresh-user-module)))
     (lambda (key . args) key)))
 
+(test-expect-fail 1)
+(test-equal "match-record, syntactic interference"
+  '(1 2)
+  (begin
+    (define* (make-form #:optional (bindings '()))
+      `(begin
+         (use-modules (guix records))
+
+         (let ((first 42))              ; here it does not interfere
+           (define-record-type* <foo> foo make-foo
+             foo?
+             (first  foo-first (default 1))
+             (second foo-second))
+
+           (let (,@bindings)            ; but here it does interfere
+             (match-record (foo (second 2)) <foo>
+               (first second)
+               (list first second))))))
+    ;; This works fine.
+    (eval (make-form) (make-fresh-user-module))
+    ;; But this fails, although I think it shouldn't.
+    (eval (make-form '((second 43))) (make-fresh-user-module))))
+
 (test-end)
-- 
2.35.1





  reply	other threads:[~2022-12-22  2:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20 17:40 [bug#60225] [PATCH] records: match-record supports specifying a different variable name Attila Lendvai
2022-12-21 22:15 ` Ludovic Courtès
2022-12-22  2:14 ` [bug#60225] [PATCH v2 1/2] " Attila Lendvai
2022-12-22  2:14   ` Attila Lendvai [this message]
2022-12-27 22:53     ` [bug#60225] [PATCH] " Ludovic Courtès
2022-12-27 22:49   ` bug#60225: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221222021455.18632-2-attila@lendvai.name \
    --to=attila@lendvai.name \
    --cc=60225@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.