summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-warnings/pr7115.ml
blob: 64b1b377356a854729468c76f9c1d24f38defe44 (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
(* TEST
 flags = " -w +A -strict-sequence ";
 expect;
*)

type t = A : t;;
[%%expect {|
type t = A : t
|}]

module X1 : sig end = struct
  let _f ~x (* x unused argument *) = function
    | A -> let x = () in x
end;;
[%%expect {|
Line 2, characters 10-11:
2 |   let _f ~x (* x unused argument *) = function
              ^
Warning 27 [unused-var-strict]: unused variable x.

module X1 : sig end
|}]

module X2 : sig end = struct
  let x = 42 (* unused value *)
  let _f = function
    | A -> let x = () in x
end;;
[%%expect {|
Line 2, characters 6-7:
2 |   let x = 42 (* unused value *)
          ^
Warning 32 [unused-value-declaration]: unused value x.

module X2 : sig end
|}]

module X3 : sig end = struct
  module O = struct let x = 42 (* unused *) end
  open O (* unused open *)

  let _f = function
    | A -> let x = () in x
end;;
[%%expect {|
Line 2, characters 24-25:
2 |   module O = struct let x = 42 (* unused *) end
                            ^
Warning 32 [unused-value-declaration]: unused value x.

Line 3, characters 2-8:
3 |   open O (* unused open *)
      ^^^^^^
Warning 33 [unused-open]: unused open O.

module X3 : sig end
|}]