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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
(* TEST
* expect
*)
type t = (unit, unit, unit, unit) bar
;;
(* PR#7315: we expect the error location on "bar" instead of "(...) bar" *)
[%%expect{|
Line _, characters 34-37:
type t = (unit, unit, unit, unit) bar
^^^
Error: Unbound type constructor bar
|}];;
function (x :
#bar) -> ();;
(* we expect the location on "bar" instead of "#bar" *)
[%%expect{|
Line _, characters 1-4:
#bar) -> ();;
^^^
Error: Unbound class bar
|}];;
function
#bar -> ()
;;
(* we expect the location on "bar" instead of "#bar" *)
[%%expect{|
Line _, characters 1-4:
#bar -> ()
^^^
Error: Unbound type constructor bar
|}];;
new bar;;
(* we expect the location on "bar" instead of "new bar" *)
[%%expect{|
Line _, characters 4-7:
new bar;;
^^^
Error: Unbound class bar
|}];;
type t =
| Foo of unit [@deprecated]
| Bar;;
#warnings "@3";;
let x =
Foo ();;
(* "Foo ()": the whole construct, with arguments, is deprecated *)
[%%expect{|
type t = Foo of unit | Bar
Line _, characters 0-6:
Foo ();;
^^^^^^
Error (warning 3): deprecated: Foo
|}];;
function
Foo _ -> () | Bar -> ();;
(* "Foo _", the whole construct is deprecated *)
[%%expect{|
Line _, characters 0-5:
Foo _ -> () | Bar -> ();;
^^^^^
Error (warning 3): deprecated: Foo
|}];;
open Foo;;
(* the error location should be on "Foo" *)
[%%expect{|
Line _, characters 5-8:
open Foo;;
^^^
Error: Unbound module Foo
|}];;
#warnings "@33";; (* unused open statement *)
include (struct
open List
end);;
(* here we expect the error location to be
on "open List" as whole rather than "List" *)
[%%expect{|
Line _, characters 0-9:
open List
^^^^^^^^^
Error (warning 33): unused open Stdlib.List.
|}];;
type unknown += Foo;;
(* unknown, not the whole line *)
[%%expect{|
Line _, characters 5-12:
type unknown += Foo;;
^^^^^^^
Error: Unbound type constructor unknown
|}];;
type t = ..;;
type t +=
Foo = Foobar;;
(* Foobar, not the whole line *)
[%%expect{|
type t = ..
Line _, characters 6-12:
Foo = Foobar;;
^^^^^^
Error: Unbound constructor Foobar
|}];;
|