typed-racket/typed-racket-test/succeed/with-type-lift.rkt
2014-12-16 10:07:25 -05:00

26 lines
542 B
Racket

#lang racket/base
;; Test syntax lifting in `with-type`
(require rackunit typed/racket)
(with-type #:result Number
(define-syntax (m stx)
(syntax-local-lift-expression #'(+ 1 2)))
(m))
(define-syntax (m2 stx)
(syntax-local-lift-expression #'(+ 1 2)))
(with-type #:result Number (m2))
(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)