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