Skip to content

Commit 9d77824

Browse files
authored
Ask user to add exclave_ instead of local_ (#1853)
* ask user to add exclave_ instead of local_ * fix tests
1 parent e91a7dd commit 9d77824

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

ocaml/testsuite/tests/typing-local/local.ml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Line 3, characters 2-3:
99
3 | r
1010
^
1111
Error: This local value escapes its region
12-
Hint: Cannot return local value without an explicit "local_" annotation
12+
Hint: Cannot return local value without an "exclave_" annotation
1313
|}]
1414

1515
external idint : local_ int -> int = "%identity"
@@ -40,7 +40,7 @@ Line 3, characters 2-3:
4040
3 | r
4141
^
4242
Error: This local value escapes its region
43-
Hint: Cannot return local value without an explicit "local_" annotation
43+
Hint: Cannot return local value without an "exclave_" annotation
4444
|}]
4545

4646
let leak n =
@@ -51,7 +51,7 @@ Line 3, characters 2-3:
5151
3 | r
5252
^
5353
Error: This local value escapes its region
54-
Hint: Cannot return local value without an explicit "local_" annotation
54+
Hint: Cannot return local value without an "exclave_" annotation
5555
|}]
5656

5757
let leak n =
@@ -62,7 +62,7 @@ Line 3, characters 2-3:
6262
3 | f
6363
^
6464
Error: This local value escapes its region
65-
Hint: Cannot return local value without an explicit "local_" annotation
65+
Hint: Cannot return local value without an "exclave_" annotation
6666
|}]
6767

6868
let leak n =
@@ -73,7 +73,7 @@ Line 3, characters 2-3:
7373
3 | f
7474
^
7575
Error: This local value escapes its region
76-
Hint: Cannot return local value without an explicit "local_" annotation
76+
Hint: Cannot return local value without an "exclave_" annotation
7777
|}]
7878

7979
(* If both type and mode are wrong, complain about type *)
@@ -268,7 +268,7 @@ Line 1, characters 15-21:
268268
1 | let apply2 x = f4 x x
269269
^^^^^^
270270
Error: This local value escapes its region
271-
Hint: Cannot return local value without an explicit "local_" annotation
271+
Hint: Cannot return local value without an "exclave_" annotation
272272
Hint: This is a partial application
273273
Adding 2 more arguments will make the value non-local
274274
|}]
@@ -278,7 +278,7 @@ Line 1, characters 15-23:
278278
1 | let apply3 x = f4 x x x
279279
^^^^^^^^
280280
Error: This local value escapes its region
281-
Hint: Cannot return local value without an explicit "local_" annotation
281+
Hint: Cannot return local value without an "exclave_" annotation
282282
Hint: This is a partial application
283283
Adding 1 more argument will make the value non-local
284284
|}]
@@ -316,7 +316,7 @@ Line 1, characters 15-18:
316316
1 | let apply1 x = g x
317317
^^^
318318
Error: This local value escapes its region
319-
Hint: Cannot return local value without an explicit "local_" annotation
319+
Hint: Cannot return local value without an "exclave_" annotation
320320
Hint: This is a partial application
321321
Adding 1 more argument will make the value non-local
322322
|}]
@@ -339,7 +339,7 @@ Line 1, characters 23-32:
339339
1 | let apply3_wrapped x = (g x x) x
340340
^^^^^^^^^
341341
Error: This local value escapes its region
342-
Hint: Cannot return local value without an explicit "local_" annotation
342+
Hint: Cannot return local value without an "exclave_" annotation
343343
Hint: This is a partial application
344344
Adding 1 more argument will make the value non-local
345345
|}]
@@ -476,7 +476,7 @@ Line 1, characters 52-65:
476476
1 | let app4' (f : b:local_ int ref -> a:int -> unit) = f ~b:(ref 42)
477477
^^^^^^^^^^^^^
478478
Error: This local value escapes its region
479-
Hint: Cannot return local value without an explicit "local_" annotation
479+
Hint: Cannot return local value without an "exclave_" annotation
480480
Hint: This is a partial application
481481
Adding 1 more argument will make the value non-local
482482
|}]
@@ -531,7 +531,7 @@ Line 1, characters 50-59:
531531
1 | let rapp3 (f : a:int -> unit -> local_ int ref) = f ~a:1 ()
532532
^^^^^^^^^
533533
Error: This local value escapes its region
534-
Hint: Cannot return local value without an explicit "local_" annotation
534+
Hint: Cannot return local value without an "exclave_" annotation
535535
|}]
536536

537537
let bug1 () =
@@ -546,7 +546,7 @@ Line 7, characters 2-5:
546546
7 | res
547547
^^^
548548
Error: This local value escapes its region
549-
Hint: Cannot return local value without an explicit "local_" annotation
549+
Hint: Cannot return local value without an "exclave_" annotation
550550
|}]
551551
let bug2 () =
552552
let foo : a:local_ string -> (b:local_ string -> (c:int -> unit)) =
@@ -655,7 +655,7 @@ Line 3, characters 25-31:
655655
3 | let local_ perm ~foo = f ~foo in
656656
^^^^^^
657657
Error: This local value escapes its region
658-
Hint: Cannot return local value without an explicit "local_" annotation
658+
Hint: Cannot return local value without an "exclave_" annotation
659659
Hint: This is a partial application
660660
Adding 1 more argument may make the value non-local
661661
|}]
@@ -677,7 +677,7 @@ Line 3, characters 2-5:
677677
3 | res
678678
^^^
679679
Error: This local value escapes its region
680-
Hint: Cannot return local value without an explicit "local_" annotation
680+
Hint: Cannot return local value without an "exclave_" annotation
681681
|}]
682682

683683
(* In principle. it would be sound to allow this one:
@@ -690,7 +690,7 @@ Line 3, characters 2-5:
690690
3 | res
691691
^^^
692692
Error: This local value escapes its region
693-
Hint: Cannot return local value without an explicit "local_" annotation
693+
Hint: Cannot return local value without an "exclave_" annotation
694694
|}]
695695

696696
let optret1 (f : ?x:int -> local_ (y:unit -> unit -> int)) = f ()
@@ -699,7 +699,7 @@ Line 1, characters 61-65:
699699
1 | let optret1 (f : ?x:int -> local_ (y:unit -> unit -> int)) = f ()
700700
^^^^
701701
Error: This local value escapes its region
702-
Hint: Cannot return local value without an explicit "local_" annotation
702+
Hint: Cannot return local value without an "exclave_" annotation
703703
Hint: This is a partial application
704704
Adding 1 more argument will make the value non-local
705705
|}]
@@ -1334,7 +1334,7 @@ Line 3, characters 2-3:
13341334
3 | r
13351335
^
13361336
Error: This local value escapes its region
1337-
Hint: Cannot return local value without an explicit "local_" annotation
1337+
Hint: Cannot return local value without an "exclave_" annotation
13381338
|}]
13391339

13401340
let foo x =
@@ -1488,7 +1488,7 @@ Line 3, characters 2-7:
14881488
3 | x.imm
14891489
^^^^^
14901490
Error: This local value escapes its region
1491-
Hint: Cannot return local value without an explicit "local_" annotation
1491+
Hint: Cannot return local value without an "exclave_" annotation
14921492
|}]
14931493
let foo (local_ x) = x.mut
14941494
[%%expect{|
@@ -1523,7 +1523,7 @@ Line 3, characters 2-5:
15231523
3 | imm
15241524
^^^
15251525
Error: This local value escapes its region
1526-
Hint: Cannot return local value without an explicit "local_" annotation
1526+
Hint: Cannot return local value without an "exclave_" annotation
15271527
|}]
15281528
let foo (local_ { mut }) = mut
15291529
[%%expect{|
@@ -2494,7 +2494,7 @@ Line 4, characters 20-22:
24942494
4 | | GFoo (_, s') -> s'
24952495
^^
24962496
Error: This local value escapes its region
2497-
Hint: Cannot return local value without an explicit "local_" annotation
2497+
Hint: Cannot return local value without an "exclave_" annotation
24982498
|}]
24992499
25002500
(* and regional gives regional *)
@@ -2558,7 +2558,7 @@ Line 3, characters 14-16:
25582558
3 | | [:s':] -> s'
25592559
^^
25602560
Error: This local value escapes its region
2561-
Hint: Cannot return local value without an explicit "local_" annotation
2561+
Hint: Cannot return local value without an "exclave_" annotation
25622562
|}]
25632563
25642564
let f (local_ a : string iarray) =
@@ -2625,7 +2625,7 @@ Line 11, characters 13-59:
26252625
11 | let f () = fold_until [] ~init:0 ~f:(fun _ _ -> Right ())
26262626
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26272627
Error: This local value escapes its region
2628-
Hint: Cannot return local value without an explicit "local_" annotation
2628+
Hint: Cannot return local value without an "exclave_" annotation
26292629
Hint: This is a partial application
26302630
Adding 1 more argument will make the value non-local
26312631
|}]

ocaml/typing/typecore.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8370,8 +8370,8 @@ let escaping_hint failure_reason submode_reason
83708370
begin match failure_reason, context with
83718371
| `Locality, Some Return ->
83728372
[ Location.msg
8373-
"@[Hint: Cannot return local value without an explicit@ \
8374-
\"local_\" annotation@]" ]
8373+
"@[Hint: Cannot return local value without an@ \
8374+
\"exclave_\" annotation@]" ]
83758375
| `Locality, Some Tailcall_argument ->
83768376
[ Location.msg
83778377
"@[Hint: This argument cannot be local, because this is a tail call@]" ]

0 commit comments

Comments
 (0)