blob: 1e98cca59deb799c681e59913e12e49c19b27f45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
(* TEST
* expect
*)
type t = A of {mutable x: int};;
fun (A r) -> r.x <- 42;;
[%%expect{|
type t = A of { mutable x : int; }
- : t -> unit = <fun>
|}];;
(* Check that mutability is blocked for inline records on private types *)
type t = private A of {mutable x: int};;
fun (A r) -> r.x <- 42;;
[%%expect{|
type t = private A of { mutable x : int; }
Line 2, characters 15-16:
2 | fun (A r) -> r.x <- 42;;
^
Error: Cannot assign field x of the private type t.A
|}];;
|