Fix cast/make-predicate contracts in with-type

This commit is contained in:
Asumu Takikawa 2014-07-25 15:57:35 -04:00
parent 0e8e71f48f
commit 4ead2124c7
2 changed files with 11 additions and 2 deletions

View File

@ -117,6 +117,8 @@
#'(void)
'disappeared-binding (disappeared-bindings-todo))
'disappeared-use (disappeared-use-todo))])
(define fixed-up-definitions
(change-contract-fixups lifted-definitions))
(arm
(if expr?
(quasisyntax/loc stx
@ -124,14 +126,14 @@
(c:with-contract typed-region
#:results (region-cnt ...)
#:freevars ([fv.id cnt] ...)
#,lifted-definitions
#,fixed-up-definitions
body)))
(quasisyntax/loc stx
(begin
(define-values () (begin check-syntax-help (values)))
(c:with-contract typed-region
([ex-id ex-cnt] ...)
#,lifted-definitions
#,fixed-up-definitions
(define-values (ex-id ...) body))))))))
;; Syntax (U Symbol List) -> (values Syntax Syntax)

View File

@ -16,3 +16,10 @@
(with-type ([val Number]) (define val (m2)))
(check-equal? val 3)
(with-type #:result (Listof String)
;; casts do lifts for the contract
(define x (cast '() (Listof String)))
;; as do predicates
(make-predicate (Listof String))
x)