summaryrefslogtreecommitdiff
path: root/guix/records.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-17 16:45:45 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-17 16:45:45 +0200
commita1906758c31036c30f8c11703daa4202adde8dac (patch)
tree6f883bda37ee9e445792e7938b211c87af6f88f5 /guix/records.scm
parentb1353e7a6baf15e6e1db79063c01f4b07b6d4e06 (diff)
downloadgnu-guix-a1906758c31036c30f8c11703daa4202adde8dac.tar
gnu-guix-a1906758c31036c30f8c11703daa4202adde8dac.tar.gz
records: Report unknown field names in inheriting forms.
* guix/records.scm (define-record-type*)[record-inheritance]: Check for unexpected field names. * tests/records.scm ("define-record-type* with let* behavior"): Return #t, not *unspecified*. ("define-record-type* & inherit & extra initializers"): New test.
Diffstat (limited to 'guix/records.scm')
-rw-r--r--guix/records.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/guix/records.scm b/guix/records.scm
index e60732dd43..cd887b77ce 100644
--- a/guix/records.scm
+++ b/guix/records.scm
@@ -69,6 +69,14 @@ thunked fields."
field+value)
car))
+ ;; Make sure there are no unknown field names.
+ (let* ((fields (map (compose car syntax->datum)
+ field+value))
+ (unexpected (lset-difference eq? fields 'expected)))
+ (when (pair? unexpected)
+ (record-error 'name s "extraneous field initializers ~a"
+ unexpected)))
+
#`(make-struct type 0
#,@(map (lambda (field index)
(or (field-inherited-value field)