~ chicken-core (chicken-5) 2260b0b41519207d6872d57ecdb2e11430819c3f


commit 2260b0b41519207d6872d57ecdb2e11430819c3f
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Aug 27 22:25:12 2011 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sat Aug 27 22:25:12 2011 +0200

    yet another one: handle #!rest/#!optional marker for both candidates when merging argtypes

diff --git a/scrutinizer.scm b/scrutinizer.scm
index 41d4b7f6..16ab2938 100755
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -1103,7 +1103,7 @@
 		   (simplify (third t)))
 		  ((or)
 		   (let ((ts (map simplify (cdr t))))
-		     (cond ((= 1 (length ts)) (simplify (car ts)))
+		     (cond ((= 1 (length ts)) (car ts))
 			   ((every procedure-type? ts)
 			    (if (any (cut eq? 'procedure <>) ts)
 				'procedure
@@ -1201,6 +1201,8 @@
 		  ,(simplify-type `(or ,(cadr ts1) ,(cadr ts2)))
 		  ,@(merge-argument-types (cddr ts1) (cddr ts2))))
 	       (else '(#!rest))))	;XXX
+	((memq (car ts2) '(#!rest #!optional))
+	 (merge-argument-types ts2 ts1))
 	(else (cons (simplify-type `(or ,(car ts1) ,(car ts2)))
 		    (merge-argument-types (cdr ts1) (cdr ts2))))))
 
Trap