add stlc+sub tests
This commit is contained in:
parent
48b625c2f4
commit
b4bc922dda
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue
Block a user