From a5408d5715de5ee9b6858c6eb0638043f4cdb136 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 7 Nov 2020 21:00:14 +0100 Subject: [PATCH] * lisp/emacs-lisp/comp.el (comp-common-supertype-2): Fix null intersection --- lisp/emacs-lisp/comp.el | 15 +++++++-------- 1 file 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." -- 2.39.5