[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 21104e6: Fix `comp-mvar-symbol-p' and `comp-mvar-con
From: |
Andrea Corallo |
Subject: |
feature/native-comp 21104e6: Fix `comp-mvar-symbol-p' and `comp-mvar-cons-p' (bug#44968) |
Date: |
Mon, 30 Nov 2020 18:19:27 -0500 (EST) |
branch: feature/native-comp
commit 21104e6808a4496afb8163d92c6fb4d59e3010b7
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
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.
---
lisp/emacs-lisp/comp.el | 12 +++++++++---
test/src/comp-test-funcs.el | 10 ++++++++++
test/src/comp-tests.el | 4 ++++
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 498aae1..13f9beb 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -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.
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 207b645..5fa427b 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -380,6 +380,16 @@
it
nil)))
+(defun comp-test-44968-f (start end)
+ (let ((dirlist)
+ (dir (expand-file-name start))
+ (end (expand-file-name end)))
+ (while (not (or (equal dir (car dirlist))
+ (file-equal-p dir end)))
+ (push dir dirlist)
+ (setq dir (directory-file-name (file-name-directory dir))))
+ (nreverse dirlist)))
+
;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index dd97ccd..c2af52e 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -391,6 +391,10 @@
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
(should (string= (comp-test-42360-f "Nel mezzo del " 18 0 32 "yyy" nil)
"Nel mezzo del yyy")))
+(comp-deftest bug-44968 ()
+ "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-11/msg02357.html>"
+ (comp-test-44968-f "/tmp/test/foo" "/tmp"))
+
(defvar comp-test-primitive-advice)
(comp-deftest primitive-advice ()
"Test effectiveness of primitive advicing."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/native-comp 21104e6: Fix `comp-mvar-symbol-p' and `comp-mvar-cons-p' (bug#44968),
Andrea Corallo <=