Test for appropriate predicates for invariant structs.
This commit is contained in:
parent
ee4ba2e3dd
commit
cab90c16d5
14
collects/tests/typed-racket/succeed/structs-variance.rkt
Normal file
14
collects/tests/typed-racket/succeed/structs-variance.rkt
Normal file
|
@ -0,0 +1,14 @@
|
|||
#lang typed/racket
|
||||
|
||||
(struct: (A) x ([f : (A -> A)]))
|
||||
(struct: (B) y ([f : (x B)]))
|
||||
|
||||
(: f : (U Integer (y Integer)) -> Integer)
|
||||
(define (f v)
|
||||
(if (y? v)
|
||||
((x-f (y-f v)) 0)
|
||||
v))
|
||||
|
||||
(f 17)
|
||||
|
||||
(f (y (x (lambda: ([n : Integer]) (+ 2 n)))))
|
Loading…
Reference in New Issue
Block a user