mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
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.
This commit is contained in:
parent
78c7772eb7
commit
3ed7673ac0
2 changed files with 19 additions and 5 deletions
|
@ -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 ...)
|
||||
...))))
|
||||
|
|
|
@ -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)))))
|
||||
|
||||
|
||||
;;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue