]> git.eshelyaron.com Git - emacs.git/commit
Fix pcase 'rx' patterns with a single named submatch (bug#48477)
authorMattias Engdegård <mattiase@acm.org>
Tue, 18 May 2021 10:03:11 +0000 (12:03 +0200)
committerMattias Engdegård <mattiase@acm.org>
Tue, 18 May 2021 10:34:30 +0000 (12:34 +0200)
commitbe9db2b94d31a0afe3f93302558b3a78605244c7
treeed6b70146ad94da66d8390ad9c1179f1255580da
parented8c3303f945fbd2c16ece0e87d041c75ae05ff9
Fix pcase 'rx' patterns with a single named submatch (bug#48477)

pcase 'rx' patterns with a single named submatch, like

  (rx (let x "a"))

would always succeed because of an over-optimistic transformation.
Patterns with 0 or more than 1 named submatches were not affected.

Reported by Philipp Stephani.

* lisp/emacs-lisp/rx.el (rx--pcase-macroexpander):
Special case for a single named submatch.
* test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add tests.
lisp/emacs-lisp/rx.el
test/lisp/emacs-lisp/rx-tests.el