Instrumentation for parametric->/c.

This commit is contained in:
Vincent St-Amour 2016-01-11 16:49:23 -06:00
parent 143267f1e9
commit b00d7782ca
2 changed files with 17 additions and 8 deletions

View File

@ -392,4 +392,11 @@
0) 0)
1)) 1))
(test/spec-passed
'contract-marks43
'((contract (parametric->/c (X) (-> pos-blame? X neg-blame?))
(lambda (x y) x)
'pos 'neg)
1 2))
) )

View File

@ -61,14 +61,16 @@
(define barrier/c (polymorphic-contract-barrier c)) (define barrier/c (polymorphic-contract-barrier c))
(define vars (polymorphic-contract-vars c)) (define vars (polymorphic-contract-vars c))
(define (wrap p neg-party) (define (wrap p neg-party)
;; values in polymorphic types come in from negative position, (with-contract-continuation-mark
;; relative to the poly/c contract (cons blame neg-party)
(define instances ;; values in polymorphic types come in from negative position,
(for/list ([var (in-list vars)]) ;; relative to the poly/c contract
(barrier/c negative? var))) (define instances
(define protector (for/list ([var (in-list vars)])
(apply (polymorphic-contract-body c) instances)) (barrier/c negative? var)))
(((get/build-late-neg-projection protector) blame) p neg-party)) (define protector
(apply (polymorphic-contract-body c) instances))
(((get/build-late-neg-projection protector) blame) p neg-party)))
(lambda (p neg-party) (lambda (p neg-party)
(unless (procedure? p) (unless (procedure? p)