add stlc+sub tests

This commit is contained in:
Stephen Chang 2015-10-22 13:22:22 -04:00
parent 48b625c2f4
commit b4bc922dda
2 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#lang s-exp "typecheck.rkt"
(extends "stlc+lit.rkt" #:except #%datum +)
(reuse add1 #:from "ext-stlc.rkt")
(provide (for-syntax subs? current-sub?))
;; Simply-Typed Lambda Calculus, plus subtyping

View File

@ -21,6 +21,12 @@
(check-type (λ ([x : Int]) x) : ( Nat Int)) ; contravariant input
(check-not-type (λ ([x : Int]) x) : ( Num Int))
(check-type ((λ ([f : ( Int Int)]) (f -1)) add1) : Int 0)
(check-type ((λ ([f : ( Nat Int)]) (f 1)) add1) : Int 2)
(typecheck-fail ((λ ([f : ( Num Int)]) (f 1.1)) add1))
(check-type ((λ ([f : ( Nat Num)]) (f 1)) add1) : Num 2)
(typecheck-fail ((λ ([f : ( Num Num)]) (f 1.1)) add1))
(check-type + : ( Num Num Num))
(check-type + : ( Int Num Num))
(check-type + : ( Int Int Num))