mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 05:50:26 +02:00
Fix arity selection in compute-contification
* module/language/cps/contification.scm (compute-contification): Fail as soon as we see an arity with rest, optional, or keyword arguments. Fixes ((case-lambda ((a . b) #t) ((a b) #f)) 1 2).
This commit is contained in:
parent
6a59420a9d
commit
be564260be
1 changed files with 9 additions and 5 deletions
|
@ -84,11 +84,15 @@
|
||||||
|
|
||||||
;; Are the given args compatible with any of the arities?
|
;; Are the given args compatible with any of the arities?
|
||||||
(define (applicable? proc args)
|
(define (applicable? proc args)
|
||||||
(or-map (match-lambda
|
(let lp ((arities (assq-ref (map cons syms arities) proc)))
|
||||||
(($ $arity req () #f () #f)
|
(match arities
|
||||||
(= (length args) (length req)))
|
((($ $arity req () #f () #f) . arities)
|
||||||
(_ #f))
|
(or (= (length args) (length req))
|
||||||
(assq-ref (map cons syms arities) proc)))
|
(lp arities)))
|
||||||
|
;; If we reached the end of the arities, fail. Also fail if
|
||||||
|
;; the next arity in the list has optional, keyword, or rest
|
||||||
|
;; arguments.
|
||||||
|
(_ #f))))
|
||||||
|
|
||||||
;; If the use of PROC in continuation USE is a call to PROC that
|
;; If the use of PROC in continuation USE is a call to PROC that
|
||||||
;; is compatible with one of the procedure's arities, return the
|
;; is compatible with one of the procedure's arities, return the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue