aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2024-09-26 16:40:54 -0400
committerStefan Monnier2024-09-26 16:40:54 -0400
commit4591d93a8e5e79e7fea8a67c84c6adf0ea8add28 (patch)
tree5cf1ac249cc4a260ae190e3e440016148465de19
parent37bed70f4c0a2e33de238eab90d7470d34366f13 (diff)
downloademacs-4591d93a8e5e79e7fea8a67c84c6adf0ea8add28.tar.gz
emacs-4591d93a8e5e79e7fea8a67c84c6adf0ea8add28.zip
* lisp/emacs-lisp/pcase.el (pcase--expand-\`): Improve warning message
And also move the warning "out of the way" so it doesn't confuse optimizations.
-rw-r--r--lisp/emacs-lisp/pcase.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index fe62820f0cb..898d460c144 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -1172,12 +1172,13 @@ The predicate is the logical-AND of:
1172 (upatd (pcase--expand-\` (cdr qpat)))) 1172 (upatd (pcase--expand-\` (cdr qpat))))
1173 (if (and (eq (car-safe upata) 'quote) (eq (car-safe upatd) 'quote)) 1173 (if (and (eq (car-safe upata) 'quote) (eq (car-safe upatd) 'quote))
1174 `'(,(cadr upata) . ,(cadr upatd)) 1174 `'(,(cadr upata) . ,(cadr upatd))
1175 `(and ,@(when (eq (car qpat) '\`) 1175 `(and (pred consp)
1176 `((guard ,(macroexp-warn-and-return
1177 "Nested ` are not supported" t nil nil qpat))))
1178 (pred consp)
1179 (app car-safe ,upata) 1176 (app car-safe ,upata)
1180 (app cdr-safe ,upatd))))) 1177 (app cdr-safe ,upatd)
1178 ,@(when (eq (car qpat) '\`)
1179 `((guard ,(macroexp-warn-and-return
1180 "Nested ` are not supported in Pcase patterns"
1181 t nil nil qpat))))))))
1181 ((or (stringp qpat) (numberp qpat) (symbolp qpat)) `',qpat) 1182 ((or (stringp qpat) (numberp qpat) (symbolp qpat)) `',qpat)
1182 ;; In all other cases just raise an error so we can't break 1183 ;; In all other cases just raise an error so we can't break
1183 ;; backward compatibility when adding \` support for other 1184 ;; backward compatibility when adding \` support for other