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

17 lines
443 B
Racket

#lang typed/racket
;; Test a variance regression
(struct: (A) Foo ([elems : (Vectorof A)]))
(: make-foo (All (A) (A -> (Foo A))))
(define (make-foo x) (Foo (vector x)))
;; Need a module+ here because this test failed
;; originally when variance information wasn't preserved
;; across modules.
(module+ test
;; should type check, but won't if the element has
;; the Any type incorrectly
(+ 1 (vector-ref (Foo-elems (make-foo 1)) 0)))