aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/comp-tests.el
diff options
context:
space:
mode:
authorAndrea Corallo2024-02-28 20:47:57 +0100
committerAndrea Corallo2024-02-28 20:47:57 +0100
commit1fbe56c32761efdc8d268df80a97a9102d00e109 (patch)
tree8d8e76c8ae43c79ef9d76b0f97c12607567664b9 /test/src/comp-tests.el
parent6de60f33ed5cc438e20400aee83e1e2032773811 (diff)
parent05195e129fc933db32c9e08a155a94bfa4d75b54 (diff)
downloademacs-1fbe56c32761efdc8d268df80a97a9102d00e109.tar.gz
emacs-1fbe56c32761efdc8d268df80a97a9102d00e109.zip
Merge remote-tracking branch 'origin/master' into 'feature/type-hierarchy'
Diffstat (limited to 'test/src/comp-tests.el')
-rw-r--r--test/src/comp-tests.el25
1 files changed, 16 insertions, 9 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 8bfe939fb23..67d632823b2 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -904,16 +904,23 @@ Return a list of results."
904 (should (subr-native-elisp-p (symbol-function 'comp-tests-fw-prop-1-f))) 904 (should (subr-native-elisp-p (symbol-function 'comp-tests-fw-prop-1-f)))
905 (should (= (comp-tests-fw-prop-1-f) 6)))) 905 (should (= (comp-tests-fw-prop-1-f) 6))))
906 906
907(defun comp-tests--type-lists-equal (l1 l2)
908 (and (= (length l1) (length l2))
909 (cl-every #'comp-tests--types-equal l1 l2)))
910
907(defun comp-tests--types-equal (t1 t2) 911(defun comp-tests--types-equal (t1 t2)
908 "Whether the types T1 and T2 are equal." 912 "Whether the types T1 and T2 are equal."
909 (or (equal t1 t2) ; optimization for the common case 913 (or (equal t1 t2) ; for atoms, and optimization for the common case
910 (and (consp t1) (consp t2) 914 (and (consp t1) (consp t2)
911 (eq (car t1) (car t2)) 915 (eq (car t1) (car t2))
912 (if (memq (car t1) '(and or member)) 916 (cond ((memq (car t1) '(and or member))
913 (null (cl-set-exclusive-or (cdr t1) (cdr t2) 917 ;; Order or duplicates don't matter.
914 :test #'comp-tests--types-equal)) 918 (null (cl-set-exclusive-or (cdr t1) (cdr t2)
915 (and (= (length t1) (length t2)) 919 :test #'comp-tests--types-equal)))
916 (cl-every #'comp-tests--types-equal (cdr t1) (cdr t2))))))) 920 ((eq (car t1) 'function)
921 (and (comp-tests--type-lists-equal (nth 1 t1) (nth 1 t2))
922 (comp-tests--types-equal (nth 2 t1) (nth 2 t2))))
923 (t (comp-tests--type-lists-equal (cdr t1) (cdr t2)))))))
917 924
918(defun comp-tests-check-ret-type-spec (func-form ret-type) 925(defun comp-tests-check-ret-type-spec (func-form ret-type)
919 (let ((lexical-binding t) 926 (let ((lexical-binding t)