From 011649a65433b216e21f7b4c40c08469891740b5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 2 Mar 2015 17:36:22 -0700 Subject: [PATCH] move contract submodules to start of enclosing module Putting the contract submodules early enough allows them to be used for `module*` submodules. Repairs a problem reported by Alexander: http://lists.racket-lang.org/users/archive/2015-March/066164.html --- typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt | 8 ++++---- typed-racket-test/succeed/unyuped-submod.rkt | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 typed-racket-test/succeed/unyuped-submod.rkt diff --git a/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt b/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt index 12039835..7bd25aff 100644 --- a/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt +++ b/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt @@ -420,8 +420,8 @@ (match-define (list from to) a) #`(add-alias (quote-syntax #,from) (quote-syntax #,to)))))) (begin-for-syntax (add-mod! (variable-reference->module-path-index - (#%variable-reference))))) - #`(begin + (#%variable-reference)))) + ;; FIXME: share this variable reference with the one below (define the-variable-reference (quote-module-name)) ;; Here we construct the redirector for the #%contract-defs @@ -471,8 +471,8 @@ (module* #%contract-defs #f (#%plain-module-begin #,extra-requires - new-defs ...)) - + new-defs ...))) + #`(begin ;; Now we create definitions that are actually provided ;; from the module itself. There are two levels of ;; indirection here (see the implementation in diff --git a/typed-racket-test/succeed/unyuped-submod.rkt b/typed-racket-test/succeed/unyuped-submod.rkt new file mode 100644 index 00000000..97eae92a --- /dev/null +++ b/typed-racket-test/succeed/unyuped-submod.rkt @@ -0,0 +1,6 @@ +#lang typed/racket/base +(provide x) +(define x : Integer 1) +(module* test racket/base + (require (submod "..")) + x)