Fix a free variance bug
Commit ffe45ecce had introduced a regression with some polymorphic functions imported between typed modules due to miscommunicated variance information. original commit: daca1c0d5b6040978b1c75d4cc822c0a3a819181
This commit is contained in:
parent
3892d0101e
commit
cf1a2c71d0
16
collects/tests/typed-racket/succeed/variance-test.rkt
Normal file
16
collects/tests/typed-racket/succeed/variance-test.rkt
Normal file
|
@ -0,0 +1,16 @@
|
|||
#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)))
|
|
@ -46,7 +46,7 @@
|
|||
(match var
|
||||
((== Covariant) #'Covariant)
|
||||
((== Contravariant) #'Contravariant)
|
||||
((== Invariant) #'Contravariant)
|
||||
((== Invariant) #'Invariant)
|
||||
((== Constant) #'Constant)
|
||||
((== Dotted) #'Dotted)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user