blob: f3e62e2b041c7a76bda8424121a24ab88fa68e17 (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
(* TEST
* expect
*)
let facto n = (* missing [rec] *)
if n = 0 then 1 else n * facto (n-1)
[%%expect{|
Line 2, characters 28-33:
2 | if n = 0 then 1 else n * facto (n-1)
^^^^^
Error: Unbound value facto
Hint: If this is a recursive definition,
you should add the 'rec' keyword on line 1
|}];;
let x = 3 in
let f x = f x in
()
[%%expect{|
Line 2, characters 10-11:
2 | let f x = f x in
^
Error: Unbound value f
Hint: If this is a recursive definition,
you should add the 'rec' keyword on line 2
|}];;
let f x = if x < 0 then x else h (x-1)
and g x = if x < 0 then x else f (x-1)
and h x = if x < 0 then x else g (x-1)
[%%expect{|
Line 1, characters 31-32:
1 | let f x = if x < 0 then x else h (x-1)
^
Error: Unbound value h
Hint: If this is a recursive definition,
you should add the 'rec' keyword on line 1
|}];;
let value1 = 3 in
let value2 = value2 (* typo: should be value1 *) + 1 in
()
[%%expect{|
Line 2, characters 13-19:
2 | let value2 = value2 (* typo: should be value1 *) + 1 in
^^^^^^
Error: Unbound value value2
Hint: Did you mean value1?
|}];;
let foobar1 () = () in
let foobar2 () = foobar2 () (* typo? or missing "rec"? *) in
()
[%%expect{|
Line 2, characters 17-24:
2 | let foobar2 () = foobar2 () (* typo? or missing "rec"? *) in
^^^^^^^
Error: Unbound value foobar2
Hint: Did you mean foobar1?
Hint: If this is a recursive definition,
you should add the 'rec' keyword on line 2
|}];;
|