Replaced references to abbrev.rkt with convenience.rkt.
Skipped this for subtype.rkt, because of a require loop caused by lazy-require. original commit: 6dbc054e41af5820ceda8a50508ccf43c51ab7ed
This commit is contained in:
parent
13b06ee19a
commit
a81b666a5e
|
@ -4,7 +4,7 @@
|
|||
"../utils/utils.rkt"
|
||||
(for-template racket/base racket/list racket/unsafe/ops racket/flonum)
|
||||
(utils tc-utils)
|
||||
(rename-in (types union convenience abbrev numeric-tower) [-Number N] [-Boolean B] [-Symbol Sym]))
|
||||
(rename-in (types union convenience) [-Number N] [-Boolean B] [-Symbol Sym]))
|
||||
|
||||
(provide indexing)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
(require
|
||||
(rename-in "../utils/utils.rkt" [infer r:infer])
|
||||
(types abbrev numeric-tower) (env init-envs) (r:infer infer-dummy infer)
|
||||
(types convenience) (env init-envs) (r:infer infer-dummy infer)
|
||||
"base-env-indexing-abs.rkt")
|
||||
|
||||
(define e (parameterize ([infer-param infer]) (indexing -Integer)))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
racket/list racket/math racket/flonum racket/unsafe/ops
|
||||
(for-template racket/flonum racket/fixnum racket/math racket/unsafe/ops racket/base
|
||||
(only-in "../types/numeric-predicates.rkt" index?))
|
||||
(only-in (types abbrev numeric-tower) [-Number N] [-Boolean B] [-Symbol Sym] [-Real R] [-PosInt -Pos]))
|
||||
(only-in (types convenience) [-Number N] [-Boolean B] [-Symbol Sym] [-Real R] [-PosInt -Pos]))
|
||||
|
||||
;; TODO having definitions only at the top is really inconvenient.
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
(only-in racket/match/runtime match:error matchable? match-equality-test))
|
||||
racket/file
|
||||
(only-in racket/private/pre-base new-apply-proc)
|
||||
(only-in (types abbrev numeric-tower) [-Number N] [-Boolean B] [-Symbol Sym])
|
||||
(only-in (types convenience) [-Number N] [-Boolean B] [-Symbol Sym])
|
||||
(only-in (rep type-rep)
|
||||
make-MPairTop
|
||||
make-BoxTop make-ChannelTop make-VectorTop
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
;; I don't understand this at all. :(
|
||||
;; -- STH, 6/26/12
|
||||
(require (for-syntax "../env/global-env.rkt"))
|
||||
(require "../types/abbrev.rkt" "../types/convenience.rkt" "../types/numeric-tower.rkt"
|
||||
"../rep/type-rep.rkt")
|
||||
(require "../types/convenience.rkt" "../rep/type-rep.rkt")
|
||||
|
||||
[Complex -Number]
|
||||
[Number -Number]
|
||||
|
|
14
collects/typed-racket/env/init-envs.rkt
vendored
14
collects/typed-racket/env/init-envs.rkt
vendored
|
@ -3,15 +3,15 @@
|
|||
(require "../utils/utils.rkt"
|
||||
"../utils/tc-utils.rkt"
|
||||
"global-env.rkt"
|
||||
"type-name-env.rkt"
|
||||
"type-alias-env.rkt"
|
||||
"type-name-env.rkt"
|
||||
"type-alias-env.rkt"
|
||||
(rep type-rep object-rep filter-rep rep-utils)
|
||||
(for-template (rep type-rep object-rep filter-rep)
|
||||
(types union numeric-tower)
|
||||
racket/shared racket/base)
|
||||
(types union convenience)
|
||||
(for-template (rep type-rep object-rep filter-rep)
|
||||
(types union convenience)
|
||||
racket/shared racket/base)
|
||||
(types union convenience)
|
||||
racket/syntax
|
||||
mzlib/pconvert racket/match)
|
||||
mzlib/pconvert racket/match)
|
||||
|
||||
(define (initialize-type-name-env initial-type-names)
|
||||
(for-each (lambda (nm/ty) (register-resolved-type-alias (car nm/ty) (cadr nm/ty))) initial-type-names))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
(require "../utils/utils.rkt")
|
||||
(require (rep type-rep)
|
||||
(types utils union subtype remove-intersect resolve substitute abbrev)
|
||||
(types utils union subtype remove-intersect resolve substitute)
|
||||
"signatures.rkt"
|
||||
racket/match)
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
;; NEW IMPL
|
||||
;; restrict t1 to be a subtype of t2
|
||||
;; if `f' is 'new, use t2 when giving up, otherwise use t1
|
||||
(define (restrict* t1 t2 [f 'new])
|
||||
(define (restrict* t1 t2 [f 'new])
|
||||
(cond
|
||||
[(subtype t1 t2) t1] ;; already a subtype
|
||||
[(match t2
|
||||
|
@ -34,5 +34,5 @@
|
|||
[(subtype t2 t1) t2] ;; we don't actually want this - want something that's a part of t1
|
||||
[(not (overlap t1 t2)) (Un)] ;; there's no overlap, so the restriction is empty
|
||||
[else (if (eq? f 'new) t2 t1)])) ;; t2 and t1 have a complex relationship, so we punt
|
||||
|
||||
|
||||
(define restrict restrict*)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"../utils/utils.rkt"
|
||||
(utils tc-utils)
|
||||
(rep type-rep)
|
||||
(types abbrev utils type-table)
|
||||
(types convenience utils type-table)
|
||||
(optimizer utils logging)
|
||||
(for-template racket/base racket/unsafe/ops))
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
(for-template racket/base racket/unsafe/ops)
|
||||
"../utils/utils.rkt" "../utils/tc-utils.rkt"
|
||||
(rep type-rep)
|
||||
(types abbrev type-table utils)
|
||||
(types convenience type-table utils)
|
||||
(optimizer utils logging string
|
||||
float)) ; for int-expr
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(for-template racket/base racket/unsafe/ops)
|
||||
"../utils/utils.rkt"
|
||||
(utils tc-utils)
|
||||
(types abbrev)
|
||||
(types convenience)
|
||||
(optimizer utils logging))
|
||||
|
||||
(provide string-opt-expr string-expr bytes-expr)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
(utils tc-utils require-contract)
|
||||
(env type-name-env)
|
||||
(types resolve utils)
|
||||
(prefix-in t: (types convenience abbrev))
|
||||
(prefix-in t: (types convenience))
|
||||
(private parse-type)
|
||||
racket/match unstable/match syntax/struct syntax/stx racket/syntax racket/list
|
||||
(only-in racket/contract -> ->* case-> cons/c flat-rec-contract provide/contract any/c)
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
"infer/infer.rkt"
|
||||
"utils/tc-utils.rkt"
|
||||
"types/utils.rkt"
|
||||
"types/convenience.rkt"
|
||||
"types/abbrev.rkt")
|
||||
"types/convenience.rkt")
|
||||
->)
|
||||
(except-in (path-up "utils/utils.rkt") infer))
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"check-below.rkt" "tc-subst.rkt"
|
||||
(utils tc-utils)
|
||||
(rep type-rep object-rep)
|
||||
(types utils union abbrev subtype))
|
||||
(types utils union convenience subtype))
|
||||
|
||||
(provide (all-defined-out))
|
||||
|
||||
|
|
|
@ -15,10 +15,9 @@
|
|||
;; end fixme
|
||||
(for-syntax syntax/parse racket/base (utils tc-utils))
|
||||
(private type-annotation)
|
||||
(types utils abbrev union subtype resolve convenience
|
||||
(types utils union subtype resolve convenience
|
||||
type-table substitute generalize)
|
||||
(utils tc-utils)
|
||||
(only-in srfi/1 alist-delete)
|
||||
(except-in (env type-env-structs tvar-env index-env) extend)
|
||||
(rep type-rep filter-rep object-rep rep-utils)
|
||||
(r:infer infer)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
racket/match racket/list
|
||||
(for-syntax (utils tc-utils))
|
||||
(private type-annotation)
|
||||
(types utils abbrev union subtype resolve convenience type-table substitute)
|
||||
(types utils union subtype resolve convenience type-table substitute)
|
||||
(utils tc-utils)
|
||||
(only-in srfi/1 alist-delete)
|
||||
(except-in (env type-env-structs tvar-env index-env) extend)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
;; end fixme
|
||||
(for-syntax syntax/parse racket/base (utils tc-utils))
|
||||
(private type-annotation)
|
||||
(types utils abbrev union subtype resolve convenience type-table
|
||||
(types utils union subtype resolve convenience type-table
|
||||
substitute)
|
||||
(utils tc-utils)
|
||||
(except-in (env type-env-structs tvar-env index-env) extend)
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
(require (rename-in "../utils/utils.rkt" [infer r:infer])
|
||||
"signatures.rkt" "check-below.rkt"
|
||||
(rep type-rep filter-rep object-rep)
|
||||
(rename-in (types convenience subtype union utils remove-intersect abbrev filter-ops)
|
||||
[remove *remove])
|
||||
(types convenience subtype union utils filter-ops)
|
||||
(env lexical-env type-env-structs)
|
||||
(r:infer infer)
|
||||
(utils tc-utils)
|
||||
(utils tc-utils)
|
||||
"tc-envops.rkt" "tc-metafunctions.rkt"
|
||||
(types type-table)
|
||||
syntax/kerncase
|
||||
|
|
|
@ -12,9 +12,8 @@
|
|||
(rename-in (types convenience utils union)
|
||||
[make-arr* make-arr])
|
||||
(private type-annotation)
|
||||
(types abbrev utils)
|
||||
(env type-env-structs lexical-env tvar-env index-env)
|
||||
(utils tc-utils)
|
||||
(env type-env-structs lexical-env tvar-env index-env)
|
||||
(utils tc-utils)
|
||||
|
||||
racket/match)
|
||||
(require (for-template racket/base "internal-forms.rkt"))
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#lang racket/base
|
||||
|
||||
(require "../utils/utils.rkt"
|
||||
(except-in (rep type-rep free-variance) Dotted)
|
||||
(except-in (rep type-rep free-variance) Dotted)
|
||||
(private parse-type)
|
||||
(types convenience utils union resolve abbrev substitute type-table)
|
||||
(env global-env type-env-structs type-name-env tvar-env)
|
||||
(utils tc-utils)
|
||||
(types convenience utils union resolve substitute type-table)
|
||||
(env global-env type-env-structs type-name-env tvar-env)
|
||||
(utils tc-utils)
|
||||
"def-binding.rkt"
|
||||
syntax/kerncase
|
||||
syntax/struct
|
||||
syntax/struct
|
||||
racket/function
|
||||
racket/match
|
||||
(only-in racket/contract
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
[(Values: (list (Result: t _ _))) (list t)]
|
||||
[_ (list t)]))
|
||||
|
||||
;; TODO make this file depend on union.rkt, and use the real Union constructor.
|
||||
;; Simple union constructor.
|
||||
;; Flattens nested unions and sorts types, but does not check for
|
||||
;; overlapping subtypes.
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
(require "../utils/utils.rkt"
|
||||
(rep type-rep filter-rep object-rep rep-utils)
|
||||
(utils tc-utils) (only-in (infer infer) restrict)
|
||||
"abbrev.rkt" (only-in racket/contract current-blame-format [-> -->] listof)
|
||||
(types printer union subtype utils remove-intersect)
|
||||
(only-in racket/contract [-> -->] listof)
|
||||
(types union subtype utils remove-intersect convenience)
|
||||
racket/list racket/match
|
||||
(for-syntax syntax/parse racket/base)
|
||||
syntax/id-table racket/dict
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
(require "../utils/utils.rkt"
|
||||
(rep type-rep filter-rep object-rep rep-utils)
|
||||
(utils tc-utils)
|
||||
(only-in racket/contract current-blame-format)
|
||||
"abbrev.rkt" "numeric-tower.rkt" "subtype.rkt" "substitute.rkt" "union.rkt"
|
||||
"convenience.rkt" "subtype.rkt" "substitute.rkt" "union.rkt"
|
||||
racket/match
|
||||
(for-syntax syntax/parse racket/base)
|
||||
syntax/id-table racket/dict)
|
||||
|
@ -18,7 +17,7 @@
|
|||
(let loop ([t* t])
|
||||
(match t*
|
||||
[(Value: '()) (-lst Univ)]
|
||||
[(Value: 0) -Int]
|
||||
[(Value: 0) -Int]
|
||||
[(List: ts) (-lst (apply Un ts))]
|
||||
[(? (lambda (t) (subtype t -Int))) -Int]
|
||||
[(? (lambda (t) (subtype t -Rat))) -Rat]
|
||||
|
@ -45,4 +44,4 @@
|
|||
[(ListDots: t bound) (-lst (substitute Univ bound t))]
|
||||
[(? (lambda (t) (subtype t -Symbol))) -Symbol]
|
||||
[(Value: #t) -Boolean]
|
||||
[_ (exit t)]))))
|
||||
[_ (exit t)]))))
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#lang racket/base
|
||||
|
||||
(require "convenience.rkt" "../rep/type-rep.rkt"
|
||||
"union.rkt" "abbrev.rkt" "../utils/tc-utils.rkt"
|
||||
racket/list racket/dict racket/set racket/match)
|
||||
"union.rkt" "../utils/tc-utils.rkt"
|
||||
racket/list racket/dict racket/match)
|
||||
|
||||
;; convert : [Listof Keyword] [Listof Type] [Listof Type] [Option Type] [Option Type] -> (values Type Type)
|
||||
(define (convert kw-t plain-t opt-t rng rest drest split?)
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
(require racket/require racket/match unstable/sequence racket/string racket/promise
|
||||
(prefix-in s: srfi/1)
|
||||
(path-up "rep/type-rep.rkt" "rep/filter-rep.rkt" "rep/object-rep.rkt"
|
||||
"rep/rep-utils.rkt" "types/abbrev.rkt" "types/subtype.rkt"
|
||||
"types/numeric-tower.rkt" "utils/utils.rkt"
|
||||
"rep/rep-utils.rkt" "types/convenience.rkt" "types/subtype.rkt"
|
||||
"utils/utils.rkt"
|
||||
"utils/tc-utils.rkt"))
|
||||
|
||||
;; do we attempt to find instantiations of polymorphic types to print?
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
(only-in (infer infer-dummy) unify)
|
||||
racket/match unstable/match
|
||||
racket/function
|
||||
(rename-in racket/contract
|
||||
[-> c->] [->* c->*])
|
||||
(prefix-in c: racket/contract)
|
||||
(for-syntax racket/base syntax/parse))
|
||||
|
||||
;; exn representing failure of subtyping
|
||||
|
@ -186,7 +185,7 @@
|
|||
;(trace subtypes*/varargs)
|
||||
|
||||
(define/cond-contract (combine-arrs arrs)
|
||||
(c-> (listof arr?) (or/c #f arr?))
|
||||
(c:-> (c:listof arr?) (c:or/c #f arr?))
|
||||
(match arrs
|
||||
[(list (and a1 (arr: dom1 rng1 #f #f '())) (arr: dom rng #f #f '()) ...)
|
||||
(cond
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(rep type-rep rep-utils)
|
||||
(utils tc-utils)
|
||||
(prefix-in c: (contract-req))
|
||||
(types utils subtype abbrev)
|
||||
(types utils subtype)
|
||||
racket/match)
|
||||
|
||||
|
||||
|
@ -25,6 +25,13 @@
|
|||
[(ormap (lambda (t) (subtype (car ts*) t)) result) (loop (cdr ts*) result)]
|
||||
[else (loop (cdr ts*) (cons (car ts*) result))])))
|
||||
|
||||
(define (flat t)
|
||||
(match t
|
||||
[(Union: es) es]
|
||||
[(Values: (list (Result: (Union: es) _ _))) es]
|
||||
[(Values: (list (Result: t _ _))) (list t)]
|
||||
[_ (list t)]))
|
||||
|
||||
;; Union constructor
|
||||
;; Normalizes representation by sorting types.
|
||||
(define Un
|
||||
|
|
Loading…
Reference in New Issue
Block a user