diff --git a/module/oop/goops.scm b/module/oop/goops.scm index e4f51600e..ece03c6e0 100644 --- a/module/oop/goops.scm +++ b/module/oop/goops.scm @@ -1333,7 +1333,7 @@ function." #`(case-lambda #,@(build-clauses #'(arg ...)) (args (apply miss args))))))) - (arity-case (vector-length fv) 20 dispatch + (arity-case (1- (vector-length fv)) 20 dispatch (lambda args (let ((nargs (length args))) (if (< nargs (vector-length fv)) diff --git a/test-suite/tests/goops.test b/test-suite/tests/goops.test index 730aabb31..259eba84b 100644 --- a/test-suite/tests/goops.test +++ b/test-suite/tests/goops.test @@ -690,3 +690,14 @@ (class () (slot) #:name ' #:static-slot-allocation? #t)) (pass-if-equal "non-static subclass" '(a d) (map slot-definition-name (class-slots (class () (d) #:name ')))))) + +(with-test-prefix "dispatch" + (pass-if-equal "multi-arity dispatch" 0 + (eval '(begin + (define-method (dispatch (x ) . args) 0) + (dispatch 1) + (dispatch 1 2) + ;; By now "dispatch" is forced into multi-arity mode. Test + ;; that the multi-arity dispatcher works: + (dispatch 1 2 3)) + (current-module))))