diff --git a/collects/tests/racket/procs.rktl b/collects/tests/racket/procs.rktl index 933b359577..0d073c9c93 100644 --- a/collects/tests/racket/procs.rktl +++ b/collects/tests/racket/procs.rktl @@ -87,13 +87,17 @@ (test-values (list (caddr p) (cadddr p)) (lambda () (procedure-keywords (car p)))) - (let ([1-ok? (let loop ([a a]) - (or (equal? a 1) - (and (arity-at-least? a) - ((arity-at-least-value a) . <= . 1)) - (and (list? a) - (ormap loop a))))]) + (define (check-ok n a) + (let loop ([a a]) + (or (equal? a n) + (and (arity-at-least? a) + ((arity-at-least-value a) . <= . n)) + (and (list? a) + (ormap loop a))))) + (let ([1-ok? (check-ok 1 a)] + [0-ok? (check-ok 0 a)]) (test 1-ok? procedure-arity-includes? (car p) 1 #t) + (test 0-ok? procedure-arity-includes? (car p) 0 #t) ;; While we're here test renaming, etc.: (test 'other object-name (procedure-rename (car p) 'other)) (test (procedure-arity (car p)) procedure-arity (procedure-rename (car p) 'other)) @@ -293,6 +297,17 @@ (define (f2 #:x [x 8]) (list x)) (test 'f2 object-name f2)) +;; ---------------------------------------- +;; Check `procedure-arity-includes?' with method-style `prop:procedure' value +;; and `procedure-arity-reduce': + +(let () + (struct a () + #:property prop:procedure (procedure-reduce-arity + (lambda (x y [z 5]) (+ y z)) + 3)) + (test #t procedure-arity-includes? (a) 2)) + ;; ---------------------------------------- (report-errs) diff --git a/src/racket/src/fun.c b/src/racket/src/fun.c index aa3e484ae1..26daf28087 100644 --- a/src/racket/src/fun.c +++ b/src/racket/src/fun.c @@ -1977,7 +1977,7 @@ static Scheme_Object *get_or_check_arity(Scheme_Object *p, intptr_t a, Scheme_Ob if (a >= 0) { bign = scheme_make_integer(a); if (drop) - bign = scheme_bin_plus(bign, scheme_make_integer(a)); + bign = scheme_bin_plus(bign, scheme_make_integer(drop)); } if (a == -1) return clone_arity(((Scheme_Structure *)p)->slots[1], drop);