Fix up the contracts so that they properly refer to locally defined variables.
svn: r13527
This commit is contained in:
parent
12110acfe3
commit
8656e7e918
|
@ -602,7 +602,7 @@
|
||||||
(raise-stx-err "cannot export syntax from a unit" name))
|
(raise-stx-err "cannot export syntax from a unit" name))
|
||||||
(set-var-info-exported?! v loc)
|
(set-var-info-exported?! v loc)
|
||||||
(when (pair? (syntax-e ctc))
|
(when (pair? (syntax-e ctc))
|
||||||
(set-var-info-ctc! v (cdr (syntax-e ctc))))))
|
(set-var-info-ctc! v (localify (cdr (syntax-e ctc)) def-ctx)))))
|
||||||
(syntax->list (localify #'evars def-ctx))
|
(syntax->list (localify #'evars def-ctx))
|
||||||
(syntax->list #'elocs)
|
(syntax->list #'elocs)
|
||||||
(syntax->list #'ectcs))
|
(syntax->list #'ectcs))
|
||||||
|
|
|
@ -599,3 +599,29 @@
|
||||||
(unit/c (import) (export))
|
(unit/c (import) (export))
|
||||||
3)
|
3)
|
||||||
not-a-unit))
|
not-a-unit))
|
||||||
|
|
||||||
|
;; Adding a test to make sure that contracts can refer
|
||||||
|
;; to other parts of the signature.
|
||||||
|
|
||||||
|
(module m3 scheme
|
||||||
|
(define-signature toy-factory^
|
||||||
|
((contracted
|
||||||
|
[build-toys (-> integer? (listof toy?))]
|
||||||
|
[repaint (-> toy? symbol? toy?)]
|
||||||
|
[toy? (-> any/c boolean?)]
|
||||||
|
[toy-color (-> toy? symbol?)])))
|
||||||
|
|
||||||
|
(define-unit simple-factory@
|
||||||
|
(import)
|
||||||
|
(export toy-factory^)
|
||||||
|
|
||||||
|
(printf "Factory started.\n")
|
||||||
|
|
||||||
|
(define-struct toy (color) #:transparent)
|
||||||
|
|
||||||
|
(define (build-toys n)
|
||||||
|
(for/list ([i (in-range n)])
|
||||||
|
(make-toy 'blue)))
|
||||||
|
|
||||||
|
(define (repaint t col)
|
||||||
|
(make-toy col))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user