emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp a5408d5: * lisp/emacs-lisp/comp.el (comp-common-supe


From: Andrea Corallo
Subject: feature/native-comp a5408d5: * lisp/emacs-lisp/comp.el (comp-common-supertype-2): Fix null intersection
Date: Sat, 7 Nov 2020 18:18:20 -0500 (EST)

branch: feature/native-comp
commit a5408d5715de5ee9b6858c6eb0638043f4cdb136
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * 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 9fbf60c..c837e02 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]