From: Andrea Corallo Date: Sat, 7 Nov 2020 20:00:14 +0000 (+0100) Subject: * lisp/emacs-lisp/comp.el (comp-common-supertype-2): Fix null intersection X-Git-Tag: emacs-28.0.90~2727^2~340 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a5408d5715de5ee9b6858c6eb0638043f4cdb136;p=emacs.git * lisp/emacs-lisp/comp.el (comp-common-supertype-2): Fix null intersection --- 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."