summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-11-07 21:00:14 +0100
committerAndrea Corallo <akrl@sdf.org>2020-11-07 21:11:39 +0100
commita5408d5715de5ee9b6858c6eb0638043f4cdb136 (patch)
tree4ab98d7bdb4cfbb3c459ff319ef18bd053ded152 /lisp/emacs-lisp/comp.el
parent04a073f4bf1cc31a3a2606468b0e017b69d7ff39 (diff)
downloademacs-a5408d5715de5ee9b6858c6eb0638043f4cdb136.tar.gz
emacs-a5408d5715de5ee9b6858c6eb0638043f4cdb136.tar.bz2
emacs-a5408d5715de5ee9b6858c6eb0638043f4cdb136.zip
* lisp/emacs-lisp/comp.el (comp-common-supertype-2): Fix null intersection
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r--lisp/emacs-lisp/comp.el15
1 files changed, 7 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 9fbf60c96c2..c837e020603 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2155,14 +2155,13 @@ PRE-LAMBDA and POST-LAMBDA are called in pre or post-order if non-nil."
(defun comp-common-supertype-2 (type1 type2)
"Return the first common supertype of TYPE1 TYPE2."
- (car (cl-reduce (lambda (x y)
- (if (> (cdr x) (cdr y))
- x
- y))
- (cl-intersection
- (comp-supertypes type1)
- (comp-supertypes type2)
- :key #'car))))
+ (when-let ((types (cl-intersection
+ (comp-supertypes type1)
+ (comp-supertypes type2)
+ :key #'car)))
+ (car (cl-reduce (lambda (x y)
+ (if (> (cdr x) (cdr y)) x y))
+ types))))
(defun comp-common-supertype (&rest types)
"Return the first common supertype of TYPES."