summaryrefslogtreecommitdiffstats
path: root/testsuite/tests/typing-misc/records.ml.reference
blob: f084d039db06e027012e48bc9b461bcf34a4adf4 (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

#   type t = { x : int; y : int; }
# Characters 5-6:
  {x=3;z=2};;
       ^
Error: Unbound record field z
# Characters 9-10:
  fun {x=3;z=2} -> ();;
           ^
Error: Unbound record field z
#     Characters 26-34:
  {x=3; contents=2};;
        ^^^^^^^^
Error: The record field contents belongs to the type 'a ref
       but is mixed here with fields of type t
#     type u = private { mutable u : int; }
# Characters 0-5:
  {u=3};;
  ^^^^^
Error: Cannot create values of the private type u
# Characters 11-12:
  fun x -> x.u <- 3;;
             ^
Error: Cannot assign field u of the private type u
#         module M : sig type t = { x : int; y : int; } end
#   val f : M.t -> int = <fun>
# val r : M.t = {M.x = 1; y = 2}
# val z : int = 3
#     type foo = { mutable y : int; }
# Characters 17-18:
  let f (r: int) = r.y <- 3;;
                   ^
Error: This expression has type int but an expression was expected of type
         foo
#     type foo = { y : int; z : int; }
# type bar = { x : int; }
#     Characters 20-21:
  let f (r: bar) = ({ r with z = 3 } : foo)
                      ^
Error: This expression has type bar but an expression was expected of type
         foo
# Characters 16-21:
  let r : foo = { ZZZ.x = 2 };;
                  ^^^^^
Error: Unbound module ZZZ
#   Characters 2-7:
  (ZZZ.X : int option);;
   ^^^^^
Error: Unbound module ZZZ
#     Characters 41-50:
  let f (x : Complex.t) = x.Complex.z;;
                            ^^^^^^^^^
Error: Unbound record field Complex.z
#