guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: records: Make 'report-duplicate-field-specifier' available at exp


From: guix-commits
Subject: 02/02: records: Make 'report-duplicate-field-specifier' available at expansion-time.
Date: Thu, 24 Jan 2019 14:51:19 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit bbb2bd50dcb160d8e60fc657b96f1b6739cd8d89
Author: Ludovic Courtès <address@hidden>
Date:   Thu Jan 24 20:48:14 2019 +0100

    records: Make 'report-duplicate-field-specifier' available at 
expansion-time.
    
    Fixes a regression in 'guix pack -R' introduced with commit
    c2dcff41c2e47f5f978f467864d5ed7829939884.  The imported modules of
    'c-compiler' would be compiled in this order: first (guix records),
    then (guix search-paths).  Consequently,
    'report-duplicate-field-specifier' would be reported as unbound while
    compiling (guix search-paths), leading to a build failure.
    
    * guix/records.scm (report-invalid-field-specifier)
    (report-duplicate-field-specifier): Move within 'eval-expand'.
---
 guix/records.scm | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/guix/records.scm b/guix/records.scm
index 6b3c25c..0649c90 100644
--- a/guix/records.scm
+++ b/guix/records.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès 
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès 
<address@hidden>
 ;;; Copyright © 2018 Mark H Weaver <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -44,31 +44,6 @@
                        (format #f fmt args ...)
                        form))))
 
-(define (report-invalid-field-specifier name bindings)
-  "Report the first invalid binding among BINDINGS."
-  (let loop ((bindings bindings))
-    (syntax-case bindings ()
-      (((field value) rest ...)                   ;good
-       (loop #'(rest ...)))
-      ((weird _ ...)                              ;weird!
-       (syntax-violation name "invalid field specifier" #'weird)))))
-
-(define (report-duplicate-field-specifier name ctor)
-  "Report the first duplicate identifier among the bindings in CTOR."
-  (syntax-case ctor ()
-    ((_ bindings ...)
-     (let loop ((bindings #'(bindings ...))
-                (seen   '()))
-       (syntax-case bindings ()
-         (((field value) rest ...)
-          (not (memq (syntax->datum #'field) seen))
-          (loop #'(rest ...) (cons (syntax->datum #'field) seen)))
-         ((duplicate rest ...)
-          (syntax-violation name "duplicate field initializer"
-                            #'duplicate))
-         (()
-          #t))))))
-
 (eval-when (expand load eval)
   ;; The procedures below are needed both at run time and at expansion time.
 
@@ -91,7 +66,32 @@ interface\" (ABI) for TYPE is equal to COOKIE."
           ;; recompiled.
           (throw 'record-abi-mismatch-error 'abi-check
                  "~a: record ABI mismatch; recompilation needed"
-                 (list #,type) '())))))
+                 (list #,type) '()))))
+
+  (define (report-invalid-field-specifier name bindings)
+    "Report the first invalid binding among BINDINGS."
+    (let loop ((bindings bindings))
+      (syntax-case bindings ()
+        (((field value) rest ...)                   ;good
+         (loop #'(rest ...)))
+        ((weird _ ...)                              ;weird!
+         (syntax-violation name "invalid field specifier" #'weird)))))
+
+  (define (report-duplicate-field-specifier name ctor)
+    "Report the first duplicate identifier among the bindings in CTOR."
+    (syntax-case ctor ()
+      ((_ bindings ...)
+       (let loop ((bindings #'(bindings ...))
+                  (seen   '()))
+         (syntax-case bindings ()
+           (((field value) rest ...)
+            (not (memq (syntax->datum #'field) seen))
+            (loop #'(rest ...) (cons (syntax->datum #'field) seen)))
+           ((duplicate rest ...)
+            (syntax-violation name "duplicate field initializer"
+                              #'duplicate))
+           (()
+            #t)))))))
 
 (define-syntax make-syntactic-constructor
   (syntax-rules ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]