Skip to content

Commit 16559a2

Browse files
authored
flambda-backend: Clean up mode error printing (#2478)
* clean up mode error printing * better phrasing
1 parent bb82646 commit 16559a2

File tree

13 files changed

+343
-296
lines changed

13 files changed

+343
-296
lines changed

testsuite/tests/typing-local/crossing.ml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ let f : local_ _ -> _ =
5454
Line 2, characters 14-15:
5555
2 | fun x -> f' x
5656
^
57-
Error: This value escapes its region
58-
Hint: This argument cannot be local, because it is an argument in a tail call
57+
Error: This value escapes its region.
58+
Hint: This argument cannot be local,
59+
because it is an argument in a tail call.
5960
|}]
6061

6162
(* 2. constructor argument crosses mode at construction *)
@@ -71,7 +72,7 @@ let f : local_ _ -> bar =
7172
Line 2, characters 21-22:
7273
2 | fun n -> Bar0 (42, n)
7374
^
74-
Error: This value escapes its region
75+
Error: This value escapes its region.
7576
|}]
7677

7778
(* 3. record field crosses mode at construction *)
@@ -87,7 +88,7 @@ let f : local_ _ -> foo =
8788
Line 2, characters 24-25:
8889
2 | fun n -> {x = 42; y = n}
8990
^
90-
Error: This value escapes its region
91+
Error: This value escapes its region.
9192
|}]
9293

9394
(* 4. expression crosses mode when being constrained *)
@@ -103,7 +104,7 @@ let f : local_ _ -> _ =
103104
Line 2, characters 12-13:
104105
2 | fun n -> (n : string)
105106
^
106-
Error: This value escapes its region
107+
Error: This value escapes its region.
107108
|}]
108109

109110
(* 5. polymorphic variant arguments crosses mode on construction*)
@@ -119,7 +120,7 @@ let f : local_ _ -> [> `Text of string] =
119120
Line 2, characters 17-18:
120121
2 | fun n -> `Text n
121122
^
122-
Error: This value escapes its region
123+
Error: This value escapes its region.
123124
|}]
124125

125126
(* tuple elements crosses mode at construction *)
@@ -135,7 +136,7 @@ let f : local_ _ -> string * string =
135136
Line 2, characters 12-13:
136137
2 | fun n -> (n, n)
137138
^
138-
Error: This value escapes its region
139+
Error: This value escapes its region.
139140
|}]
140141

141142
(* array elements crosses mode at construction *)
@@ -151,7 +152,7 @@ let f: local_ _ -> string array =
151152
Line 2, characters 13-14:
152153
2 | fun n -> [|n; n|]
153154
^
154-
Error: This value escapes its region
155+
Error: This value escapes its region.
155156
|}]
156157

157158
(* after discussion with sdolan, we agree that
@@ -179,7 +180,7 @@ let f : local_ foo -> _ =
179180
Line 2, characters 11-14:
180181
2 | fun r -> r.y
181182
^^^
182-
Error: This value escapes its region
183+
Error: This value escapes its region.
183184
|}]
184185

185186
(* the expected type is not considered when mode crossing the result of
@@ -215,8 +216,9 @@ val g : string -> string = <fun>
215216
Line 6, characters 6-22:
216217
6 | g (local_ "world")
217218
^^^^^^^^^^^^^^^^
218-
Error: This value escapes its region
219-
Hint: This argument cannot be local, because it is an argument in a tail call
219+
Error: This value escapes its region.
220+
Hint: This argument cannot be local,
221+
because it is an argument in a tail call.
220222
|}]
221223

222224
(* the result of function application crosses mode *)
@@ -244,7 +246,7 @@ let g : _ -> _ =
244246
Line 2, characters 28-29:
245247
2 | fun () -> let x = f () in x
246248
^
247-
Error: This value escapes its region
249+
Error: This value escapes its region.
248250
|}]
249251

250252
(* constructor argument crosses modes upon pattern matching *)
@@ -276,7 +278,7 @@ let f : local_ bar -> _ =
276278
Line 4, characters 21-22:
277279
4 | | Bar0 (_, y) -> y
278280
^
279-
Error: This value escapes its region
281+
Error: This value escapes its region.
280282
|}]
281283

282284
(* record fields crosses modes upon pattern matching *)
@@ -306,7 +308,7 @@ let f : local_ foo -> _ =
306308
Line 4, characters 16-17:
307309
4 | | {y; _} -> y
308310
^
309-
Error: This value escapes its region
311+
Error: This value escapes its region.
310312
|}]
311313

312314
(* constraint crosses modes upon pattern matching *)
@@ -322,7 +324,7 @@ let f : local_ _ -> _ =
322324
Line 2, characters 22-23:
323325
2 | fun (x : string) -> x
324326
^
325-
Error: This value escapes its region
327+
Error: This value escapes its region.
326328
|}]
327329

328330

testsuite/tests/typing-local/exclave.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ let foo x =
6262
Line 5, characters 8-9:
6363
5 | ref y
6464
^
65-
Error: This value escapes its region
65+
Error: This value escapes its region.
6666
|}]
6767

6868
(* following we check error detection *)
@@ -84,7 +84,7 @@ let foo x =
8484
Line 3, characters 10-25:
8585
3 | let z = exclave_ Some y in
8686
^^^^^^^^^^^^^^^
87-
Error: Exclave expression should only be in tail position of the current region
87+
Error: Exclave expression should only be in tail position of the current region.
8888
|}]
8989

9090
(* following we test WHILE loop *)
@@ -108,7 +108,7 @@ let foo () =
108108
Line 3, characters 4-17:
109109
3 | (exclave_ ());
110110
^^^^^^^^^^^^^
111-
Error: Exclave expression should only be in tail position of the current region
111+
Error: Exclave expression should only be in tail position of the current region.
112112
|}]
113113

114114
(* following we test FOR loop *)
@@ -129,7 +129,7 @@ let foo () =
129129
Line 3, characters 4-17:
130130
3 | (exclave_ ());
131131
^^^^^^^^^^^^^
132-
Error: Exclave expression should only be in tail position of the current region
132+
Error: Exclave expression should only be in tail position of the current region.
133133
|}]
134134

135135
type t = { x : int option }
@@ -162,7 +162,7 @@ type data = { mutable a : string; }
162162
Line 6, characters 9-10:
163163
6 | x.a <- z;
164164
^
165-
Error: This value escapes its region
165+
Error: This value escapes its region.
166166
|}]
167167

168168
let foo x =

0 commit comments

Comments
 (0)