Skip to content

Commit a9eebbf

Browse files
committed
new solver
1 parent 4da7b00 commit a9eebbf

Some content is hidden

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

49 files changed

+3228
-2051
lines changed

chamelon/compat.jst.ml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ open Types
33
open Mode
44

55
let dummy_jkind = Jkind.value ~why:Type_argument
6-
let dummy_value_mode = Value.legacy
6+
let dummy_value_mode = Value.disallow_right Value.legacy
77
let mkTvar name = Tvar { name; jkind = dummy_jkind }
88

99
let mkTarrow (label, t1, t2, comm) =
@@ -16,18 +16,22 @@ let mkTexp_ident ?id:(ident_kind, uu = (Id_value, shared_many_use))
1616
Texp_ident (path, longident, vd, ident_kind, uu)
1717

1818
type nonrec apply_arg = apply_arg
19-
type texp_apply_identifier = apply_position * Locality.t
19+
type texp_apply_identifier = apply_position * Locality.l
2020

21-
let mkTexp_apply ?id:(pos, mode = (Default, Locality.legacy)) (exp, args) =
21+
let mkTexp_apply
22+
?id:(pos, mode = (Default, Locality.disallow_right Locality.legacy))
23+
(exp, args) =
2224
Texp_apply (exp, args, pos, mode)
2325

24-
type texp_tuple_identifier = Alloc.t
26+
type texp_tuple_identifier = Alloc.r
2527

26-
let mkTexp_tuple ?id:(mode = Alloc.legacy) exps = Texp_tuple (exps, mode)
28+
let mkTexp_tuple ?id:(mode = Alloc.disallow_left Alloc.legacy) exps =
29+
Texp_tuple (exps, mode)
2730

28-
type texp_construct_identifier = Alloc.t option
31+
type texp_construct_identifier = Alloc.r option
2932

30-
let mkTexp_construct ?id:(mode = Some Alloc.legacy) (name, desc, args) =
33+
let mkTexp_construct ?id:(mode = Some (Alloc.disallow_left Alloc.legacy))
34+
(name, desc, args) =
3135
Texp_construct (name, desc, args, mode)
3236

3337
type texp_function = {
@@ -38,8 +42,8 @@ type texp_function = {
3842

3943
type texp_function_identifier = {
4044
partial : partial;
41-
arg_mode : Alloc.t;
42-
alloc_mode : Alloc.t;
45+
arg_mode : Alloc.l;
46+
alloc_mode : Alloc.r;
4347
region : bool;
4448
curry : fun_curry_state;
4549
warnings : Warnings.state;
@@ -50,10 +54,10 @@ type texp_function_identifier = {
5054
let texp_function_defaults =
5155
{
5256
partial = Total;
53-
arg_mode = Alloc.legacy;
54-
alloc_mode = Alloc.legacy;
57+
arg_mode = Alloc.disallow_right Alloc.legacy;
58+
alloc_mode = Alloc.disallow_left Alloc.legacy;
5559
region = false;
56-
curry = Final_arg { partial_mode = Alloc.legacy };
60+
curry = Final_arg { partial_mode = Alloc.disallow_right Alloc.legacy };
5761
warnings = Warnings.backup ();
5862
arg_sort = Jkind.Sort.value;
5963
ret_sort = Jkind.Sort.value;
@@ -144,12 +148,12 @@ let view_texp (e : expression_desc) =
144148
| Texp_match (e, sort, cases, partial) -> Texp_match (e, cases, partial, sort)
145149
| _ -> O e
146150

147-
type tpat_var_identifier = Value.t
151+
type tpat_var_identifier = Value.l
148152

149153
let mkTpat_var ?id:(mode = dummy_value_mode) (ident, name) =
150154
Tpat_var (ident, name, Uid.internal_not_actually_unique, mode)
151155

152-
type tpat_alias_identifier = Value.t
156+
type tpat_alias_identifier = Value.l
153157

154158
let mkTpat_alias ?id:(mode = dummy_value_mode) (p, ident, name) =
155159
Tpat_alias (p, ident, name, Uid.internal_not_actually_unique, 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, vd.val_uid, Mode.Value.legacy);
381+
{ pat_desc = Tpat_var(id, mknoloc name, vd.val_uid, Mode.Value.disallow_right Mode.Value.legacy);
382382
pat_loc = loc;
383383
pat_extra = [];
384384
pat_type = exp.exp_type;

ocaml/.depend

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,12 +1080,25 @@ typing/jkind.cmi : \
10801080
parsing/jane_asttypes.cmi \
10811081
typing/ident.cmi
10821082
typing/mode.cmo : \
1083-
utils/misc.cmi \
1083+
typing/solver_intf.cmi \
1084+
typing/solver.cmi \
1085+
typing/mode_intf.cmi \
10841086
typing/mode.cmi
10851087
typing/mode.cmx : \
1086-
utils/misc.cmx \
1088+
typing/solver_intf.cmx \
1089+
typing/solver.cmx \
1090+
typing/mode_intf.cmx \
10871091
typing/mode.cmi
1088-
typing/mode.cmi :
1092+
typing/mode.cmi : \
1093+
typing/mode_intf.cmi
1094+
typing/mode_intf.cmo : \
1095+
typing/solver_intf.cmi \
1096+
typing/mode_intf.cmi
1097+
typing/mode_intf.cmx : \
1098+
typing/solver_intf.cmx \
1099+
typing/mode_intf.cmi
1100+
typing/mode_intf.cmi : \
1101+
typing/solver_intf.cmi
10891102
typing/mtype.cmo : \
10901103
typing/types.cmi \
10911104
typing/subst.cmi \
@@ -1342,6 +1355,7 @@ typing/printtyp.cmo : \
13421355
parsing/parsetree.cmi \
13431356
typing/outcometree.cmi \
13441357
typing/oprint.cmi \
1358+
typing/mode_intf.cmi \
13451359
typing/mode.cmi \
13461360
utils/misc.cmi \
13471361
parsing/longident.cmi \
@@ -1367,6 +1381,7 @@ typing/printtyp.cmx : \
13671381
parsing/parsetree.cmi \
13681382
typing/outcometree.cmi \
13691383
typing/oprint.cmx \
1384+
typing/mode_intf.cmx \
13701385
typing/mode.cmx \
13711386
utils/misc.cmx \
13721387
parsing/longident.cmx \
@@ -1403,6 +1418,7 @@ typing/printtyped.cmo : \
14031418
parsing/location.cmi \
14041419
typing/jkind.cmi \
14051420
parsing/jane_syntax.cmi \
1421+
parsing/jane_syntax.cmi \
14061422
typing/ident.cmi \
14071423
utils/clflags.cmi \
14081424
parsing/asttypes.cmi \
@@ -1418,6 +1434,7 @@ typing/printtyped.cmx : \
14181434
parsing/location.cmx \
14191435
typing/jkind.cmx \
14201436
parsing/jane_syntax.cmx \
1437+
parsing/jane_syntax.cmx \
14211438
typing/ident.cmx \
14221439
utils/clflags.cmx \
14231440
parsing/asttypes.cmi \
@@ -1478,6 +1495,19 @@ typing/signature_group.cmx : \
14781495
typing/signature_group.cmi
14791496
typing/signature_group.cmi : \
14801497
typing/types.cmi
1498+
typing/solver.cmo : \
1499+
typing/solver_intf.cmi \
1500+
typing/solver.cmi
1501+
typing/solver.cmx : \
1502+
typing/solver_intf.cmx \
1503+
typing/solver.cmi
1504+
typing/solver.cmi : \
1505+
typing/solver_intf.cmi
1506+
typing/solver_intf.cmo : \
1507+
typing/solver_intf.cmi
1508+
typing/solver_intf.cmx : \
1509+
typing/solver_intf.cmi
1510+
typing/solver_intf.cmi :
14811511
typing/stypes.cmo : \
14821512
typing/typedtree.cmi \
14831513
typing/printtyp.cmi \
@@ -1660,6 +1690,7 @@ typing/typecore.cmo : \
16601690
parsing/parsetree.cmi \
16611691
typing/parmatch.cmi \
16621692
typing/mtype.cmi \
1693+
typing/mode_intf.cmi \
16631694
typing/mode.cmi \
16641695
utils/misc.cmi \
16651696
parsing/longident.cmi \
@@ -1698,6 +1729,7 @@ typing/typecore.cmx : \
16981729
parsing/parsetree.cmi \
16991730
typing/parmatch.cmx \
17001731
typing/mtype.cmx \
1732+
typing/mode_intf.cmx \
17011733
typing/mode.cmx \
17021734
utils/misc.cmx \
17031735
parsing/longident.cmx \
@@ -2085,6 +2117,7 @@ typing/typeopt.cmi : \
20852117
typing/jkind.cmi \
20862118
typing/env.cmi
20872119
typing/types.cmo : \
2120+
typing/solver.cmi \
20882121
typing/shape.cmi \
20892122
typing/primitive.cmi \
20902123
typing/path.cmi \
@@ -2100,6 +2133,7 @@ typing/types.cmo : \
21002133
parsing/asttypes.cmi \
21012134
typing/types.cmi
21022135
typing/types.cmx : \
2136+
typing/solver.cmx \
21032137
typing/shape.cmx \
21042138
typing/primitive.cmx \
21052139
typing/path.cmx \
@@ -2134,6 +2168,7 @@ typing/typetexp.cmo : \
21342168
typing/path.cmi \
21352169
parsing/parsetree.cmi \
21362170
typing/oprint.cmi \
2171+
typing/mode_intf.cmi \
21372172
typing/mode.cmi \
21382173
utils/misc.cmi \
21392174
parsing/longident.cmi \
@@ -2160,6 +2195,7 @@ typing/typetexp.cmx : \
21602195
typing/path.cmx \
21612196
parsing/parsetree.cmi \
21622197
typing/oprint.cmx \
2198+
typing/mode_intf.cmx \
21632199
typing/mode.cmx \
21642200
utils/misc.cmx \
21652201
parsing/longident.cmx \

ocaml/compilerlibs/Makefile.compilerlibs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ PARSING_CMI = \
8181
parsing/parsetree.cmi
8282

8383
TYPING = \
84+
typing/solver_intf.cmo \
85+
typing/solver.cmo \
8486
typing/path.cmo \
8587
typing/jkind.cmo \
8688
typing/primitive.cmo \
8789
typing/shape.cmo \
90+
typing/mode_intf.cmo \
8891
typing/mode.cmo \
8992
typing/types.cmo \
9093
typing/btype.cmo \

ocaml/dune

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
tast_iterator tast_mapper signature_group cmt_format cms_format untypeast
7575
includemod includemod_errorprinter
7676
typetexp patterns printpat parmatch stypes typedecl typeopt rec_check
77-
typecore mode uniqueness_analysis
77+
typecore solver_intf solver mode_intf mode uniqueness_analysis
7878
typeclass typemod typedecl_variance typedecl_properties
7979
typedecl_separability cmt2annot
8080
; manual update: mli only files
@@ -300,6 +300,7 @@
300300
(typeopt.mli as compiler-libs/typeopt.mli)
301301
(rec_check.mli as compiler-libs/rec_check.mli)
302302
(typecore.mli as compiler-libs/typecore.mli)
303+
(solver.mli as compiler-libs/solver.mli)
303304
(mode.mli as compiler-libs/mode.mli)
304305
(uniqueness_analysis.mli as compiler-libs/uniqueness_analysis.mli)
305306
(typeclass.mli as compiler-libs/typeclass.mli)

ocaml/lambda/lambda.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type locality_mode = private
3838
| Alloc_heap
3939
| Alloc_local
4040

41-
(** For now we don't have strong update, and thus uniqueness is irrelevant in
41+
(** For now we don't have strong update, and thus uniqueness is irrelavent in
4242
middle and back-end; in the future this will be extended with uniqueness *)
4343
type alloc_mode = locality_mode
4444

0 commit comments

Comments
 (0)