The graph below shows the results of testing type inferrers.
Read the nodes as follows:
1a. Term(begin)
should have typeunit
, but your interpreter failed with an uncaught exception.
2a. Term(car 3)
should trigger a uML error, but your interpreter failed with an uncaught exception.
3a. Term(cons (+ 1 2) '())
should have typeint list
, but your interpreter failed with an uncaught exception.
3b. Term(cons (+ 1 2) '())
should have typeint list
, but your interpreter failed with the messagetype error: Cannot unify int * int and int * int
.
4a. Term(val lists '(() ()))
should have typeforall 'a . 'a list list
, but your interpreter failed with an uncaught exception.
4b. Term(val lists '(() ()))
should have typeforall 'a . 'a list list
, but your interpreter failed with a uML error message.
5a. Term(val lists2 '((a) (1)))
should trigger a uML error, but your interpreter failed with an uncaught exception.
5b. Term(val lists2 '((a) (1)))
should trigger a uML error, but your interpreter inferred typesym list list
.
6a. Term(val lists3 '(() (1) ()))
should have typeint list list
, but your interpreter failed with an uncaught exception.
6b. Term(val lists3 '(() (1) ()))
should have typeint list list
, but your interpreter inferred typeforall 'a . 'a list list
.
6c. Term(val lists3 '(() (1) ()))
should have typeint list list
, but your interpreter failed with a uML error message.
7a. Term(lambda (l) (if (car l) '() '()))
should have typeforall 'a . bool list -> 'a list
, but your interpreter failed with an uncaught exception.
7b. Term(lambda (l) (if (car l) '() '()))
should have typeforall 'a . bool list -> 'a list
, but your interpreter inferred typeforall 'a, 'b . 'a -> 'b list
.
8a. Term(define f (x) (if x (car x) (f x)))
should trigger a uML error, but your interpreter failed with an uncaught exception.
8b. Term(define f (x) (if x (car x) (f x)))
should trigger a uML error, but your interpreter inferred a type for it.
9a. Term(lambda (x y z) (cons (cons x y) z))
should have typeforall 'a . 'a * 'a list * 'a list list -> 'a list list
, but your interpreter failed with an uncaught exception.
9b. Term(lambda (x y z) (cons (cons x y) z))
should have typeforall 'a . 'a * 'a list * 'a list list -> 'a list list
, but your interpreter inferred typeforall 'a . 'a list list * 'a list * 'a -> 'a list list
.
10a. Term(lambda (x) (begin (+ x 1) (if x 0 1)))
should trigger a uML error, but your interpreter failed with an uncaught exception.
10b. Term(lambda (x) (begin (+ x 1) (if x 0 1)))
should trigger a uML error, but your interpreter inferred typeforall 'a . 'a -> int
.
11a. Term(lambda (x) (let ((b (+ x 1))) (and (= b 1) x)))
should trigger a uML error, but your interpreter failed with an uncaught exception.
11b. Term(lambda (x) (let ((b (+ x 1))) (and (= b 1) x)))
should trigger a uML error, but your interpreter inferred typeint -> bool
.
12a. Term(val poly (letrec ((id (lambda (x) x))) (pair (id 0) (id #t))))
should have typeint * bool
, but your interpreter failed with an uncaught exception.
12b. Term(val poly (letrec ((id (lambda (x) x))) (pair (id 0) (id #t))))
should have typeint * bool
, but your interpreter failed with the messagetype error: Cannot unify int and bool
.
13a. Term(letrec ((x (lambda (y) y))(z (lambda (y) (x y)))) (z 3))
should have typeint
, but your interpreter failed with an uncaught exception.
13b. Term(letrec ((x (lambda (y) y))(z (lambda (y) (x y)))) (z 3))
should have typeint
, but your interpreter inferred typeforall 'a . 'a
.
13c. Term(letrec ((x (lambda (y) y))(z (lambda (y) (x y)))) (z 3))
should have typeint
, but your interpreter failed with the messagevariable x not found
.
14a. Term(letrec ((func (lambda (a b num) (if a b (+ 1 num))))) func)
should have typebool * int * int -> int
, but your interpreter failed with an uncaught exception.
14b. Term(letrec ((func (lambda (a b num) (if a b (+ 1 num))))) func)
should have typebool * int * int -> int
, but your interpreter inferred typeforall 'a . bool * int * int -> 'a
.
15a. Term(letrec ((f (lambda (x) (g))) (g (lambda (x) (f)))) (o g f))
should trigger a uML error, but your interpreter failed with an uncaught exception.
15b. Term(letrec ((f (lambda (x) (g))) (g (lambda (x) (f)))) (o g f))
should trigger a uML error, but your interpreter inferred typeforall 'a, 'b . 'a -> 'b
.
16a. Term(define test3 (x) (if (= 0 x) 0 (+ x (test3 o test3) (- x 1))))
should trigger a uML error, but your interpreter failed with an uncaught exception.
17a. Term(let ((symnil (cdr (list1 'a))) (x 1)) (begin (cons x symnil)))
should trigger a uML error, but your interpreter failed with an uncaught exception.
17b. Term(let ((symnil (cdr (list1 'a))) (x 1)) (begin (cons x symnil)))
should trigger a uML error, but your interpreter inferred typeint list
.
18a. Term(letrec ((f (lambda (x) (+ 1 x))) (g (lambda (x) (f (not x))))) g)
should trigger a uML error, but your interpreter failed with an uncaught exception.
18b. Term(letrec ((f (lambda (x) (+ 1 x))) (g (lambda (x) (f (not x))))) g)
should trigger a uML error, but your interpreter inferred a type for it.
19a. Term(define f (x) (let ((g (lambda (x) (f x)))) (g f)))
should trigger a uML error, but your interpreter failed with an uncaught exception.
19b. Term(define f (x) (let ((g (lambda (x) (f x)))) (g f)))
should trigger a uML error, but your interpreter inferred typeforall 'a, 'b . 'a -> 'b
.
20a. Term(define g (x) (let ((a (+ x 1)) (b (and x #t))) x))
should trigger a uML error, but your interpreter failed with an uncaught exception.
20b. Term(define g (x) (let ((a (+ x 1)) (b (and x #t))) x))
should trigger a uML error, but your interpreter inferred typebool -> bool
.
21a. Term(letrec ((+ (lambda (x y) (and x y))) (foo (lambda (x y) (+ x y)))) (foo 1 2))
should trigger a uML error, but your interpreter failed with an uncaught exception.
21b. Term(letrec ((+ (lambda (x y) (and x y))) (foo (lambda (x y) (+ x y)))) (foo 1 2))
should trigger a uML error, but your interpreter inferred a type for it.
22a. Term(lambda (x) (letrec ((f (lambda (a) (cons (g a) '()))) (g (lambda (b) (cons (f b) '())))) (f x)))
should trigger a uML error, but your interpreter failed with an uncaught exception.
22b. Term(lambda (x) (letrec ((f (lambda (a) (cons (g a) '()))) (g (lambda (b) (cons (f b) '())))) (f x)))
should trigger a uML error, but your interpreter inferred typeforall 'a, 'b . 'a -> 'b list list list
.
23a. Term(define f (x) (letrec ((foo (lambda (vs) (if (null? vs) (+ x 1) (foo vs))))) (if x (foo '(1 2 3)) (foo '(4 5 6)))))
should trigger a uML error, but your interpreter failed with an uncaught exception.
23b. Term(define f (x) (letrec ((foo (lambda (vs) (if (null? vs) (+ x 1) (foo vs))))) (if x (foo '(1 2 3)) (foo '(4 5 6)))))
should trigger a uML error, but your interpreter inferred typeforall 'a, 'b . 'a -> 'b
.