Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add support for multiple provides of the same identifier in TR. #105

Closed
wants to merge 1 commit into from

3 participants

@shekari

Closes PR 12807.

@samth
Collaborator

Now merged.

@elibarzilay elibarzilay closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 31, 2012
  1. @shekari
This page is out of date. Refresh to see the latest.
View
13 collects/tests/typed-racket/succeed/pr12807.rkt
@@ -0,0 +1,13 @@
+#lang racket/load
+(module a typed/racket
+ (define (foo x) (list x))
+ (provide
+ (rename-out (foo foo2))
+ foo))
+
+(module b racket
+ (require 'a)
+ (foo 2)
+ (foo2 3))
+
+(require 'b)
View
9 collects/typed-racket/typecheck/provide-handling.rkt
@@ -31,7 +31,7 @@
(cond [(s:member i vd (lambda (i j) (free-identifier=? i (binding-name j)))) => car]
[else #f]))
-;; generate-contract-defs : dict[id -> def-binding] dict[id -> id] id -> syntax
+;; generate-contract-defs : dict[id -> def-binding] dict[id -> list[id]] id -> syntax
;; defs: defines in this module
;; provs: provides in this module
;; pos-blame-id: a #%variable-reference for the module
@@ -119,6 +119,9 @@
;; otherwise, not defined in this module, not our problem
[else (values #'(begin) internal-id)]))
;; do-one : id id -> syntax
- (for/list ([(internal-id external-id) (in-dict provs)])
+ (for/list ([(internal-id external-ids) (in-dict provs)])
(define-values (defs id) (mk internal-id))
- #`(begin #,defs (provide (rename-out [#,id #,external-id])))))
+ (define provide-forms
+ (for/list ((external-id external-ids))
+ #`(rename-out [#,id #,external-id])))
+ #`(begin #,defs (provide #,@provide-forms))))
View
4 collects/typed-racket/typecheck/tc-toplevel.rkt
@@ -305,11 +305,11 @@
[i:id
(when (def-stx-binding? (dict-ref def-tbl #'i #f))
(set! syntax-provide? #t))
- (dict-set h #'i #'i)]
+ (dict-update h #'i (lambda (tail) (cons #'i tail)) '())]
[((~datum rename) in out)
(when (def-stx-binding? (dict-ref def-tbl #'in #f))
(set! syntax-provide? #t))
- (dict-set h #'in #'out)]
+ (dict-update h #'in (lambda (tail) (cons #'out tail)) '())]
[(name:unknown-provide-form . _)
(tc-error "provide: ~a not supported by Typed Racket" (syntax-e #'name.name))]
[_ (int-err "unknown provide form")])))]
Something went wrong with that request. Please try again.