fixed bug in dependency checking for #:rest variables (and removed printfs)
This commit is contained in:
parent
8f6080733f
commit
d75536161c
|
@ -132,9 +132,10 @@ and then operates on it to generate the expanded form
|
|||
|
||||
;; no dups in the rest var
|
||||
(when (istx-rst istx)
|
||||
(when (rst-vars (istx-rst istx))
|
||||
(not-range-bound (rst-vars (istx-rst istx))))
|
||||
(no-var-dups (rst-var (istx-rst istx))))
|
||||
|
||||
|
||||
;; dependent arg variables are all bound, but not to a range variable
|
||||
(for ([an-arg (in-list (istx-args istx))])
|
||||
(let ([a-vars (arg-vars an-arg)])
|
||||
|
@ -154,14 +155,12 @@ and then operates on it to generate the expanded form
|
|||
[sp '()])
|
||||
|
||||
(define (link from to)
|
||||
(printf "linking ~s => ~s\n" from to)
|
||||
(set! sp (cons from sp))
|
||||
(free-identifier-mapping-put!
|
||||
neighbors from
|
||||
(cons to (free-identifier-mapping-get neighbors from (λ () '())))))
|
||||
|
||||
(define (no-links from)
|
||||
(printf "no links ~s\n" from)
|
||||
(set! sp (cons from sp))
|
||||
(free-identifier-mapping-put! neighbors from '()))
|
||||
|
||||
|
@ -181,11 +180,19 @@ and then operates on it to generate the expanded form
|
|||
(link (res-var a-res) nvar))]
|
||||
[else
|
||||
(no-links (res-var a-res))])))
|
||||
|
||||
(let ([a-rst (istx-rst istx)])
|
||||
(when a-rst
|
||||
(cond
|
||||
[(rst-vars a-rst)
|
||||
(for ([nvar (in-list (rst-vars a-rst))])
|
||||
(link (rst-var a-rst) nvar))]
|
||||
[else
|
||||
(no-links (rst-var a-rst))])))
|
||||
|
||||
(for ([var (in-list sp)])
|
||||
(let loop ([var var]
|
||||
[visited '()])
|
||||
(printf "var ~s\n" var)
|
||||
(cond
|
||||
[(free-identifier-mapping-get safe var (λ () #f))
|
||||
(void)]
|
||||
|
|
|
@ -65,6 +65,15 @@ test cases:
|
|||
any)
|
||||
; => unknown dependent variable
|
||||
|
||||
(->i ([x (y) number?])
|
||||
[y number?])
|
||||
; => domain cannot depend on a range variable
|
||||
|
||||
(->i ()
|
||||
#:rest [x (y) number?]
|
||||
[y number?])
|
||||
; => domain cannot depend on a range variable
|
||||
|
||||
(->i ([x (x) number?])
|
||||
any)
|
||||
; => cyclic dependencies not allowed
|
||||
|
@ -81,6 +90,11 @@ test cases:
|
|||
|
||||
;; => cyclic depenencies
|
||||
|
||||
(->i ()
|
||||
#:rest [x (x) number?]
|
||||
any)
|
||||
; => error cyclic dependencies
|
||||
|
||||
(->i ([x (y) number?]
|
||||
[y number?])
|
||||
any)
|
||||
|
@ -91,8 +105,10 @@ test cases:
|
|||
[y number?]))
|
||||
; => no syntax error
|
||||
|
||||
(->i ([x (y) number?])
|
||||
[y number?])
|
||||
; => domain cannot depend on a range variable
|
||||
(->i ()
|
||||
#:rest [x number?]
|
||||
[y (x) number?])
|
||||
;; => no syntax error
|
||||
|
||||
|
||||
|#
|
||||
|
|
Loading…
Reference in New Issue
Block a user