Move to open-Values instead of open-Result.

This commit is contained in:
Eric Dobson 2014-05-29 00:33:04 -07:00
parent 1407e0cc9f
commit 2922440fdd
2 changed files with 23 additions and 17 deletions

View File

@ -45,24 +45,11 @@
;; objects yet. ;; objects yet.
(let-values (let-values
([(o-a t-a) (for/lists (os ts) ([(o-a t-a) (for/lists (os ts)
([nm (in-range dom-count)] ([_ (in-range dom-count)]
[oa (in-sequence-forever (in-list o-a) -empty-obj)] [oa (in-sequence-forever (in-list o-a) -empty-obj)]
[ta (in-sequence-forever (in-list t-a) #f)]) [ta (in-sequence-forever (in-list t-a) Univ)])
(values oa ta))]) (values oa ta))])
(match rng (open-Values rng o-a t-a)))]
[(AnyValues: f) (tc-any-results f)]
[(Values: results)
(define-values (t-r f-r o-r)
(for/lists (t-r f-r o-r)
([r (in-list results)])
(open-Result r o-a t-a)))
(ret t-r f-r o-r)]
[(ValuesDots: results dty dbound)
(define-values (t-r f-r o-r)
(for/lists (t-r f-r o-r)
([r (in-list results)])
(open-Result r o-a t-a)))
(ret t-r f-r o-r dty dbound)])))]
;; this case should only match if the function type has mandatory keywords ;; this case should only match if the function type has mandatory keywords
;; but no keywords were provided in the application ;; but no keywords were provided in the application
[((arr: _ _ _ _ [((arr: _ _ _ _

View File

@ -9,11 +9,30 @@
(except-in (types abbrev utils filter-ops) -> ->* one-of/c) (except-in (types abbrev utils filter-ops) -> ->* one-of/c)
(rep type-rep object-rep filter-rep rep-utils)) (rep type-rep object-rep filter-rep rep-utils))
(provide open-Result add-scope values->tc-results) (provide add-scope values->tc-results)
(provide/cond-contract (provide/cond-contract
[open-Values (-> SomeValues/c (listof Object?) (listof Type/c) -> full-tc-results/c)]
[replace-names (-> (listof (list/c identifier? Object?)) tc-results/c tc-results/c)]) [replace-names (-> (listof (list/c identifier? Object?)) tc-results/c tc-results/c)])
(define (open-Values v os ts)
(match v
[(AnyValues: f)
(tc-any-results f)]
[(Values: results)
(define-values (t-r f-r o-r)
(for/lists (t-r f-r o-r)
([r (in-list results)])
(open-Result r os ts)))
(ret t-r f-r o-r)]
[(ValuesDots: results dty dbound)
(define-values (t-r f-r o-r)
(for/lists (t-r f-r o-r)
([r (in-list results)])
(open-Result r os ts)))
(ret t-r f-r o-r dty dbound)]))
;; Substitutes the given objects into the type, filters, and object ;; Substitutes the given objects into the type, filters, and object
;; of a Result for function application. This matches up to the substitutions ;; of a Result for function application. This matches up to the substitutions
;; in the T-App rule from the ICFP paper. ;; in the T-App rule from the ICFP paper.