|
260 | 260 | (check-type (Leaf 10) : (Tree Int)) |
261 | 261 | (check-type (Node (Leaf 10) (Leaf 11)) : (Tree Int)) |
262 | 262 |
|
263 | | -(typecheck-fail Nil #:with-msg "Nil: no expected type, add annotations") |
| 263 | +(check-type (λ () Nil) : (→/test {X} (List X))) |
264 | 264 | (typecheck-fail (Cons 1 (Nil {Bool})) |
265 | 265 | #:with-msg |
266 | 266 | "expected: \\(List Int\\)\n *given: \\(List Bool\\)") |
|
272 | 272 | (typecheck-fail (Cons {Bool} 1 Nil) |
273 | 273 | #:with-msg |
274 | 274 | (string-append |
275 | | - "Cons: type mismatch\n *expected: +Bool, \\(List Bool\\)\n *given: +Int, \\(List Bool\\)\n" |
| 275 | + "Cons: type mismatch\n *expected: +Bool, \\(List Bool\\)\n *given: +Int, \\(\\?∀ \\(\\) \\(List X\\)\\)\n" |
276 | 276 | " *expressions: 1, Nil")) |
277 | 277 |
|
278 | 278 | (typecheck-fail (match Nil with [Cons x xs -> 2] [Nil -> 1]) |
279 | | - #:with-msg "Nil: no expected type, add annotations") |
| 279 | + #:with-msg "match: add annotations") |
280 | 280 | (check-type |
281 | 281 | (match (Nil {Int}) with |
282 | 282 | [Cons x xs -> 2] |
|
385 | 385 | (check-type |
386 | 386 | ((λ ([x : X]) (λ ([y : Y]) (λ ([z : Z]) z))) 1) |
387 | 387 | : (→/test String (→ Int Int))) |
388 | | - |
389 | 388 | (check-type (inst Cons (→/test X X)) |
390 | 389 | : (→ (→/test X X) (List (→/test X X)) (List (→/test X X)))) |
391 | 390 | (check-type map : (→/test (→ X Y) (List X) (List Y))) |
392 | 391 |
|
393 | | -(check-type (Cons (λ ([x : X]) x) Nil) |
394 | | - : (List (→/test {X} X X))) |
| 392 | +#;(check-type (Cons (λ ([x : X]) x) Nil) |
| 393 | + : (List (→/test {X} X X))) |
395 | 394 |
|
396 | 395 | (define (nn [x : X] -> (→ (× X (→ Y Y)))) |
397 | 396 | (λ () (tup x (λ ([x : Y]) x)))) |
|
758 | 757 | (typecheck-fail |
759 | 758 | (if #t 1 "2") |
760 | 759 | #:with-msg |
761 | | - "branches have incompatible types: Int and String") |
| 760 | + "couldn't unify Int and String") |
762 | 761 |
|
763 | 762 | ;; tests from stlc+lit-tests.rkt -------------------------- |
764 | 763 | ; most should pass, some failing may now pass due to added types/forms |
|
788 | 787 |
|
789 | 788 | (typecheck-fail |
790 | 789 | (+ 1 (λ ([x : Int]) x)) |
791 | | - #:with-msg "expected: Int\n *given: \\(→ Int Int\\)") |
| 790 | + #:with-msg "couldn't unify Int and \\(\\?∀ \\(\\) \\(→ Int Int\\)\\)") |
792 | 791 | (typecheck-fail |
793 | 792 | (λ ([x : (→ Int Int)]) (+ x x)) |
794 | 793 | #:with-msg "expected: Int\n *given: \\(→ Int Int\\)") |
|
797 | 796 | #:with-msg "wrong number of arguments: expected 2, given 1\n *expected: +Int, Int\n *arguments: 1") |
798 | 797 |
|
799 | 798 | (check-type ((λ ([x : Int]) (+ x x)) 10) : Int ⇒ 20) |
800 | | - |
0 commit comments