Prevent type alias placeholders from collapsing in unions with symbols

Fixes #26
This commit is contained in:
Alexis King 2015-02-15 13:11:56 -08:00 committed by Asumu Takikawa
parent d0a7c911df
commit 619d6945c3
3 changed files with 18 additions and 2 deletions

View File

@ -90,8 +90,8 @@
(register-type-name
id
(if args
(make-Poly (map syntax-e args) (make-Value (gensym)))
(make-Value (gensym))))
(make-Poly (map syntax-e args) -Alias-Placeholder)
-Alias-Placeholder))
(values id (list id type-stx args))))
;; register-all-type-aliases : Listof<Id> Dict<Id, TypeAliasInfo> -> Void

View File

@ -6,6 +6,7 @@
;; extends it with more types and type abbreviations.
(require "../utils/utils.rkt"
"../utils/tc-utils.rkt"
(rep type-rep filter-rep object-rep rep-utils)
(env mvar-env)
racket/match racket/list (prefix-in c: (contract-req))
@ -52,6 +53,11 @@
(define/decl -Symbol (make-Base 'Symbol #'symbol? symbol? #f))
(define/decl -String (make-Base 'String #'string? string? #f))
;; Used by type-alias-helper.rkt for recursive alias placeholder values
(define/decl -Alias-Placeholder (make-Base 'Alias-Placeholder
#'(int-err "Encountered unresolved alias placeholder")
(lambda _ #f) #f))
;; Void is needed for Params
(define/decl -Void (make-Base 'Void #'void? void? #f))

View File

@ -0,0 +1,10 @@
#lang typed/racket
(define-type T1 (Listof (U T2 Symbol)))
(define-type T2 (Setof (U T1 Symbol)))
(: x1 T1)
(define x1 (list (set 'foo)))
(: x2 T2)
(define x2 (set (list 'foo)))