aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2024-10-15 15:30:49 +0200
committerAndrea Corallo2024-10-15 22:13:08 +0200
commitcd739d3644be618008e5c369b4e96201a05a3d1b (patch)
treef52269c05330679eeb7d37176c7f637f9441f3cb
parent358b38bc17875c462c2131b9eeb85d3456c0be2b (diff)
downloademacs-cd739d3644be618008e5c369b4e96201a05a3d1b.tar.gz
emacs-cd739d3644be618008e5c369b4e96201a05a3d1b.zip
Fix comp branch-optim pass (bug#73270)
* test/src/comp-tests.el (comp-test-73270-1): Define new test. * test/src/comp-resources/comp-test-funcs.el (comp-test-73270-base) (comp-test-73270-child1, comp-test-73270-child2) (comp-test-73270-child3, comp-test-73270-child4) (comp-test-73270-1-f): Define. * lisp/emacs-lisp/comp-cstr.el (comp-cstr-type-p): Fix it for nil cstrs.
-rw-r--r--lisp/emacs-lisp/comp-cstr.el9
-rw-r--r--test/src/comp-resources/comp-test-funcs.el17
-rw-r--r--test/src/comp-tests.el4
3 files changed, 27 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 66c44f16835..b2eaf8cc423 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -950,9 +950,12 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
950 (if-let ((pred (get type 'cl-deftype-satisfies))) 950 (if-let ((pred (get type 'cl-deftype-satisfies)))
951 (and (null (range cstr)) 951 (and (null (range cstr))
952 (null (neg cstr)) 952 (null (neg cstr))
953 (and (or (null (typeset cstr)) 953 (if (null (typeset cstr))
954 (equal (typeset cstr) `(,type))) 954 (and (valset cstr)
955 (cl-every pred (valset cstr)))) 955 (cl-every pred (valset cstr)))
956 (when (equal (typeset cstr) `(,type))
957 ;; (valset cstr) can be nil as well.
958 (cl-every pred (valset cstr)))))
956 (error "Unknown predicate for type %s" type))))) 959 (error "Unknown predicate for type %s" type)))))
957 t)) 960 t))
958 961
diff --git a/test/src/comp-resources/comp-test-funcs.el b/test/src/comp-resources/comp-test-funcs.el
index 084fcd8c9db..87d3220f381 100644
--- a/test/src/comp-resources/comp-test-funcs.el
+++ b/test/src/comp-resources/comp-test-funcs.el
@@ -562,6 +562,23 @@
562(defun comp-test-67883-1-f () 562(defun comp-test-67883-1-f ()
563 '#1=(1 . #1#)) 563 '#1=(1 . #1#))
564 564
565(cl-defstruct comp-test-73270-base)
566(cl-defstruct
567 (comp-test-73270-child1 (:include comp-test-73270-base)))
568(cl-defstruct
569 (comp-test-73270-child2 (:include comp-test-73270-base)))
570(cl-defstruct
571 (comp-test-73270-child3 (:include comp-test-73270-base)))
572(cl-defstruct
573 (comp-test-73270-child4 (:include comp-test-73270-base)))
574
575(defun comp-test-73270-1-f (x)
576 (cl-typecase x
577 (comp-test-73270-child1 'child1)
578 (comp-test-73270-child2 'child2)
579 (comp-test-73270-child3 'child3)
580 (comp-test-73270-child4 'child4)))
581
565 582
566;;;;;;;;;;;;;;;;;;;; 583;;;;;;;;;;;;;;;;;;;;
567;; Tromey's tests ;; 584;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index dfeeaff05d8..487c95416ad 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -592,6 +592,10 @@ dedicated byte-op code."
592 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-11/msg00925.html>" 592 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-11/msg00925.html>"
593 (should-not (comp-test-67239-1-f))) 593 (should-not (comp-test-67239-1-f)))
594 594
595(comp-deftest comp-test-73270-1 ()
596 "<https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-09/msg00794.html>"
597 (should (eq (comp-test-73270-1-f (make-comp-test-73270-child4)) 'child4)))
598
595 599
596;;;;;;;;;;;;;;;;;;;;; 600;;;;;;;;;;;;;;;;;;;;;
597;; Tromey's tests. ;; 601;; Tromey's tests. ;;