diff --git a/collects/tests/typed-racket/fail/promise-any.rkt b/collects/tests/typed-racket/fail/promise-any.rkt new file mode 100644 index 0000000000..1c9be644cd --- /dev/null +++ b/collects/tests/typed-racket/fail/promise-any.rkt @@ -0,0 +1,14 @@ +#; +(exn-pred exn:fail:contract?) +#lang racket + +(module typed typed/racket + (: d Any) + (define d (delay (lambda: ([x : Integer]) (+ x 1)))) + (provide d)) + +(require 'typed) + +;; this line should raise a ctc error +((force d) 6) + diff --git a/collects/tests/typed-racket/succeed/pr13326.rkt b/collects/tests/typed-racket/succeed/pr13326.rkt new file mode 100644 index 0000000000..9a8ee99c0c --- /dev/null +++ b/collects/tests/typed-racket/succeed/pr13326.rkt @@ -0,0 +1,19 @@ +#lang racket + +(require rackunit) + +;; the setup here is just to make it play nice with Rackunit +(check-not-exn + (λ () + (parameterize ([current-error-port (open-output-nowhere)]) + (eval + (quote + (begin + ;; This is the actual test case + (module typed typed/racket + (require typed/rackunit) + + ;; Any wrappings should be okay here + (check-equal? (delay 0) (delay 0))) + (require 'typed))) + (make-base-namespace))))) diff --git a/collects/typed-racket/utils/any-wrap.rkt b/collects/typed-racket/utils/any-wrap.rkt index 3ebcd0bea3..62161368f6 100644 --- a/collects/typed-racket/utils/any-wrap.rkt +++ b/collects/typed-racket/utils/any-wrap.rkt @@ -1,6 +1,7 @@ #lang racket/base -(require racket/match racket/contract/base racket/contract/combinator) +(require racket/match racket/contract/base racket/contract/combinator + racket/promise) (define undef (letrec ([x x]) x)) @@ -81,6 +82,10 @@ (chaperone-procedure v (case-lambda [() (values)] [_ (fail v)])) (chaperone-procedure v (lambda args (fail v))))] + [(? promise?) + ;; for promises, just apply Any in the promise + (contract (promise/c any-wrap/c) v + (blame-positive b) (blame-negative b))] [_ (fail v)])) t)