test-pure-lifted.rkt (1007B)
1 #lang typed/racket 2 3 (require delay-pure 4 typed/rackunit 5 syntax/macro-testing) 6 7 (define-syntax (lft stx) 8 (syntax-case stx () 9 [(_ e) 10 (syntax-local-lift-expression #'e)])) 11 12 (check-exn (regexp (string-append "lifted expressions are disallowed within" 13 " pure/stateful, pure/stateless and similar" 14 " forms \\(for now\\)")) 15 (λ () 16 (convert-compile-time-error 17 (let () 18 (define x 1) 19 (pure/stateless (+ 2 (lft (begin (set! x (add1 x)) x)) 3)))))) 20 21 22 23 (check-exn (regexp (string-append "lifted expressions are disallowed within" 24 " pure/stateful, pure/stateless and similar" 25 " forms \\(for now\\)")) 26 (λ () 27 (convert-compile-time-error 28 (let () 29 (define x 1) 30 (pure/stateful (+ 2 (lft (begin (set! x (add1 x)) x)) 3))))))