remove spurious type annotations in tests
- not needed bc rackunit-typechecking now adds expected-type
This commit is contained in:
parent
fdf902121e
commit
2a9005a31d
|
@ -52,19 +52,25 @@
|
|||
(check-type (g2 (Nil {Bool})) : (List Bool) ⇒ (Nil {Bool}))
|
||||
(check-type (g2 (Nil {(List Int)})) : (List (List Int)) ⇒ (Nil {(List Int)}))
|
||||
(check-type (g2 (Nil {(→ Int Int)})) : (List (→ Int Int)) ⇒ (Nil {(List (→ Int Int))}))
|
||||
;; same as tests above, but without annotations
|
||||
(check-type (g2 Nil) : (List Int) ⇒ Nil)
|
||||
(check-type (g2 Nil) : (List Bool) ⇒ Nil)
|
||||
(check-type (g2 Nil) : (List (List Int)) ⇒ Nil)
|
||||
(check-type (g2 Nil) : (List (→ Int Int)) ⇒ Nil)
|
||||
|
||||
(check-type (g2 (Cons 1 Nil)) : (List Int) ⇒ (Cons 1 Nil))
|
||||
(check-type (g2 (Cons "1" Nil)) : (List String) ⇒ (Cons "1" Nil))
|
||||
|
||||
;; ;; mlish cant type this fn (ie, incomplete cases on variant --- what to put for Nil case?)
|
||||
;; ;(define (g3 [lst : (List X)] → X) (hd lst))
|
||||
;; ;(check-type g3 : (→ {X} (List X) X))
|
||||
;; ;(check-type g3 : (→ {A} (List A) A))
|
||||
;; ;(check-not-type g3 : (→ {A B} (List A) B))
|
||||
;; ;(typecheck-fail (g3) #:with-msg "Expected.+arguments with type.+List") ; TODO: more precise err msg
|
||||
;; ;(check-type (g3 (nil {Int})) : Int) ; runtime fail
|
||||
;; ;(check-type (g3 (nil {Bool})) : Bool) ; runtime fail
|
||||
;; ;(check-type (g3 (cons 1 nil)) : Int ⇒ 1)
|
||||
;; ;(check-type (g3 (cons "1" nil)) : String ⇒ "1")
|
||||
;; mlish cant type this fn (ie, incomplete cases on variant --- what to put for Nil case?)
|
||||
;(define (g3 [lst : (List X)] → X) (hd lst))
|
||||
;(check-type g3 : (→ {X} (List X) X))
|
||||
;(check-type g3 : (→ {A} (List A) A))
|
||||
;(check-not-type g3 : (→ {A B} (List A) B))
|
||||
;(typecheck-fail (g3) #:with-msg "Expected.+arguments with type.+List") ; TODO: more precise err msg
|
||||
;(check-type (g3 (nil {Int})) : Int) ; runtime fail
|
||||
;(check-type (g3 (nil {Bool})) : Bool) ; runtime fail
|
||||
;(check-type (g3 (cons 1 nil)) : Int ⇒ 1)
|
||||
;(check-type (g3 (cons "1" nil)) : String ⇒ "1")
|
||||
|
||||
;; recursive fn
|
||||
(define (recf [x : Int] → Int) (recf x))
|
||||
|
@ -93,7 +99,7 @@
|
|||
|
||||
; nil without annotation; tests fn-first, left-to-right arg inference
|
||||
; does work yet, need to add left-to-right inference in #%app
|
||||
(check-type (map add1 Nil) : (List Int) ⇒ (Nil {Int}))
|
||||
(check-type (map add1 Nil) : (List Int) ⇒ Nil)
|
||||
(check-type (map add1 (Cons 1 (Cons 2 (Cons 3 Nil))))
|
||||
: (List Int) ⇒ (Cons 2 (Cons 3 (Cons 4 Nil))))
|
||||
(typecheck-fail (map add1 (Cons "1" Nil))
|
||||
|
@ -114,16 +120,16 @@
|
|||
[Nil -> Nil]
|
||||
[Cons x xs #:when (p? x) -> (Cons x (filter p? xs))]
|
||||
[Cons x xs -> (filter p? xs)]))
|
||||
(check-type (filter zero? Nil) : (List Int) ⇒ (Nil {Int}))
|
||||
(check-type (filter zero? Nil) : (List Int) ⇒ Nil)
|
||||
(check-type (filter zero? (Cons 1 (Cons 2 (Cons 3 Nil))))
|
||||
: (List Int) ⇒ (Nil {Int}))
|
||||
: (List Int) ⇒ Nil)
|
||||
(check-type (filter zero? (Cons 0 (Cons 1 (Cons 2 Nil))))
|
||||
: (List Int) ⇒ (Cons 0 Nil))
|
||||
(check-type (filter (λ ([x : Int]) (not (zero? x))) (Cons 0 (Cons 1 (Cons 2 Nil))))
|
||||
: (List Int) ⇒ (Cons 1 (Cons 2 Nil)))
|
||||
(check-type (filter/guard zero? Nil) : (List Int) ⇒ (Nil {Int}))
|
||||
(check-type (filter/guard zero? Nil) : (List Int) ⇒ Nil)
|
||||
(check-type (filter/guard zero? (Cons 1 (Cons 2 (Cons 3 Nil))))
|
||||
: (List Int) ⇒ (Nil {Int}))
|
||||
: (List Int) ⇒ Nil)
|
||||
(check-type (filter/guard zero? (Cons 0 (Cons 1 (Cons 2 Nil))))
|
||||
: (List Int) ⇒ (Cons 0 Nil))
|
||||
(check-type
|
||||
|
|
|
@ -57,9 +57,9 @@
|
|||
[Cons x x* -> (flatten (map (insert x) (permutations x*)))]))
|
||||
|
||||
(check-type
|
||||
(permutations (Nil {Int}))
|
||||
(permutations Nil)
|
||||
: (List (List Int))
|
||||
⇒ (Cons (Nil {Int}) Nil))
|
||||
⇒ (Cons Nil Nil))
|
||||
|
||||
(check-type
|
||||
(permutations (Cons 1 Nil))
|
||||
|
@ -97,9 +97,9 @@
|
|||
(Cons b b*))])])]))
|
||||
|
||||
(check-type
|
||||
(split (Nil {(** Int Int)}))
|
||||
(split Nil)
|
||||
: (** (List Int) (List Int))
|
||||
⇒ (Pair (Nil {Int}) (Nil {Int})))
|
||||
⇒ (Pair Nil Nil))
|
||||
|
||||
(check-type
|
||||
(split (Cons (Pair 1 2) (Cons (Pair 3 4) Nil)))
|
||||
|
@ -133,9 +133,9 @@
|
|||
(Cons (Pair a b) (combine (Pair a* b*)))])])]))
|
||||
|
||||
(check-type
|
||||
(combine (Pair (Nil {Int}) (Nil {Int})))
|
||||
(combine (Pair Nil Nil))
|
||||
: (List (** Int Int))
|
||||
⇒ (Nil {(** Int Int)}))
|
||||
⇒ Nil)
|
||||
|
||||
(check-type
|
||||
(combine (Pair (Cons 1 (Cons 2 Nil)) (Cons 3 (Cons 4 Nil))))
|
||||
|
@ -242,7 +242,7 @@
|
|||
(Cons x (merge (Pair x* yy*)))
|
||||
(Cons y (merge (Pair xx* y*))))])])]))
|
||||
|
||||
(define (mergesort {x* : (List Int)} → (List Int))
|
||||
(define (mergesort [x* : (List Int)] → (List Int))
|
||||
(match x* with
|
||||
[Nil -> Nil]
|
||||
[Cons h t ->
|
||||
|
@ -253,10 +253,7 @@
|
|||
[Pair x* y* ->
|
||||
(merge (Pair (mergesort x*) (mergesort y*)))])])]))
|
||||
|
||||
(check-type
|
||||
(mergesort (Nil {Int}))
|
||||
: (List Int)
|
||||
⇒ (Nil {Int}))
|
||||
(check-type (mergesort Nil) : (List Int) ⇒ Nil)
|
||||
|
||||
(check-type
|
||||
(mergesort (Cons 1 (Cons 2 (Cons 3 (Cons 4 Nil)))))
|
||||
|
@ -284,10 +281,7 @@
|
|||
(Cons h Nil)
|
||||
(quicksort (filter (λ ([y : Int]) (if (> y h) True False)) t))))])]))
|
||||
|
||||
(check-type
|
||||
(quicksort (Nil {Int}))
|
||||
: (List Int)
|
||||
⇒ (Nil {Int}))
|
||||
(check-type (quicksort Nil) : (List Int) ⇒ Nil)
|
||||
|
||||
(check-type
|
||||
(quicksort (Cons 1 (Cons 2 (Cons 3 (Cons 4 Nil)))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user