GNU bug report logs - #50914
[PATCH] records: Raise a &fix-hint if a field has multiple values.

Previous Next

Package: guix-patches;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Thu, 30 Sep 2021 09:33:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 49671 <at> debbugs.gnu.org, 50914 <at> debbugs.gnu.org
Subject: [bug#50914] [PATCH] records: Raise a &fix-hint if a field has multiple values.
Date: Mon, 04 Oct 2021 16:26:33 +0200
Hi,

Maxime Devos <maximedevos <at> telenet.be> skribis:

> * guix/records.scm (report-invalid-field-specifier): If
>   'weird' is something like (field (record ...) extra ...), hint that 'extra
>   ...' should probably be moved inside (record ...).

Please see also <https://issues.guix.gnu.org/49671>.

> +               (condition
> +                (&origin (origin name))
> +                (&message (message
> +                           (format #f "field ‘~a’ should only have one \
> +value, but an extra value ‘~a’ was passed as well.  Perhaps this extra \
> +value was supposed to be a field specifier, and needs to be moved inside \
> +the record ‘~a’?"

We’ll need i18n here and straight quotes.

> +                (&syntax (form (car forms))
> +                         (subform (and (not (null? (cdr forms)))
> +                                       (cadr forms))))

No cadrcdr please.  :-)

> +                (&fix-hint (hint (object->string
> +                                  (syntax->datum
> +                                   #'(field
> +                                      (record-name fields ... extra-value
> +                                                   extra-value* ...)))))))))

The ‘hint’ field must be a string, typically the message you had above;
see other examples in the code.

TIA!

Ludo’.




This bug report was last modified 3 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.