fixes the "not used in definition context" error in define/contract

related to PR 12863, but doesn't solve the infinite loop problem
(cherry picked from commit 774e254f3c)
This commit is contained in:
Robby Findler 2012-07-19 19:54:02 -05:00 committed by Ryan Culpepper
parent 51712648c3
commit 61e890ba15
2 changed files with 11 additions and 3 deletions

View File

@ -799,8 +799,8 @@
(define-syntax (provide/contract stx)
(define s-l-c (syntax-local-context))
(case s-l-c
[(module-begin) ;; the case under discussion
#`(begin (define-values () (values)) ;; force us into the 'module' local context
[(module-begin)
#`(begin ;; force us into the 'module' local context
#,stx)]
[(module) ;; the good case
(true-provide/contract stx #f 'provide/contract)]

View File

@ -46,10 +46,18 @@
; ;
;
(define-syntax (define/contract stx)
(define s-l-c (syntax-local-context))
(case s-l-c
[(module-begin)
#`(begin #,stx)]
[else
(define/contract-expander stx)]))
;; (define/contract id contract expr)
;; defines `id' with `contract'; initially binding
;; it to the result of `expr'. These variables may not be set!'d.
(define-syntax (define/contract define-stx)
(define-for-syntax (define/contract-expander define-stx)
(define-splicing-syntax-class fv-clause
#:description "a free variable clause"
#:attributes ([var 1] [ctc 1])