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 @@ -199,3 +199,22 @@ val bar : 'a -> string = <fun>
199
199
- : string = "Some of 5"
200
200
|}]
201
201
202
+ (* Ensure that Alias bindings are not substituted by Simplif (PR1448) *)
203
+ type 'a glob = Glob of ('a [@ global])
204
+
205
+ let [@ inline never] return_local a = [% local] (Glob a)
206
+
207
+ let f () =
208
+ let (Glob x) = return_local 1 in
209
+ [% exclave]
210
+ (let (_ : _ ) = return_local 99 in
211
+ assert (x = 1 ))
212
+ ;;
213
+ f () ;;
214
+ [%% expect{|
215
+ type 'a glob = Glob of global_ 'a
216
+ val return_local : 'a -> local_ 'a glob = < fun>
217
+ val f : unit -> local_ unit = < fun>
218
+ - : unit = ()
219
+ |}]
220
+
You can’t perform that action at this time.
0 commit comments