test-structure-parametric.rkt (781B)
1 #lang typed/racket 2 3 (require phc-adt phc-toolkit type-expander typed/rackunit "ck.rkt") 4 (adt-init) 5 6 (define-structure #:∀ (T) a [a : T] [b : T]) 7 (check-print-type (a 3 "b") "((tagged untagged a b) (U Positive-Byte String) (U Positive-Byte String))") 8 9 (define-structure b #:∀ (T) [a : T] [b : T]) 10 (define-structure c [a : T] [b : T] #:∀ (T)) 11 12 (define printed-type 13 "((tagged untagged a b) (U Positive-Byte String) (U Positive-Byte String))") 14 15 (check-print-type (a 3 "b") printed-type) 16 (check-ann (a 3 4) (structure [a Positive-Byte] [b Positive-Byte])) 17 18 (check-print-type (b 3 "b") printed-type) 19 (check-ann (b 3 4) (structure [a Positive-Byte] [b Positive-Byte])) 20 21 (check-print-type (c 3 "b") printed-type) 22 (check-ann (c 3 4) (structure [a Positive-Byte] [b Positive-Byte]))