mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +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?
|
||||
(define (applicable? proc args)
|
||||
(or-map (match-lambda
|
||||
(($ $arity req () #f () #f)
|
||||
(= (length args) (length req)))
|
||||
(_ #f))
|
||||
(assq-ref (map cons syms arities) proc)))
|
||||
(let lp ((arities (assq-ref (map cons syms arities) proc)))
|
||||
(match arities
|
||||
((($ $arity req () #f () #f) . arities)
|
||||
(or (= (length args) (length req))
|
||||
(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
|
||||
;; is compatible with one of the procedure's arities, return the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue