Skip to content

Commit

Permalink
flambda-backend: exclave_ implies strictly local (#1554)
Browse files Browse the repository at this point in the history
  • Loading branch information
riaqn authored Jul 12, 2023
1 parent e3deedb commit bcc0a09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions testsuite/tests/typing-local/exclave.ml
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,15 @@ val f : unit -> local_ unit = <fun>
- : unit = ()
|}]

(* exclave means the inner body must be exactly at local; cannot be global *)
let f () =
exclave_ (
(fun x y -> ()) : (string -> string -> unit)
)
[%%expect{|
Line 3, characters 4-19:
3 | (fun x y -> ()) : (string -> string -> unit)
^^^^^^^^^^^^^^^
Error: This function or one of its parameters escape their region
when it is partially applied
|}]
2 changes: 1 addition & 1 deletion typing/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4454,7 +4454,7 @@ and type_expect_
| RTail (mode, _) ->
(* mode' is RNontail, because currently our language cannot construct
region in the tail of another region.*)
let mode' = mode_default mode in
let mode' = mode_exact mode in
(* The middle-end relies on all functions which allocate into their
parent's region having a return mode of local. *)
submode ~loc ~env ~reason:Other Value_mode.local mode';
Expand Down

0 comments on commit bcc0a09

Please sign in to comment.