Skip to content

Commit f5ad50a

Browse files
committed
1 parent 436972c commit f5ad50a

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

macrotypes/examples/mlish.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
(require (only-in "sysf.rkt" ~∀ ∀ ∀? Λ))
1515
(reuse × tup proj define-type-alias #:from "stlc+rec-iso.rkt")
1616
(require (only-in "stlc+rec-iso.rkt" ~× ×?))
17-
(provide (rename-out [ext-stlc:and and] [ext-stlc:#%datum #%datum]))
17+
(provide (rename-out [ext-stlc:and and] [ext-stlc:#%datum #%datum])
18+
?∀)
1819
(reuse member length reverse list-ref cons nil isnil head tail list #:from "stlc+cons.rkt")
1920
(require (prefix-in stlc+cons: (only-in "stlc+cons.rkt" list cons nil)))
2021
(require (only-in "stlc+cons.rkt" ~List List? List))

macrotypes/examples/tests/mlish-tests.rkt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
(check-type (Leaf 10) : (Tree Int))
261261
(check-type (Node (Leaf 10) (Leaf 11)) : (Tree Int))
262262

263-
(typecheck-fail Nil #:with-msg "Nil: no expected type, add annotations")
263+
(check-type (λ () Nil) : (→/test {X} (List X)))
264264
(typecheck-fail (Cons 1 (Nil {Bool}))
265265
#:with-msg
266266
"expected: \\(List Int\\)\n *given: \\(List Bool\\)")
@@ -272,11 +272,11 @@
272272
(typecheck-fail (Cons {Bool} 1 Nil)
273273
#:with-msg
274274
(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"
276276
" *expressions: 1, Nil"))
277277

278278
(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")
280280
(check-type
281281
(match (Nil {Int}) with
282282
[Cons x xs -> 2]
@@ -385,13 +385,12 @@
385385
(check-type
386386
((λ ([x : X]) (λ ([y : Y]) (λ ([z : Z]) z))) 1)
387387
: (→/test String (→ Int Int)))
388-
389388
(check-type (inst Cons (→/test X X))
390389
: (→ (→/test X X) (List (→/test X X)) (List (→/test X X))))
391390
(check-type map : (→/test (→ X Y) (List X) (List Y)))
392391

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)))
395394

396395
(define (nn [x : X] -> (→ (× X (→ Y Y))))
397396
(λ () (tup x (λ ([x : Y]) x))))
@@ -758,7 +757,7 @@
758757
(typecheck-fail
759758
(if #t 1 "2")
760759
#:with-msg
761-
"branches have incompatible types: Int and String")
760+
"couldn't unify Int and String")
762761

763762
;; tests from stlc+lit-tests.rkt --------------------------
764763
; most should pass, some failing may now pass due to added types/forms
@@ -788,7 +787,7 @@
788787

789788
(typecheck-fail
790789
(+ 1 (λ ([x : Int]) x))
791-
#:with-msg "expected: Int\n *given: \\(→ Int Int\\)")
790+
#:with-msg "couldn't unify Int and \\(\\?∀ \\(\\) \\(→ Int Int\\)\\)")
792791
(typecheck-fail
793792
(λ ([x : (→ Int Int)]) (+ x x))
794793
#:with-msg "expected: Int\n *given: \\(→ Int Int\\)")
@@ -797,4 +796,3 @@
797796
#:with-msg "wrong number of arguments: expected 2, given 1\n *expected: +Int, Int\n *arguments: 1")
798797

799798
(check-type ((λ ([x : Int]) (+ x x)) 10) : Int ⇒ 20)
800-

macrotypes/examples/tests/mlish/match2.mlish

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
(match2 (B (tup 2 3)) with
1818
[A x -> x]
1919
[C (x,y) -> y]
20-
[B x -> x]) #:with-msg "couldn't unify \\(× Int Int\\) and Int")
20+
[B x -> x]) #:with-msg "couldn't unify Int and \\(× Int Int\\)")
2121

2222
(typecheck-fail
2323
(match2 (B (tup 2 3)) with
2424
[A x -> (tup x x)]
2525
[C x -> x]
2626
[B x -> x])
27-
#:with-msg "couldn't unify \\(× Int Int\\) and Int")
27+
#:with-msg "couldn't unify Int and \\(× Int Int\\)")
2828

2929
(check-type
3030
(match2 (B (tup 2 3)) with
@@ -52,7 +52,7 @@
5252
(match2 (A (tup 2 3)) with
5353
[B (x,y) -> y]
5454
[A x -> x]
55-
[C x -> x]) #:with-msg "couldn't unify \\(× Int Int\\) and Int")
55+
[C x -> x]) #:with-msg "couldn't unify Int and \\(× Int Int\\)")
5656

5757
(check-type
5858
(match2 (A 1) with

0 commit comments

Comments
 (0)