diff --git a/scrutinizer.scm b/scrutinizer.scm index ece07ed..5fc6524 100644 --- a/scrutinizer.scm +++ b/scrutinizer.scm @@ -969,7 +969,9 @@ (or (eq? '#!optional t) (match1 rtype t))) head) - (match1 rtype (if (pair? tail) (rest-type (cdr tail)) '*))))) + (if (pair? tail) + (match1 rtype (rest-type (cdr tail))) + #t)))) (define (optargs? a) (memq a '(#!rest #!optional))) diff --git a/tests/scrutinizer-tests.scm b/tests/scrutinizer-tests.scm index ed313a4..da4fa4f 100644 --- a/tests/scrutinizer-tests.scm +++ b/tests/scrutinizer-tests.scm @@ -240,6 +240,26 @@ (test (! (procedure () x) (procedure ()))) (test (! (procedure () x) (procedure () x y))) + +(test (<= (procedure (#!rest x) *) + (procedure (x x) *))) +(test (<= (procedure (x #!rest x) *) + (procedure (x x) *))) +(test (<= (procedure (x x #!rest x) *) + (procedure (x x) *))) +(test (not (<= (procedure (#!rest x) *) + (procedure (x y) *)))) +(test (<= (procedure (#!rest (or x y)) *) + (procedure (x y) *))) +(test (<= (procedure (x #!rest y) *) + (procedure (x y) *))) + +(test (<= (procedure (#!rest x) *) + (procedure (#!rest x) *))) +(test (<= (procedure (#!rest x) *) + (procedure (x #!rest x) *))) +(test (<= (procedure (#!rest (or x y)) *) + (procedure (y #!rest x) *))) ;; s.a. ;(test (? (procedure () x) (procedure () x . y)))