Skip to content

Commit 6ea5a88

Browse files
authored
Basic uniqueness extension (#1552)
1 parent 7b2d263 commit 6ea5a88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+14443
-8990
lines changed

chamelon/compat.jst.ml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
open Typedtree
22
open Types
3+
open Mode
34

45
let dummy_layout = Layouts.Layout.value ~why:Type_argument
5-
let dummy_value_mode = { r_as_l = Amode Global; r_as_g = Amode Global }
6+
let dummy_value_mode = Value.legacy
67
let mkTvar name = Tvar { name; layout = dummy_layout }
78

89
let mkTarrow (label, t1, t2, comm) =
9-
Tarrow ((label, Amode Global, Amode Global), t1, t2, comm)
10+
Tarrow ((label, Alloc.legacy, Alloc.legacy), t1, t2, comm)
1011

11-
type texp_ident_identifier = ident_kind
12+
type texp_ident_identifier = ident_kind * unique_use
1213

13-
let mkTexp_ident ?id:(ident_kind = Id_value) (path, longident, vd) =
14-
Texp_ident (path, longident, vd, ident_kind)
14+
let mkTexp_ident ?id:(ident_kind, uu = (Id_value, shared_many_use))
15+
(path, longident, vd) =
16+
Texp_ident (path, longident, vd, ident_kind, uu)
1517

1618
type nonrec apply_arg = apply_arg
17-
type texp_apply_identifier = apply_position * alloc_mode
19+
type texp_apply_identifier = apply_position * Locality.t
1820

19-
let mkTexp_apply ?id:(pos, mode = (Default, Amode Global)) (exp, args) =
21+
let mkTexp_apply ?id:(pos, mode = (Default, Locality.legacy)) (exp, args) =
2022
Texp_apply (exp, args, pos, mode)
2123

22-
type texp_tuple_identifier = alloc_mode
24+
type texp_tuple_identifier = Alloc.t
2325

24-
let mkTexp_tuple ?id:(mode = Amode Global) exps = Texp_tuple (exps, mode)
26+
let mkTexp_tuple ?id:(mode = Alloc.legacy) exps = Texp_tuple (exps, mode)
2527

26-
type texp_construct_identifier = alloc_mode option
28+
type texp_construct_identifier = Alloc.t option
2729

28-
let mkTexp_construct ?id:(mode = Some (Amode Global)) (name, desc, args) =
30+
let mkTexp_construct ?id:(mode = Some Alloc.legacy) (name, desc, args) =
2931
Texp_construct (name, desc, args, mode)
3032

3133
type texp_function = {
@@ -36,8 +38,8 @@ type texp_function = {
3638

3739
type texp_function_identifier = {
3840
partial : partial;
39-
arg_mode : alloc_mode;
40-
alloc_mode : alloc_mode;
41+
arg_mode : Alloc.t;
42+
alloc_mode : Alloc.t;
4143
region : bool;
4244
curry : fun_curry_state;
4345
warnings : Warnings.state;
@@ -48,10 +50,10 @@ type texp_function_identifier = {
4850
let texp_function_defaults =
4951
{
5052
partial = Total;
51-
arg_mode = Amode Global;
52-
alloc_mode = Amode Global;
53+
arg_mode = Alloc.legacy;
54+
alloc_mode = Alloc.legacy;
5355
region = false;
54-
curry = Final_arg { partial_mode = Amode Global };
56+
curry = Final_arg { partial_mode = Alloc.legacy };
5557
warnings = Warnings.backup ();
5658
arg_sort = Layouts.Sort.value;
5759
ret_sort = Layouts.Sort.value;
@@ -106,8 +108,8 @@ type matched_expression_desc =
106108

107109
let view_texp (e : expression_desc) =
108110
match e with
109-
| Texp_ident (path, longident, vd, ident_kind) ->
110-
Texp_ident (path, longident, vd, ident_kind)
111+
| Texp_ident (path, longident, vd, ident_kind, uu) ->
112+
Texp_ident (path, longident, vd, (ident_kind, uu))
111113
| Texp_apply (exp, args, pos, mode) -> Texp_apply (exp, args, (pos, mode))
112114
| Texp_construct (name, desc, args, mode) ->
113115
Texp_construct (name, desc, args, mode)
@@ -142,12 +144,12 @@ let view_texp (e : expression_desc) =
142144
| Texp_match (e, sort, cases, partial) -> Texp_match (e, cases, partial, sort)
143145
| _ -> O e
144146

145-
type tpat_var_identifier = value_mode
147+
type tpat_var_identifier = Value.t
146148

147149
let mkTpat_var ?id:(mode = dummy_value_mode) (ident, name) =
148150
Tpat_var (ident, name, mode)
149151

150-
type tpat_alias_identifier = value_mode
152+
type tpat_alias_identifier = Value.t
151153

152154
let mkTpat_alias ?id:(mode = dummy_value_mode) (p, ident, name) =
153155
Tpat_alias (p, ident, name, mode)

native_toplevel/opttoploop.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ let name_expression ~loc ~attrs sort exp =
378378
in
379379
let sg = [Sig_value(id, vd, Exported)] in
380380
let pat =
381-
{ pat_desc = Tpat_var(id, mknoloc name, Types.Value_mode.global);
381+
{ pat_desc = Tpat_var(id, mknoloc name, Mode.Value.legacy);
382382
pat_loc = loc;
383383
pat_extra = [];
384384
pat_type = exp.exp_type;

0 commit comments

Comments
 (0)