Skip to content

Commit 0025f87

Browse files
committed
typing/predef support for atomic locations
This type will be used for ['a Atomic.Loc.t], as proposed in the RFC ocaml/RFCs#39 We implement this here to be able to use it in the stdlib later, after a bootstrap.
1 parent 4caaef0 commit 0025f87

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

typing/predef.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ and ident_lazy_t = ident_create "lazy_t"
4747
and ident_string = ident_create "string"
4848
and ident_extension_constructor = ident_create "extension_constructor"
4949
and ident_floatarray = ident_create "floatarray"
50+
and ident_atomic_loc = ident_create "atomic_loc"
5051

5152
let path_int = Pident ident_int
5253
and path_char = Pident ident_char
@@ -67,6 +68,7 @@ and path_lazy_t = Pident ident_lazy_t
6768
and path_string = Pident ident_string
6869
and path_extension_constructor = Pident ident_extension_constructor
6970
and path_floatarray = Pident ident_floatarray
71+
and path_atomic_loc = Pident ident_atomic_loc
7072

7173
let type_int = newgenty (Tconstr(path_int, [], ref Mnil))
7274
and type_char = newgenty (Tconstr(path_char, [], ref Mnil))
@@ -89,6 +91,7 @@ and type_string = newgenty (Tconstr(path_string, [], ref Mnil))
8991
and type_extension_constructor =
9092
newgenty (Tconstr(path_extension_constructor, [], ref Mnil))
9193
and type_floatarray = newgenty (Tconstr(path_floatarray, [], ref Mnil))
94+
and type_atomic_loc t = newgenty (Tconstr(path_atomic_loc, [t], ref Mnil))
9295

9396
let ident_match_failure = ident_create "Match_failure"
9497
and ident_out_of_memory = ident_create "Out_of_memory"
@@ -244,6 +247,9 @@ let build_initial_env add_type add_extension empty_env =
244247
|> add_type ident_extension_constructor
245248
|> add_type ident_float
246249
|> add_type ident_floatarray
250+
|> add_type1 ident_atomic_loc
251+
~variance:Variance.full
252+
~separability:Separability.Ind
247253
|> add_type ident_int ~immediate:Always
248254
|> add_type ident_int32
249255
|> add_type ident_int64

typing/predef.mli

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ val type_nativeint: type_expr
3434
val type_int32: type_expr
3535
val type_int64: type_expr
3636
val type_lazy_t: type_expr -> type_expr
37-
val type_extension_constructor:type_expr
38-
val type_floatarray:type_expr
37+
val type_extension_constructor: type_expr
38+
val type_floatarray: type_expr
39+
val type_atomic_loc: type_expr -> type_expr
3940

4041
val path_int: Path.t
4142
val path_char: Path.t

0 commit comments

Comments
 (0)