diff --git a/module/ice-9/match.scm b/module/ice-9/match.scm index 099afb53a..b9c21490e 100644 --- a/module/ice-9/match.scm +++ b/module/ice-9/match.scm @@ -1,6 +1,6 @@ ;;; -*- mode: scheme; coding: utf-8; -*- ;;; -;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. +;;; Copyright (C) 2010, 2011, 2012, 2020 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 @@ -24,12 +24,16 @@ match-let* match-letrec)) -(define (error _ . args) - ;; Error procedure for run-time "no matching pattern" errors. - (apply throw 'match-error "match" args)) - ;; Support for record matching. +;; For backwards compatibility with previously-compiled files, keep the +;; old definition of "error" around. +(define (error _ . args) + (apply throw 'match-error "match" args)) +;; FIXME: In 3.1.x, use this new definition: +;; (define-syntax-rule (error where msg datum) +;; (throw 'match-error "match" msg datum)) + (define-syntax slot-ref (syntax-rules () ((_ rtd rec n) diff --git a/module/ice-9/match.upstream.scm b/module/ice-9/match.upstream.scm index 1983c1e3f..b1fc371b8 100644 --- a/module/ice-9/match.upstream.scm +++ b/module/ice-9/match.upstream.scm @@ -292,7 +292,7 @@ ;; Here we call error in non-tail context, so that the backtrace ;; can show the source location of the failing match form. (begin - (error 'match "no matching pattern" v) + (throw 'match-error "match" "no matching pattern" v) #f)) ;; named failure continuation ((match-next v g+s (pat (=> failure) . body) . rest)