Skip to content

Commit 528ec82

Browse files
authored
exclave_ implies strictly local (#1554)
1 parent f951994 commit 528ec82

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,15 @@ val f : unit -> local_ unit = <fun>
200200
- : unit = ()
201201
|}]
202202

203+
(* exclave means the inner body must be exactly at local; cannot be global *)
204+
let f () =
205+
exclave_ (
206+
(fun x y -> ()) : (string -> string -> unit)
207+
)
208+
[%%expect{|
209+
Line 3, characters 4-19:
210+
3 | (fun x y -> ()) : (string -> string -> unit)
211+
^^^^^^^^^^^^^^^
212+
Error: This function or one of its parameters escape their region
213+
when it is partially applied
214+
|}]

ocaml/typing/typecore.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4454,7 +4454,7 @@ and type_expect_
44544454
| RTail (mode, _) ->
44554455
(* mode' is RNontail, because currently our language cannot construct
44564456
region in the tail of another region.*)
4457-
let mode' = mode_default mode in
4457+
let mode' = mode_exact mode in
44584458
(* The middle-end relies on all functions which allocate into their
44594459
parent's region having a return mode of local. *)
44604460
submode ~loc ~env ~reason:Other Value_mode.local mode';

0 commit comments

Comments
 (0)