summaryrefslogtreecommitdiff
path: root/testsuite/tests/typing-private/new.ml.reference
blob: 5f84c4a5ef82feff3cbd872a4e73460a622cd512 (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

#   module M1 : sig type 'a t val f : int t -> bool t end
#     module M2 : sig type 'a t = new int val f : int -> int val r : int ref end
#   module M3 : sig type 'a t val f : int t -> bool t end
#   Characters 52-54:
  module M4 : sig type 'a t  val r : int t ref end = M2;; (* should fail *)
                                                     ^^
Error: Signature mismatch:
       Modules do not match:
         sig type 'a t = new int val f : int -> int val r : int ref end
       is not included in
         sig type 'a t val r : int t ref end
       Values do not match:
         val r : int ref
       is not included in
         val r : int t ref
#     module M5 : sig type 'a t val f : int t -> bool t val r : int t ref end
#   module M6 : sig type 'a t = private int val f : int t -> bool t end
#     Characters 57-83:
    struct type 'a t = int end;;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
       Modules do not match:
         sig type 'a t = int end
       is not included in
         sig type 'a t = new int end
       Type declarations do not match:
         type 'a t = int
       is not included in
         type 'a t = new int
       A private or new type would be made transparent.
#     module M8 : sig type 'a t val f : int t ref -> int end
#     Characters 61-108:
    struct type 'a t = new int  let f x = ref x end;; (* should be ok *)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
       Modules do not match:
         sig type 'a t = new int val f : 'a -> 'a ref end
       is not included in
         sig type 'a t val f : int -> int t ref end
       Values do not match:
         val f : 'a -> 'a ref
       is not included in
         val f : int -> int t ref
#