From 6daa4eb0b477b0284ce09bc4bf966588bd792ff2 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Wed, 16 May 1990 11:04:26 +0000
Subject: [PATCH] Fixed FIND-TEMPLATE to do what the comment said with
 :CONDITIONAL templates, and not try to test "result types" if the template is
 conditional but not in a conditional context.

---
 compiler/ltn.lisp | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/compiler/ltn.lisp b/compiler/ltn.lisp
index afd86ba14..1ef29fa9a 100644
--- a/compiler/ltn.lisp
+++ b/compiler/ltn.lisp
@@ -644,17 +644,18 @@
 	(let* ((cont (node-cont call))
 	       (atype (continuation-asserted-type cont))
 	       (dtype (node-derived-type call)))
-	  (when (or (and (eq (template-result-types template) :conditional)
-			 (let ((dest (continuation-dest cont)))
-			   (and (if-p dest)
-				(immediately-used-p (if-test dest) call))))
-		    (template-results-ok template dtype)
-		    (and (not (and (eq (template-policy template) :fast-safe)
-				   safe-p))
-			 (continuation-type-check cont)
-			 (template-results-ok template
-					      (values-type-intersection
-					       dtype atype))))
+	  (when (if (eq (template-result-types template) :conditional)
+		    (let ((dest (continuation-dest cont)))
+		      (and (if-p dest)
+			   (immediately-used-p (if-test dest) call)))
+		    (or (template-results-ok template dtype)
+			(and (or (not (eq (template-policy template)
+					  :fast-safe))
+				 (not safe-p))
+			     (continuation-type-check cont)
+			     (template-results-ok template
+						  (values-type-intersection
+						   dtype atype)))))
 	    (return (values template rejected (rest templates))))))
       (setq rejected template))))
 
-- 
GitLab