This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
37
unikernel/duniverse/base/test/test_fn_local.mlt
Normal file
37
unikernel/duniverse/base/test/test_fn_local.mlt
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
open Base
|
||||
|
||||
(* [id] can operate on global arguments *)
|
||||
|
||||
let f : 'a. 'a -> 'a = Fn.id
|
||||
|
||||
[%%expect {| |}]
|
||||
|
||||
(* [id] can operate on local arguments *)
|
||||
|
||||
let f : 'a. local_ 'a -> local_ 'a = Fn.id
|
||||
|
||||
[%%expect {| |}]
|
||||
|
||||
(* [id] cannot make a local argument global; this would be unsound *)
|
||||
|
||||
let f : 'a. local_ 'a -> 'a = Fn.id
|
||||
|
||||
[%%expect
|
||||
{|
|
||||
Line _, characters _-_:
|
||||
Error: This expression has type local_ 'b -> local_ 'b
|
||||
but an expression was expected of type local_ 'a -> 'a
|
||||
|}]
|
||||
|
||||
(* [id] cannot make a global argument local; this is unexpected.
|
||||
If this following code gets accepted, it means that the meaning of
|
||||
[@local_opt] may have changed. However, the [f] below is not unsound. *)
|
||||
|
||||
let f : 'a. 'a -> local_ 'a = Fn.id
|
||||
|
||||
[%%expect
|
||||
{|
|
||||
Line _, characters _-_:
|
||||
Error: This expression has type 'b -> 'b
|
||||
but an expression was expected of type 'a -> local_ 'a
|
||||
|}]
|
||||
Loading…
Add table
Add a link
Reference in a new issue