test1.rkt (582B)
1 #lang s-exp phc-ts 2 (require turnstile/examples/tests/rackunit-typechecking) 3 4 (check-type (λ ([x : X]) (ann x : X)) : (→/test A A)) 5 (check-type (λ ([x : y]) (ann x : y)) : (→/test A A)) 6 (check-type (λ ([x : y]) x) : (→/test A A)) 7 (check-type (record [b = 1] [a = 2]) : (Record [a : Int] [b : Int])) 8 (check-type (record [a = 2] [b = 1]) : (Record [a : Int] [b : Int])) 9 (typecheck-fail 10 (getfield c (record [b = 1] [a = 2])) 11 #:with-msg (string-append "expected record type containing the field c, got:" 12 " \\(Record \\(a : Int\\) \\(b : Int\\)\\)"))