~jojo/Carth

ref: 65fedc5ad30893bac36f128dac201ff7081f8e1b Carth/examples/err.carth -rw-r--r-- 790 bytes
65fedc5aJoJo Allow Box in pattern to dereference 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;; Main not defined
(define (main _) (printInt 1))

;; Invalid user type signature
;; (define: (invalid-user-type-signature x)
;;     (forall [a b c] (Fun a a))
;;   x)

;; Arity mismatch for constructor
;; (define arity-mismatch-for-constructor
;;   (match (Integ 1)
;;     [(Integ foo bar) foo]))

;; Conflicting definitions of variables in pattern
;; (define conflicting-defs-in-pat
;;   (match (IntPair 1 2)
;;     [(IntPair a a) a]))

;; Undefined constructor
;; (define undef-ctor ThisCtorIsUndefined)

;; Undefined variable
;; (define undef-var this-var-is-undefined)

;; Infinite type
;; (define infinite-type (Wrap infinite-type))

;; Type mismatch
(define type-mismatch (Integ "foo"))

;; Helpers
(type (Wrap a) (Wrap a))
(type Integ (Integ Int))
(type IntPair (IntPair Int Int))