summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/typing-extensions/open_types.ml.reference
blob: 4c143a564bdc873bfd1fa3d6c5afb39bf603376a (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

#   type foo = ..
#         type bar = foo = ..
#     type baz = foo = ..
#     type bar += Bar1 of int
#     type baz += Bar2 of int
#     module M : sig type bar += Foo of float end
#     module type S = sig type baz += Foo of float end
#     module M_S : S
#         type foo = ..
#     type bar = foo
#     Characters 13-23:
  type bar += Bar of int (* Error: type is not open *)
              ^^^^^^^^^^
Error: Cannot extend type definition bar
#     Characters 6-20:
  type baz = bar = .. (* Error: type kinds don't match *)
       ^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type bar
       Their kinds differ.
#         type 'a foo = ..
#     Characters 6-32:
  type ('a, 'b) bar = 'a foo = .. (* Error: arrities do not match *)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type 'a foo
       They have different arities.
#     type ('a, 'b) foo = ..
#     Characters 6-38:
  type ('a, 'b) bar = ('a, 'a) foo = .. (* Error: constraints do not match *)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This variant or record definition does not match that of type
         ('a, 'a) foo
       Their constraints differ.
#         type foo = ..
#     Characters 24-25:
  type bar = private foo = .. (* ERROR: Private abstract types cannot be open *)
                         ^
Error: Syntax error
#         module M : sig type foo = .. end
#     module type S = sig type foo end
#     module M_S : S
#     Characters 17-20:
  type M_S.foo += Foo (* ERROR: Cannot extend a type that isn't "open" *)
                  ^^^
Error: Cannot extend type definition M_S.foo
#         module M : sig type foo end
#     module type S = sig type foo = .. end
#     Characters 15-16:
  module M_S = (M : S) (* ERROR: Signatures are not compatible *)
                ^
Error: Signature mismatch:
       Modules do not match: sig type foo = M.foo end is not included in S
       Type declarations do not match:
         type foo = M.foo
       is not included in
         type foo = ..
       Their kinds differ.
#         module M : sig type +'a foo = .. type 'a bar = 'a foo = .. end
#     module type S = sig type 'a foo = .. type 'a bar = 'a foo = .. end
#     Characters 15-16:
  module M_S = (M : S) (* ERROR: Signatures are not compatible *)
                ^
Error: Signature mismatch:
       Modules do not match:
         sig type 'a foo = 'a M.foo = .. type 'a bar = 'a foo = .. end
       is not included in
         S
       Type declarations do not match:
         type 'a foo = 'a M.foo = ..
       is not included in
         type 'a foo = ..
       Their variances do not agree.
#         type exn2 = exn = ..
#             Characters 61-79:
  let f = function Foo -> ()
          ^^^^^^^^^^^^^^^^^^
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
_
Matching over values of extensible variant types must include
a wild card pattern in order to be exhaustive.
type foo = ..
type foo += Foo
val f : foo -> unit = <fun>
#