Move replace-names from tc-metafunctions to tc-subst.
original commit: 70a70166d1b2fcae0a841208217b1815db124911
This commit is contained in:
parent
185697e6ee
commit
6ec3879afa
|
@ -8,7 +8,7 @@
|
|||
global-env type-env-structs scoped-tvar-env)
|
||||
(rep type-rep filter-rep)
|
||||
syntax/free-vars
|
||||
(typecheck signatures tc-metafunctions internal-forms)
|
||||
(typecheck signatures tc-metafunctions tc-subst internal-forms)
|
||||
(utils tarjan)
|
||||
racket/match (contract-req)
|
||||
racket/list
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
combine-props
|
||||
tc-results->values)
|
||||
|
||||
(provide/cond-contract
|
||||
[replace-names (-> (listof (list/c identifier? Object?)) tc-results/c tc-results/c)])
|
||||
|
||||
|
||||
;; abstract-results
|
||||
;;
|
||||
|
@ -240,9 +237,3 @@
|
|||
[(Bot:) (set-box! flag #f) (values derived-props derived-atoms)]
|
||||
[_ (loop (cons p derived-props) derived-atoms (cdr worklist))])))))
|
||||
|
||||
;; replace-names: (listof (list/c identifier? Object?) tc-results? -> tc-results?
|
||||
;; For each name replaces all uses of it in res with the corresponding object.
|
||||
;; This is used so that names do not escape the scope of their definitions
|
||||
(define (replace-names names+objects res)
|
||||
(for/fold ([res res]) ([name/object (in-list names+objects)])
|
||||
(subst-tc-results res (first name/object) (second name/object) #t)))
|
||||
|
|
|
@ -4,12 +4,15 @@
|
|||
;; figure 8, pg 8 of "Logical Types for Untyped Languages"
|
||||
|
||||
(require "../utils/utils.rkt"
|
||||
racket/match
|
||||
racket/match racket/list
|
||||
(contract-req)
|
||||
(except-in (types abbrev utils filter-ops) -> ->* one-of/c)
|
||||
(rep type-rep object-rep filter-rep rep-utils))
|
||||
|
||||
(provide (all-defined-out))
|
||||
(provide open-Result add-scope values->tc-results)
|
||||
|
||||
(provide/cond-contract
|
||||
[replace-names (-> (listof (list/c identifier? Object?)) tc-results/c tc-results/c)])
|
||||
|
||||
;; Substitutes the given objects into the type, filters, and object
|
||||
;; of a Result for function application. This matches up to the substitutions
|
||||
|
@ -25,6 +28,13 @@
|
|||
(subst-filter-set fs key o #t arg-ty)
|
||||
(subst-object old-obj key o #t))))
|
||||
|
||||
;; replace-names: (listof (list/c identifier? Object?) tc-results? -> tc-results?
|
||||
;; For each name replaces all uses of it in res with the corresponding object.
|
||||
;; This is used so that names do not escape the scope of their definitions
|
||||
(define (replace-names names+objects res)
|
||||
(for/fold ([res res]) ([name/object (in-list names+objects)])
|
||||
(subst-tc-results res (first name/object) (second name/object) #t)))
|
||||
|
||||
;; Substitution of objects into a tc-results
|
||||
(define/cond-contract (subst-tc-results res k o polarity)
|
||||
(-> full-tc-results/c name-ref/c Object? boolean? full-tc-results/c)
|
||||
|
|
Loading…
Reference in New Issue
Block a user