From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id mOr6CRLCjGWZTwAAkFu2QA (envelope-from ) for ; Thu, 28 Dec 2023 01:32:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id wCLLBhLCjGUC8AAA62LTzQ (envelope-from ) for ; Thu, 28 Dec 2023 01:32:18 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=tZee5fCy; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1703723538; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Er58yMHg0xcrWVUmZeu1WLbmedDfbUG9f8BkyJclMDg=; b=bJABtcGsrU/vlXXXl7mfu2JRuJgLKFMYhqzWqyQoiyaqM3iVDVdvC3OAzx5ZtrEWHIqrGK mfoSxAaRxh9ouEd/+Law2ytUnk5GQxC31X6icsWLUWKOYthViuCnN1PtDyD7bQz6SHnRvS 9B0PioIAzrlZaYhaYQ+ISUDbugzNPrGKLMNjGKXyU2jPa/Sg2NqXepFrVarbPxjhk+v9oU AEzKEp265nxLdFDvXIUJ/pcnSjrxlzzd950NQlPyE7NYQPc+nTruC0RGmbLiP+qeqA7cF9 ceOLQ1x3IN16o2h9Th0/tjsO6R/48873TzlxFmHTnTAfWwEktyMqj3Dm3Z9xMg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1703723538; a=rsa-sha256; cv=none; b=iftDRs5Kvdo+Ql5y3lLheoCg6eweF0jsxtBtIyPB0Y45M+9dDpct3+EgWEEE3XjobCitND T+g06opm4UghN6ZcgKIQ5vVdk6k34B0p8kichlVi5rlH52WfYc6PBcHdMuVm6wNROys/5n AbC66JAF4N8W9JpbZ/gMSbwHLvM5m3ceGNHiWQv4nRE+DNTk/QEdUMO9p6QhvUO2uwIMpq a0kQ2HtLcx1ZDnr4EM6t+i1JKlNLfJqW1amvoVx/Q5dtR/9DhN4h5yJjyEJ8WeFcrupuiz /Cl2pdTzaEmfzbitFSfLD84osZnKCa3GLSJLLwyYNpPgEWDb018lK/nH9EjCPA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=tZee5fCy; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B5757262E9 for ; Thu, 28 Dec 2023 01:32:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rIeJk-00041l-Kd; Wed, 27 Dec 2023 19:32:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rIeJi-00041d-P0 for guix-patches@gnu.org; Wed, 27 Dec 2023 19:32:06 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rIeJf-00022h-EF for guix-patches@gnu.org; Wed, 27 Dec 2023 19:32:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rIeJe-0006iv-9D for guix-patches@gnu.org; Wed, 27 Dec 2023 19:32:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67788] records: Check for missing mandatory innate fields when, inheriting. References: <5a0f596c5bbcc75e3ca50d37066f42baca354236.1702330063.git.skyvine@protonmail.com> In-Reply-To: <5a0f596c5bbcc75e3ca50d37066f42baca354236.1702330063.git.skyvine@protonmail.com> Resent-From: Skyler Ferris Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Dec 2023 00:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67788 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67788@debbugs.gnu.org Received: via spool by 67788-submit@debbugs.gnu.org id=B67788.170372348425167 (code B ref 67788); Thu, 28 Dec 2023 00:32:02 +0000 Received: (at 67788) by debbugs.gnu.org; 28 Dec 2023 00:31:24 +0000 Received: from localhost ([127.0.0.1]:38102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rIeJ2-0006XZ-2L for submit@debbugs.gnu.org; Wed, 27 Dec 2023 19:31:24 -0500 Received: from mail-4322.protonmail.ch ([185.70.43.22]:57875) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rIeIz-0006Q6-W0 for 67788@debbugs.gnu.org; Wed, 27 Dec 2023 19:31:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1703723476; x=1703982676; bh=Er58yMHg0xcrWVUmZeu1WLbmedDfbUG9f8BkyJclMDg=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=tZee5fCym6LkFfheXt2vwt7bkM9A+VGlVnHnVYm/NqpY1DoBjz2ifXBTc34ZIb2+N aJsbivwLCvqLzz9WWEgAIVjmPET9p6tSa3uCIlYvqIBfRL95TPPPVmqrJuA5CojNZT 6RpvxLxKIWeYTi3QpljXXu/gSvdr/bDbVgIKGiS68ncLFxH82KyiG61XNzDUB3iwuV sjYlw+lQUBxtfDFivPJIY3LGt3YO6EFMrbxXltWqDRnMEFxpAH/94q0CnPW/GgWmKQ y3MZzM9ws0KYxGtY2cBVdk76kaRUE+79NjcnnGFH+I6MB5T5wyYz/U2fErg4df2D9T NS1CqrC20vxNg== Date: Thu, 28 Dec 2023 00:30:56 +0000 Message-ID: Feedback-ID: 40635331:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Skyler Ferris X-ACL-Warn: , Skyler Ferris via Guix-patches From: Skyler Ferris via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.75 X-Spam-Score: -6.75 X-Migadu-Queue-Id: B5757262E9 X-Migadu-Scanner: mx12.migadu.com X-TUID: 2B7nflGTlxH6 his gives the user a more helpful error message if they inherit from another instance but forget to supply a value for a field which is innate and has no default. * guix/records.scm (record-inheritance): Check for missing innate fields Change-Id: I08b898d8da551af50aa5b0b60187dcad8d259bc1 --- # This version of the commit addse a test case which confirms that # theuseful commit message is given. It is based on the test immediately # above it, which checks for the error message in the non-innate case. # # Additionally, I can now confirm that all tests pass with this commit. # The failures I noted previously were indeed environmental problems and # have been resolved locally (and were unrelated to the commit). =C2=A0guix/records.scm=C2=A0 |=C2=A0 9 +++++++++ =C2=A0tests/records.scm | 18 ++++++++++++++++++ =C2=A02 files changed, 27 insertions(+) diff --git a/guix/records.scm b/guix/records.scm index f4d12a861d..109c5cf4dc 100644 --- a/guix/records.scm +++ b/guix/records.scm @@ -161,6 +161,15 @@ (define-syntax make-syntactic-constructor =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (record-error 'name s "extraneous field initializers = ~a" =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unexpected))) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; Make sure = all mandatory and innate fields are included. +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let* ((field= s=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (map (compose= car syntax->datum)=20 field+value)) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (optional=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (map (compose car syntax->datum)=20 'defaults)) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (mandatory=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (lset-difference eq? '(expected=20 ...) optional)) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (mandatory+innate (lset-intersection eq? = mandatory=20 'innate)) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (missing=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (lset-difference eq?=20 mandatory+innate fields))) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (when (pair? missing) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (record-error 'name s "missing field initializers ~a"=20 missing))) + =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #`(make= -struct/no-tail type =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 #,@(map (lambda (field index) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (or (field-inherited-value field) diff --git a/tests/records.scm b/tests/records.scm index 5464892d3b..39f4bfdf9c 100644 --- a/tests/records.scm +++ b/tests/records.scm @@ -402,6 +402,24 @@ (define (location-alist loc) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (string= -match "missing .*initialize.*baz" message) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (equal?= form '(foo)))))) +(test-assert "define-record-type* & innate & missing initializers" +=C2=A0 (catch 'syntax-error +=C2=A0=C2=A0=C2=A0 (lambda () +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (eval '(begin +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (define-record-type* foo make-foo +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 foo? +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (bar foo-bar (default 42)) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (baz foo-baz (innate))) + +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (let ((base (foo (bar #t) (baz #t)))) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (foo (inherit base)))) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (test-m= odule)) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #f) +=C2=A0=C2=A0=C2=A0 (lambda (key proc message location form . args) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (and (eq? proc 'foo) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (string-match= "missing .*initialize.*baz" message) +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (equal? form = '(foo (inherit base))))))) + =C2=A0(test-assert "define-record-type* & extra initializers" =C2=A0=C2=A0 (catch 'syntax-error =C2=A0=C2=A0=C2=A0=C2=A0 (lambda () base-commit: fe86819d8bde674766659c22b215d3a689a8026e --=20 2.41.0