1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 15:50:40 -08:00

Fix comp-mvar-symbol-p' and comp-mvar-cons-p' (bug#44968)

* lisp/emacs-lisp/comp.el (comp-mvar-symbol-p): As all slots into
	a `comp-cstr' are in or fix this logic.
	(comp-mvar-cons-p): Likewise.
	* test/src/comp-tests.el (bug-44968): New testcase.
	* test/src/comp-test-funcs.el (comp-test-44968-f): New test
	function.
This commit is contained in:
Andrea Corallo 2020-11-30 23:46:48 +01:00
parent 6523b84015
commit 21104e6808
3 changed files with 23 additions and 3 deletions

View file

@ -550,12 +550,18 @@ CFG is mutated by a pass.")
(defun comp-mvar-symbol-p (mvar)
"Return t if MVAR is certainly a symbol."
(or (equal (comp-mvar-typeset mvar) '(symbol))
(cl-every #'symbolp (comp-mvar-valset mvar))))
(and (null (comp-mvar-range mvar))
(or (and (null (comp-mvar-valset mvar))
(equal (comp-mvar-typeset mvar) '(symbol)))
(and (or (null (comp-mvar-typeset mvar))
(equal (comp-mvar-typeset mvar) '(symbol)))
(cl-every #'symbolp (comp-mvar-valset mvar))))))
(defsubst comp-mvar-cons-p (mvar)
"Return t if MVAR is certainly a cons."
(equal (comp-mvar-typeset mvar) '(cons)))
(and (null (comp-mvar-valset mvar))
(null (comp-mvar-range mvar))
(equal (comp-mvar-typeset mvar) '(cons))))
(defun comp-mvar-type-hint-match-p (mvar type-hint)
"Match MVAR against TYPE-HINT.