cs: fix applicable struct implemented with applicable struct

This commit is contained in:
Matthew Flatt 2020-03-13 11:14:11 -06:00
parent edfdcb0b6d
commit f1a177e880
2 changed files with 26 additions and 9 deletions

View File

@ -758,4 +758,21 @@
;; ----------------------------------------
(let ()
(struct a ()
#:property prop:procedure (lambda (a x)
(list a x)))
(define the-a (a))
(struct b ()
#:property prop:procedure the-a)
(define the-b (b))
(test (list the-a the-b) the-b)
(test 0 procedure-arity the-b))
;; ----------------------------------------
(report-errs)

View File

@ -132,15 +132,15 @@
orig-f
(and n-args (fx+ n-args 1))
(lambda (v)
(cond
[(not v) (case-lambda)]
[else
(case-lambda
[() (v f)]
[(a) (v f a)]
[(a b) (v f a b)]
[(a b c) (v f a b c)]
[args (chez:apply v f args)])]))
(let ([proc (case-lambda
[() (v f)]
[(a) (v f a)]
[(a b) (v f a b)]
[(a b c) (v f a b c)]
[args (chez:apply v f args)])])
(if success-k
(success-k proc)
proc)))
wrong-arity-wrapper)]))]))]
[else (fail-k orig-f)]))