Make version of TR that builds new contracts.
original commit: eb03d5c298ef77bc9e382f8a6d1bfc891ad5c076
This commit is contained in:
parent
e832c436e5
commit
5a2d6f9c6b
|
@ -18,6 +18,7 @@
|
|||
racket/format
|
||||
unstable/list
|
||||
unstable/sequence
|
||||
(static-contracts types instantiate)
|
||||
(contract-req)
|
||||
(for-syntax racket/base syntax/parse racket/syntax)
|
||||
(for-template racket/base racket/contract racket/set (utils any-wrap)
|
||||
|
@ -144,9 +145,13 @@
|
|||
[(untyped) 'typed]
|
||||
[(both) 'both]))
|
||||
|
||||
|
||||
(define (type->contract ty fail #:typed-side [typed-side #t] #:kind [kind 'impersonator])
|
||||
(define vars (make-parameter '()))
|
||||
(let/ec escape
|
||||
(define (fail/t->sc) (escape (fail)))
|
||||
(instantiate (type->static-contract ty #:typed-side typed-side fail/t->sc) fail kind)))
|
||||
|
||||
(define (type->contract-old ty fail #:typed-side [typed-side #t] #:kind [kind 'impersonator])
|
||||
(define vars (make-parameter '()))
|
||||
(define current-contract-kind (make-parameter flat-sym))
|
||||
(define (increase-current-contract-kind! kind)
|
||||
(current-contract-kind (contract-kind-max (current-contract-kind) kind)))
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
;; the below requires are needed since they provide identifiers
|
||||
;; that may appear in the residual program
|
||||
;; TODO: figure out why this are needed here and not somewhere else
|
||||
(submod "static-contracts/types.rkt" predicates)
|
||||
"utils/utils.rkt"
|
||||
(for-syntax "utils/utils.rkt")
|
||||
"utils/any-wrap.rkt" unstable/contract racket/contract/parametric)
|
||||
|
|
|
@ -87,6 +87,7 @@ at least theoretically.
|
|||
(define-requirer types types-out)
|
||||
(define-requirer optimizer optimizer-out)
|
||||
(define-requirer base-env base-env-out)
|
||||
(define-requirer static-contracts static-contracts-out)
|
||||
|
||||
;; turn contracts on and off - off by default for performance.
|
||||
(provide (for-syntax enable-contracts?)
|
||||
|
|
Loading…
Reference in New Issue
Block a user