diff --git a/collects/compiler/zo-marshal.rkt b/collects/compiler/zo-marshal.rkt index e9403b252c..0e219725fb 100644 --- a/collects/compiler/zo-marshal.rkt +++ b/collects/compiler/zo-marshal.rkt @@ -970,7 +970,9 @@ (let* ([l (protect-quote body)] [any-refs? (or (ormap (lambda (t) (memq t '(ref flonum))) param-types) (ormap (lambda (t) (memq t '(flonum))) closure-types))] - [num-all-params ((if rest? add1 values) num-params)] + [num-all-params (if (and rest? (not (memq 'only-rest-arg-not-used flags))) + (add1 num-params) + num-params)] [l (cons (make-svector (if any-refs? (list->vector (append diff --git a/collects/compiler/zo-parse.rkt b/collects/compiler/zo-parse.rkt index e6e677700e..cf00f05ce9 100644 --- a/collects/compiler/zo-parse.rkt +++ b/collects/compiler/zo-parse.rkt @@ -117,8 +117,11 @@ (append (if (zero? (bitwise-and flags flags CLOS_PRESERVES_MARKS)) null '(preserves-marks)) (if (zero? (bitwise-and flags flags CLOS_IS_METHOD)) null '(is-method)) - (if (zero? (bitwise-and flags flags CLOS_SINGLE_RESULT)) null '(single-result))) - ((if rest? sub1 values) num-params) + (if (zero? (bitwise-and flags flags CLOS_SINGLE_RESULT)) null '(single-result)) + (if (and rest? (zero? num-params)) '(only-rest-arg-not-used) null)) + (if (and rest? (num-params . > . 0)) + (sub1 num-params) + num-params) arg-types rest? (if (= closure-size (vector-length closed-over)) diff --git a/collects/compiler/zo-structs.rkt b/collects/compiler/zo-structs.rkt index 4aba9f8ded..1e62a623d7 100644 --- a/collects/compiler/zo-structs.rkt +++ b/collects/compiler/zo-structs.rkt @@ -135,8 +135,8 @@ [internal-context (or/c #f #t stx?)])) (define-form-struct (lam expr) ([name (or/c symbol? vector? empty?)] - [flags (listof (or/c 'preserves-marks 'is-method 'single-result))] - [num-params integer?] ; should be exact-nonnegative-integer? + [flags (listof (or/c 'preserves-marks 'is-method 'single-result 'only-rest-arg-not-used))] + [num-params exact-nonnegative-integer?] [param-types (listof (or/c 'val 'ref 'flonum))] [rest? boolean?] [closure-map (vectorof exact-nonnegative-integer?)]