Look up unrenamed versions of type aliases as well.

Fixes bug reported by Alexander Knauth.
This commit is contained in:
Sam Tobin-Hochstadt 2015-03-06 12:13:40 -05:00
parent 7a67243d68
commit a3e25231a6
2 changed files with 14 additions and 3 deletions

View File

@ -1,8 +1,9 @@
#lang racket/base
(require "../utils/utils.rkt"
syntax/id-table racket/dict
(utils tc-utils)
syntax/id-table racket/dict
(utils tc-utils)
(typecheck renamer)
racket/match)
(provide register-type-alias
@ -33,7 +34,8 @@
(mapping-put! id (make-resolved ty)))
(define (lookup-type-alias id parse-type [k (lambda () (tc-error "Unknown type alias: ~a" (syntax-e id)))])
(match (free-id-table-ref the-mapping id #f)
(match (or (free-id-table-ref the-mapping id #f)
(free-id-table-ref the-mapping (un-rename id) #f))
[#f (k)]
[(struct unresolved (stx #f))
(resolve-type-alias id parse-type)]

View File

@ -0,0 +1,9 @@
#lang racket
(module m typed/racket
(provide x)
(define-type x 'x #:omit-define-syntaxes)
(define x : x 'x))
(module n typed/racket
(require (submod ".." m))
x ; works fine, outputs 'x
(define y : x x))