25 lines
412 B
Text
25 lines
412 B
Text
|
|
open! Base
|
||
|
|
|
||
|
|
(* first test that we only allow global elements *)
|
||
|
|
let local_id (local_ x) = x;;
|
||
|
|
|
||
|
|
let k = local_id 42 in
|
||
|
|
Array.create_local ~len:10 k
|
||
|
|
|
||
|
|
[%%expect
|
||
|
|
{|
|
||
|
|
Line _, characters _-_:
|
||
|
|
Error: This value escapes its region
|
||
|
|
|}]
|
||
|
|
;;
|
||
|
|
|
||
|
|
(* then check that the array is indeed local *)
|
||
|
|
let arr = Array.create_local ~len:10 42 in
|
||
|
|
ref arr
|
||
|
|
|
||
|
|
[%%expect
|
||
|
|
{|
|
||
|
|
Line _, characters _-_:
|
||
|
|
Error: This value escapes its region
|
||
|
|
|}]
|