guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] branch main updated: srfi-35: Fix expansion of 'conditio


From: Ludovic Courtès
Subject: [Guile-commits] branch main updated: srfi-35: Fix expansion of 'condition' for compound conditions.
Date: Sat, 01 Oct 2022 12:08:05 -0400

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new 3ed7673ac srfi-35: Fix expansion of 'condition' for compound 
conditions.
3ed7673ac is described below

commit 3ed7673ac067a8614dcf36e2f5293111ba60b243
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Oct 1 18:02:09 2022 +0200

    srfi-35: Fix expansion of 'condition' for compound conditions.
    
    * module/srfi/srfi-35.scm (condition): Use 'make-exception' instead of
    'make-compound-condition', which is unbound in this module.
    * test-suite/tests/srfi-35.test ("syntax")["compound condition,
    hygienic macro expansion"]: New test.
---
 module/srfi/srfi-35.scm       |  6 +++---
 test-suite/tests/srfi-35.test | 18 ++++++++++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/module/srfi/srfi-35.scm b/module/srfi/srfi-35.scm
index e430833c4..99a93dc18 100644
--- a/module/srfi/srfi-35.scm
+++ b/module/srfi/srfi-35.scm
@@ -1,6 +1,6 @@
 ;;; srfi-35.scm --- Conditions                 -*- coding: utf-8 -*-
 
-;; Copyright (C) 2007-2011, 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2011, 2017, 2022 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -146,5 +146,5 @@ by C."
     ((_ (type field ...))
      (condition-instantiation type () field ...))
     ((_ (type field ...) ...)
-     (make-compound-condition (condition-instantiation type () field ...)
-                              ...))))
+     (make-exception (condition-instantiation type () field ...)
+                     ...))))
diff --git a/test-suite/tests/srfi-35.test b/test-suite/tests/srfi-35.test
index df73c8442..dc95ddd37 100644
--- a/test-suite/tests/srfi-35.test
+++ b/test-suite/tests/srfi-35.test
@@ -1,7 +1,7 @@
 ;;;; srfi-35.test --- SRFI-35.             -*- mode: scheme; coding: utf-8; -*-
 ;;;; Ludovic Courtès <ludo@gnu.org>
 ;;;;
-;;;;   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;;;   Copyright (C) 2007, 2008, 2009, 2010, 2022 Free Software Foundation, 
Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -176,7 +176,21 @@
            (c  (condition (t1 (a 0) (b 1))
                           (t2 (c 2) (d 3)))))
       (and (equal? c1 (extract-condition c t1))
-           (equal? c2 (extract-condition c t2))))))
+           (equal? c2 (extract-condition c t2)))))
+
+  (pass-if "compound condition, hygienic macro expansion"
+    ;; In Guile 3.0.8, the 'condition' form below would refer to
+    ;; 'make-compound-condition' in an unhygienic fashion, leading to
+    ;; "unbound variable: make-compound-condition" if (srfi srfi-35) is
+    ;; not imported or imported with different bindings.
+    (let ((c (eval '(begin
+                      (use-modules ((srfi srfi-35) #:prefix s:))
+
+                      (s:condition (s:&error)
+                                   (s:&message (message "m"))))
+                   (make-fresh-user-module))))
+      (and (condition? c)
+           (error? c) (message-condition? c)))))
 
 
 ;;;



reply via email to

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