Unhelpful error message when a mandatory & innate field is missing after inheritance

  • Open
  • quality assurance status badge
Details
One participant
  • Skyler Ferris
Owner
unassigned
Submitted by
Skyler Ferris
Severity
normal
S
S
Skyler Ferris wrote on 11 Dec 2023 20:48
(address . bug-guix@gnu.org)
1fee6c6b-74ec-4a2c-bf75-822c9ba88044@protonmail.com
Normally, when a field is missing Guix provides a helpful error message
explaining the precise problem:

(define-record-type <t> t make-t t? this-t

  (mandatory-field t-mandatory-field))

(t) => t: missing field initializers (mandatory-field) in form (t)

However, if the field is innate, a value is inherited, and the mandatory
field is missing, the error message is not helpful:

(define-record-type <t> t make-t t? this-t

  (mandatory-field t-mandatory-field)

  (innate-mandatory-field t-innate-mandatory-field (innate))

(define base (t (mandatory-field #t) (innate-mandatory-field #t)))

(t (inherit base)) =>

Backtrace:
          12 (primitive-load "/tmp/test.scm")
In ice-9/eval.scm:
   721:20 11 (primitive-eval (t (inherit base)))
In ice-9/psyntax.scm:
  1229:36 10 (expand-top-sequence (#<syntax:test.scm:6:0 (t #<synt…>) …)
  1121:20  9 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …)
  1342:32  8 (syntax-type (t #<syntax:test.scm:6:3 (inherit base)>) # …)
  1562:32  7 (expand-macro #<procedure 7f793c5d10e0 at ice-9/eval.s…> …)
In ice-9/eval.scm:
   191:35  6 (_ #(#(#<directory (guix-user) 7f7940782a00> #<va…> …) …))
    163:9  5 (_ #(#(#<directory (guix-user) 7f7940782a00> #<va…> …) …))
   191:35  4 (_ #(#(#(#<directory (guix-user) 7f7940782a00> # …) …) …))
In srfi/srfi-1.scm:
   603:19  3 (map2 (innate-mandatory-field mandatory-field) (0 1) 2)
In ice-9/eval.scm:
   196:43  2 (_ #(#(#(#<directory (guix-user) 7f7940782a00> # …) …) …))
    155:9  1 (_ _)
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure car: Wrong type argument in position 1 (expecting pair): #f
?