Replace uses of Type? with Type/c?.
original commit: f315880b50564180a80de561f6fcd2e55a75e69e
This commit is contained in:
parent
c21fbc4aac
commit
106b3a98cf
6
collects/typed-racket/env/global-env.rkt
vendored
6
collects/typed-racket/env/global-env.rkt
vendored
|
@ -16,7 +16,7 @@
|
|||
check-all-registered-types
|
||||
type-env-map)
|
||||
|
||||
(lazy-require ["../rep/type-rep.rkt" (Type? type-equal?)])
|
||||
(lazy-require ["../rep/type-rep.rkt" (Type/c? type-equal?)])
|
||||
|
||||
;; free-id-table from id -> type or Box[type]
|
||||
;; where id is a variable, and type is the type of the variable
|
||||
|
@ -32,7 +32,7 @@
|
|||
(cond [(free-id-table-ref the-mapping id (lambda _ #f))
|
||||
=> (lambda (e)
|
||||
(define t (if (box? e) (unbox e) e))
|
||||
(unless (and (Type? t) (type-equal? t type))
|
||||
(unless (and (Type/c? t) (type-equal? t type))
|
||||
(tc-error/expr #:stx id "Duplicate type annotation of ~a for ~a, previous was ~a" type (syntax-e id) t))
|
||||
(when (box? e)
|
||||
(free-id-table-set! the-mapping id t)))]
|
||||
|
@ -46,7 +46,7 @@
|
|||
=>
|
||||
(λ (t) ;; it's ok to annotate with the same type
|
||||
(define t* (if (box? t) (unbox t) t))
|
||||
(unless (and (Type? t*) (type-equal? type t*))
|
||||
(unless (and (Type/c? t*) (type-equal? type t*))
|
||||
(void (tc-error/expr #:stx id "Duplicate type annotation of ~a for ~a, previous was ~a" type (syntax-e id) t*))))]
|
||||
[else (free-id-table-set! the-mapping id (box type))]))
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
#:literals (t:Class t:Refinement t:Instance t:List t:List* cons t:pred t:-> : case-lambda t:case->
|
||||
t:Rec t:U t:All t:Opaque t:Parameter t:Vector quote t:Struct)
|
||||
[t
|
||||
#:declare t (3d Type?)
|
||||
#:declare t (3d Type/c?)
|
||||
(attribute t.datum)]
|
||||
[(fst . rst)
|
||||
#:fail-unless (not (syntax->list #'rst)) #f
|
||||
|
|
|
@ -758,8 +758,8 @@
|
|||
Mu-unsafe: Poly-unsafe:
|
||||
PolyDots-unsafe:
|
||||
Mu? Poly? PolyDots?
|
||||
Type? Filter? Object?
|
||||
Type/c
|
||||
Filter? Object?
|
||||
Type/c Type/c?
|
||||
Poly-n
|
||||
PolyDots-n
|
||||
free-vars*
|
||||
|
|
|
@ -102,23 +102,23 @@
|
|||
(unless (for/and ([t t1] [s t2]) (subtype t s))
|
||||
(tc-error/expr "Expected ~a, but got ~a" (stringify t2) (stringify t1)))
|
||||
expected]
|
||||
[((tc-result1: t1 f o) (? Type? t2))
|
||||
[((tc-result1: t1 f o) (? Type/c? t2))
|
||||
(unless (subtype t1 t2)
|
||||
(tc-error/expr "Expected ~a, but got ~a" t2 t1))
|
||||
(ret t2 f o)]
|
||||
[((? Type? t1) (tc-result1: t2 (FilterSet: (list) (list)) (Empty:)))
|
||||
[((? Type/c? t1) (tc-result1: t2 (FilterSet: (list) (list)) (Empty:)))
|
||||
(unless (subtype t1 t2)
|
||||
(tc-error/expr "Expected ~a, but got ~a" t2 t1))
|
||||
t1]
|
||||
[((? Type? t1) (tc-result1: t2 f o))
|
||||
[((? Type/c? t1) (tc-result1: t2 f o))
|
||||
(if (subtype t1 t2)
|
||||
(tc-error/expr "Expected result with filter ~a and ~a, got ~a" f (print-object o) t1)
|
||||
(tc-error/expr "Expected ~a, but got ~a" t2 t1))
|
||||
t1]
|
||||
[((? Type? t1) (tc-results: ts2 fs os))
|
||||
[((? Type/c? t1) (tc-results: ts2 fs os))
|
||||
(tc-error/expr "Expected one value, but got ~a" (length ts2))
|
||||
t1]
|
||||
[((? Type? t1) (? Type? t2))
|
||||
[((? Type/c? t1) (? Type/c? t2))
|
||||
(unless (subtype t1 t2)
|
||||
(tc-error/expr "Expected ~a, but got ~a" t2 t1))
|
||||
expected]
|
||||
|
|
|
@ -342,12 +342,12 @@
|
|||
;; rec types, applications and names (that aren't the same)
|
||||
[((? needs-resolving? s) other)
|
||||
(let ([s* (resolve-once s)])
|
||||
(if (Type? s*) ;; needed in case this was a name that hasn't been resolved yet
|
||||
(if (Type/c? s*) ;; needed in case this was a name that hasn't been resolved yet
|
||||
(subtype* A0 s* other)
|
||||
(fail! s t)))]
|
||||
[(other (? needs-resolving? t))
|
||||
(let ([t* (resolve-once t)])
|
||||
(if (Type? t*) ;; needed in case this was a name that hasn't been resolved yet
|
||||
(if (Type/c? t*) ;; needed in case this was a name that hasn't been resolved yet
|
||||
(subtype* A0 other t*)
|
||||
(fail! s t)))]
|
||||
;; for unions, we check the cross-product
|
||||
|
@ -426,7 +426,7 @@
|
|||
[((Prompt-Tagof: _ _) (Prompt-TagTop:)) A0]
|
||||
[((Continuation-Mark-Keyof: _) (Continuation-Mark-KeyTop:)) A0]
|
||||
;; subtyping on structs follows the declared hierarchy
|
||||
[((Struct: nm (? Type? parent) _ _ _ _) other)
|
||||
[((Struct: nm (? Type/c? parent) _ _ _ _) other)
|
||||
;(dprintf "subtype - hierarchy : ~a ~a ~a\n" nm parent other)
|
||||
(subtype* A0 parent other)]
|
||||
;; subtyping on values is pointwise
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
(case-lambda [(t)
|
||||
(let ([mk (lambda (t) (make-FilterSet (make-Top) (make-Top)))])
|
||||
(make-tc-results
|
||||
(cond [(Type? t)
|
||||
(cond [(Type/c? t)
|
||||
(list (make-tc-result t (mk t) (make-Empty)))]
|
||||
[else
|
||||
(for/list ([i t])
|
||||
|
@ -65,7 +65,7 @@
|
|||
#f))]
|
||||
[(t f)
|
||||
(make-tc-results
|
||||
(if (Type? t)
|
||||
(if (Type/c? t)
|
||||
(list (make-tc-result t f (make-Empty)))
|
||||
(for/list ([i t] [f f])
|
||||
(make-tc-result i f (make-Empty))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user