Add a dummy lambda expansion to signature compilation to ensure that the

expressions only refer to locally-bound names or names that are part of the
signature itself.

svn: r17573
This commit is contained in:
Stevie Strickland 2010-01-08 18:47:51 +00:00
parent 9e0f2a3c5f
commit ea20ee160f
2 changed files with 16 additions and 1 deletions

View File

@ -307,6 +307,7 @@
(with-syntax (((super-rtime ...) super-rtimes)
((super-name ...) super-names)
((var ...) all-bindings)
((ctc ...) all-ctcs)
((((vid ...) . vbody) ...) all-val-defs)
((((sid ...) . sbody) ...) all-stx-defs))
#`(begin
@ -333,7 +334,14 @@
(quote-syntax #,c))
#'#f))
all-ctcs))
(quote-syntax #,sigid))))))))
(quote-syntax #,sigid))))
(define-values ()
(begin
(λ (var ...)
(letrec-syntaxes+values
([(sid ...) sbody] ...) ([(vid ...) vbody] ...)
ctc ...))
(values)))))))
(else
(syntax-case (car sig-exprs) (define-values define-syntaxes contracted)
(x

View File

@ -103,6 +103,13 @@
(test-syntax-error "identifier not first part of pair after contracted in signature"
(define-signature x ((contracted [(-> number? number?) x]))))
(test-syntax-error "identifier h? not bound anywhere"
(module h?-test scheme
(define-signature s^
((define-values (f?) (values number?))
(define-syntaxes (g?) (make-rename-transformer #'number?))
(contracted [f (-> f? (and/c g? h?))])))))
(test-syntax-error "f not defined in unit exporting sig3"
(unit (import) (export sig3 sig4)
(define a #t)