summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/pcase.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2024-09-24 14:01:26 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2024-09-24 14:01:26 -0400
commite8f5df5175170d36f526e46b63b3d428bb9a8950 (patch)
tree14d3b8ebf4c282f5157ab84f11012dff8d8368d4 /lisp/emacs-lisp/pcase.el
parentce601de1cafa65d6e6f5ba52e9c794873d164fbd (diff)
downloademacs-e8f5df5175170d36f526e46b63b3d428bb9a8950.tar.gz
emacs-e8f5df5175170d36f526e46b63b3d428bb9a8950.tar.bz2
emacs-e8f5df5175170d36f526e46b63b3d428bb9a8950.zip
Declare nested backquotes unsupported in Pcase patterns (bug#72328)
The current behavior is inconsistent with that of the normal backquote macro, so to avoid surprises, warn about the use of nested backquotes. * lisp/emacs-lisp/pcase.el (pcase--expand-\`): Warn about nested backquotes. * lisp/emacs-lisp/testcover.el (testcover-analyze-coverage) (testcover-analyze-coverage-wrapped-form): Avoid nested backquotes
Diffstat (limited to 'lisp/emacs-lisp/pcase.el')
-rw-r--r--lisp/emacs-lisp/pcase.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index fd6b0c8db5c..fe62820f0cb 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -1172,7 +1172,10 @@ The predicate is the logical-AND of:
(upatd (pcase--expand-\` (cdr qpat))))
(if (and (eq (car-safe upata) 'quote) (eq (car-safe upatd) 'quote))
`'(,(cadr upata) . ,(cadr upatd))
- `(and (pred consp)
+ `(and ,@(when (eq (car qpat) '\`)
+ `((guard ,(macroexp-warn-and-return
+ "Nested ` are not supported" t nil nil qpat))))
+ (pred consp)
(app car-safe ,upata)
(app cdr-safe ,upatd)))))
((or (stringp qpat) (numberp qpat) (symbolp qpat)) `',qpat)