File tree 2 files changed +23
-1
lines changed
testsuite/tests/typing-local
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -492,7 +492,10 @@ let simplify_lets lam =
492
492
| Lregion (l , _ ) ->
493
493
count bv l
494
494
| Lexclave l ->
495
- count bv l
495
+ (* Not safe in general to move code into an exclave, so block
496
+ single-use optimizations by treating them the same as lambdas
497
+ and loops *)
498
+ count Ident.Map. empty l
496
499
497
500
and count_default bv sw = match sw.sw_failaction with
498
501
| None -> ()
Original file line number Diff line number Diff line change @@ -192,3 +192,22 @@ val bar : 'a -> string = <fun>
192
192
- : string = "Some of 5"
193
193
|}]
194
194
195
+ (* Ensure that Alias bindings are not substituted by Simplif (PR1448) *)
196
+ type 'a glob = Glob of ('a [@ global])
197
+
198
+ let [@ inline never] return_local a = [% local] (Glob a)
199
+
200
+ let f () =
201
+ let (Glob x) = return_local 1 in
202
+ [% exclave]
203
+ (let (_ : _ ) = return_local 99 in
204
+ assert (x = 1 ))
205
+ ;;
206
+ f () ;;
207
+ [%% expect{|
208
+ type 'a glob = Glob of global_ 'a
209
+ val return_local : 'a -> local_ 'a glob = < fun>
210
+ val f : unit -> local_ unit = < fun>
211
+ - : unit = ()
212
+ |}]
213
+
You can’t perform that action at this time.
0 commit comments