units: Fix mistake in 86bb85931d that could cause compile-time failures

Specifically, if a contracted binding was applied as a function inside
another contract, it would lead to a syntax error.
This commit is contained in:
Alexis King 2019-03-19 14:21:11 -05:00
parent b471b18876
commit 8910ff0a39
2 changed files with 33 additions and 4 deletions

View File

@ -2276,3 +2276,30 @@
(define result (foo 1 2 3))))
(test 7 (dynamic-require ''m 'result)))
;; ----------------------------------------
;; Contracts that use other contracted bindings work when exporting through define-values/invoke-unit
(parameterize ([current-namespace (make-base-namespace)])
(eval
'(module m racket/base
(require racket/contract
racket/unit)
(provide g)
(define-signature a^
[(contracted
[f (-> integer? contract?)]
[g (f 10)])])
(define-unit a@
(import)
(export a^)
(define (f x) (>=/c x))
(define g 11))
(define-values/invoke-unit a@
(import)
(export a^))))
(test 11 (dynamic-require ''m 'g)))

View File

@ -51,10 +51,12 @@
member-table
i)))]
[(x . y)
(quote-syntax
(#,(add-ctc i (bound-identifier-mapping-get
member-table
i)) . y))])))])))
(quasisyntax
(#,(quote-syntax
#,(add-ctc i (bound-identifier-mapping-get
member-table
i)))
. y))])))])))
(define-syntax (unit-export stx)
(syntax-case stx ()