From 4d361187a2944fada659641e0fb5ee753ca9368c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 17 Jul 2019 17:05:15 -0600 Subject: [PATCH] add extra tests related to `procedure-reduce-arity` Related to #2746, but repair was at the Chez Scheme level, fixing a (currently) Racket-specific patch there. --- pkgs/racket-test-core/tests/racket/function.rktl | 14 ++++++++++++++ pkgs/racket-test-core/tests/racket/procs.rktl | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pkgs/racket-test-core/tests/racket/function.rktl b/pkgs/racket-test-core/tests/racket/function.rktl index 42d14d91c8..36b62177ab 100644 --- a/pkgs/racket-test-core/tests/racket/function.rktl +++ b/pkgs/racket-test-core/tests/racket/function.rktl @@ -265,4 +265,18 @@ (((curryr list 1) 2 3) . => . '(2 3 1)) ) +;; Regression test for arity checking and a large number of arguments +;; (thanks to James Bornholt) +(let () + (define extreme + (case-lambda + [(op x) x] + [(op x y) (if (op x y) x y)] + [(op x y . z) (apply extreme op (extreme op x y) z)])) + + (define @max (curry extreme >=)) + + (define l (for/list ([i 100]) 0)) + (test 0 apply @max l)) + (report-errs) diff --git a/pkgs/racket-test-core/tests/racket/procs.rktl b/pkgs/racket-test-core/tests/racket/procs.rktl index 25f0a3735c..3b804af04a 100644 --- a/pkgs/racket-test-core/tests/racket/procs.rktl +++ b/pkgs/racket-test-core/tests/racket/procs.rktl @@ -254,7 +254,10 @@ [(equal? allowed '(#:a #:b)) (err/rt-test ((car p) 1 #:a 1 #:b 1))] [(equal? allowed #f) - (err/rt-test ((car p) 1 #:a 1 #:b 1))]))))))) + (err/rt-test ((car p) 1 #:a 1 #:b 1))]))) + ;; Try supplying many arguments + (when (procedure-arity-includes? (car p) 100) + (test #t list? (apply (car p) (for/list ([i 100]) i)))))))) (map add-chaperone (append procs