diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/init-envs.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/init-envs.rkt index 1b86f18d..27ad2c52 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/init-envs.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/init-envs.rkt @@ -79,9 +79,8 @@ [(Result: t (FilterSet: (Top:) (Top:)) (Empty:)) `(-result ,(sub t))] [(Union: elems) (split-union elems)] [(Base: n cnt pred _) (int-err "Base type not in predefined-type-table" n)] - [(Name: stx deps args struct?) + [(Name: stx args struct?) `(make-Name (quote-syntax ,stx) - (list ,@(map (λ (x) `(quote-syntax ,x)) deps)) ,(and args `(list ,@(map (λ (x) `(quote-syntax ,x)) args))) ,struct?)] diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt index ad1b03a6..8649eeb4 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-alias-helper.rkt @@ -185,51 +185,12 @@ free-identifier=?)) alias)) - ;; Reconstruct type alias dependency map based on class parent - ;; information. This ensures that the `deps` field is precise - ;; in all type aliases involving class types - (define (get-all-parent-deps id) - (define (get-deps parent) - (cdr (assoc parent type-alias-dependency-map free-identifier=?))) - (define parents (cdr (assoc id type-alias-class-map free-identifier=?))) - (cond [(null? parents) null] - [else - (define all-deps - (for/list ([parent (in-list parents)]) - (append (get-deps parent) - (get-all-parent-deps parent)))) - (apply append all-deps)])) - - (define new-dependency-map/classes - (for/list ([(id deps) (in-dict type-alias-dependency-map)]) - (cond [(dict-has-key? type-alias-class-map id) - (define new-deps - (remove-duplicates (append (get-all-parent-deps id) deps) - free-identifier=?)) - (cons id new-deps)] - [else (cons id deps)]))) - - ;; Do another pass on dependency map, using the connected - ;; components analysis data to determine which dependencies are - ;; actually needed for mutual recursion. Drop all others. - (define new-dependency-map - (for/list ([(id deps) (in-dict new-dependency-map/classes)]) - ;; find the component this `id` participated in so - ;; that we can drop `deps` that aren't in that component - (define component - (findf (λ (component) (member id component free-identifier=?)) - components)) - (define new-deps - (filter (λ (dep) (member dep component free-identifier=?)) deps)) - (cons id new-deps))) - ;; Actually register recursive type aliases (define name-types (for/list ([id (in-list recursive-aliases)]) (define record (dict-ref type-alias-map id)) (match-define (list _ args) record) - (define deps (dict-ref new-dependency-map id)) - (define name-type (make-Name id deps args #f)) + (define name-type (make-Name id args #f)) (register-resolved-type-alias id name-type) name-type)) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-name-env.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-name-env.rkt index 24d0e96b..3b6682a2 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-name-env.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/env/type-name-env.rkt @@ -54,7 +54,7 @@ (when (lookup-type-name to (lambda () #f)) (register-resolved-type-alias from - (make-Name to null #f #t)))) + (make-Name to #f #t)))) ;; a mapping from id -> listof[Variance] (where id is the name of the type) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt index 3ee52e22..c24dc3db 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/infer/infer-unit.rkt @@ -548,7 +548,7 @@ (% cset-meet proc-c (cgen/flds context flds flds*)))] ;; two struct names, need to resolve b/c one could be a parent - [((Name: n _ _ #t) (Name: n* _ _ #t)) + [((Name: n _ #t) (Name: n* _ #t)) (if (free-identifier=? n n*) empty ;; just succeed now (% cg (resolve-once S) (resolve-once T)))] diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-contract.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-contract.rkt index 6783d6dc..19b9b710 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-contract.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/type-contract.rkt @@ -248,7 +248,7 @@ ;; We special case this rather than just resorting to standard ;; App resolution (see case below) because the resolution process ;; will make type->static-contract infinite loop. - [(App: (Name: name _ _ #f) rands _) + [(App: (Name: name _ #f) rands _) ;; Key with (cons name 'app) instead of just name because the ;; application of the Name is not necessarily the same as the ;; Name type alone @@ -264,7 +264,7 @@ (recursive-sc-use name*)))) (recursive-sc-use name*))])] ;; Implicit recursive aliases - [(Name: name-id dep-ids args #f) + [(Name: name-id args #f) (cond [;; recursive references are looked up in a special table ;; that's handled differently by sc instantiation (lookup-name-sc name-id typed-side)] diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt index db295b6b..82e629f4 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/rep/type-rep.rkt @@ -122,11 +122,9 @@ ;; A type name, potentially recursive or mutually recursive or pointing ;; to a type for a struct type ;; id is the name stored in the environment -;; deps are the other aliases this depends on, if any ;; args are the type parameters for this type (or #f if none) ;; struct? indicates if this maps to a struct type (def-type Name ([id identifier?] - [deps (listof identifier?)] [args (or/c #f (listof identifier?))] [struct? boolean?]) [#:intern (hash-id id)] [#:frees #f] [#:fold-rhs #:base]) @@ -138,7 +136,7 @@ [#:intern (cons (Rep-seq rator) (map Rep-seq rands))] [#:frees (λ (f) (match rator - ((Name: n _ _ _) + ((Name: n _ _) (instantiate-frees n (map f rands))) (else (f (resolve-app rator rands stx)))))] @@ -1036,11 +1034,11 @@ (define-match-expander Name/simple: (λ (stx) (syntax-parse stx - [(_ name-pat) #'(Name: name-pat _ _ _)]))) + [(_ name-pat) #'(Name: name-pat _ _)]))) ;; alternative to Name: that only matches struct names (define-match-expander Name/struct: (λ (stx) (syntax-parse stx - [(_) #'(Name: _ _ _ #t)] - [(_ name-pat) #'(Name: name-pat _ _ #t)]))) + [(_) #'(Name: _ _ #t)] + [(_ name-pat) #'(Name: name-pat _ #t)]))) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-structs.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-structs.rkt index d1d9c2de..0d1231ba 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-structs.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-structs.rkt @@ -125,7 +125,7 @@ (define type-name (struct-names-type-name names)) (register-resolved-type-alias type-name - (make-Name type-name null #f #t)) + (make-Name type-name #f #t)) (register-type-name type-name (make-Poly (struct-desc-tvars desc) sty))) @@ -147,7 +147,7 @@ ;; the base-type, with free type variables (define name-type (make-Name (struct-names-type-name names) - null #f #t)) + #f #t)) (define poly-base (if (null? tvars) name-type @@ -283,7 +283,7 @@ (c:listof Type/c) (c:or/c #f identifier?) c:any/c) (define parent-type - (and parent (resolve-name (make-Name parent null #f #t)))) + (and parent (resolve-name (make-Name parent #f #t)))) (define parent-tys (map fld-t (get-flds parent-type))) (define names (get-struct-names nm fld-names #f)) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt index 84bdbeb8..aaa0f02c 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt @@ -293,7 +293,7 @@ (type-vars (map type-vars-of-struct struct-defs))) (for ([name names]) (register-resolved-type-alias - name (make-Name name null #f #t))) + name (make-Name name #f #t))) (for-each register-type-name names) (for-each add-constant-variance! names type-vars)) (do-time "after adding type names") diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/abbrev.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/abbrev.rkt index 288ff5f6..e25afd56 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/abbrev.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/abbrev.rkt @@ -241,7 +241,7 @@ ;; Type alias names (define (-struct-name name) - (make-Name name null #f #t)) + (make-Name name #f #t)) ;; Structs (define (-struct name parent flds [proc #f] [poly #f] [pred #'dummy]) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt index 90f4386f..eb1cf1ae 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/remove-intersect.rkt @@ -41,9 +41,9 @@ [(list (Name/simple: n) (Name/simple: n*)) (or (free-identifier=? n n*) (overlap (resolve-once t1) (resolve-once t2)))] - [(list _ (Name: _ _ _ _)) + [(list _ (? Name?)) (overlap t1 (resolve-once t2))] - [(list (Name: _ _ _ _) _) + [(list (? Name?) _) (overlap (resolve-once t1) t2)] [(list (? Mu?) _) (overlap (unfold t1) t2)] [(list _ (? Mu?)) (overlap t1 (unfold t2))] @@ -118,7 +118,7 @@ (if (subtype old rem) (Un) ;; the empty type (match (list old rem) - [(list (or (App: _ _ _) (Name: _ _ _ _)) t) + [(list (or (App: _ _ _) (? Name?)) t) ;; must be different, since they're not subtypes ;; and n must refer to a distinct struct type old] diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/resolve.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/resolve.rkt index 2c7330b6..8dc07749 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/resolve.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/resolve.rkt @@ -60,7 +60,7 @@ " does not match the given number:" " expected " num-poly ", given " num-rands))))] - [(Name: _ _ args #f) + [(Name: _ args #f) (cond [args (define num-rands (length rands)) (define num-args (length args))