Skip to content

Shared borrowing #1997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions chamelon/compat.jst.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Types
open Mode

let dummy_jkind = Jkind.value ~why:Type_argument
let dummy_value_mode = Value.legacy
let dummy_value_mode = Value.disallow_right Value.legacy
let mkTvar name = Tvar { name; jkind = dummy_jkind }

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

type nonrec apply_arg = apply_arg
type texp_apply_identifier = apply_position * Locality.t
type texp_apply_identifier = apply_position * Locality.l

let mkTexp_apply ?id:(pos, mode = (Default, Locality.legacy)) (exp, args) =
let mkTexp_apply
?id:(pos, mode = (Default, Locality.disallow_right Locality.legacy))
(exp, args) =
Texp_apply (exp, args, pos, mode)

type texp_tuple_identifier = Alloc.t
type texp_tuple_identifier = Alloc.r

let mkTexp_tuple ?id:(mode = Alloc.legacy) exps = Texp_tuple (exps, mode)
let mkTexp_tuple ?id:(mode = Alloc.disallow_left Alloc.legacy) exps =
Texp_tuple (exps, mode)

type texp_construct_identifier = Alloc.t option
type texp_construct_identifier = Alloc.r option

let mkTexp_construct ?id:(mode = Some Alloc.legacy) (name, desc, args) =
let mkTexp_construct ?id:(mode = Some (Alloc.disallow_left Alloc.legacy))
(name, desc, args) =
Texp_construct (name, desc, args, mode)

type texp_function = {
Expand All @@ -38,8 +42,8 @@ type texp_function = {

type texp_function_identifier = {
partial : partial;
arg_mode : Alloc.t;
alloc_mode : Alloc.t;
arg_mode : Alloc.l;
alloc_mode : Alloc.r;
region : bool;
curry : fun_curry_state;
warnings : Warnings.state;
Expand All @@ -50,10 +54,10 @@ type texp_function_identifier = {
let texp_function_defaults =
{
partial = Total;
arg_mode = Alloc.legacy;
alloc_mode = Alloc.legacy;
arg_mode = Alloc.disallow_right Alloc.legacy;
alloc_mode = Alloc.disallow_left Alloc.legacy;
region = false;
curry = Final_arg { partial_mode = Alloc.legacy };
curry = Final_arg { partial_mode = Alloc.disallow_right Alloc.legacy };
warnings = Warnings.backup ();
arg_sort = Jkind.Sort.value;
ret_sort = Jkind.Sort.value;
Expand Down Expand Up @@ -146,12 +150,12 @@ let view_texp (e : expression_desc) =
| Texp_match (e, sort, cases, partial) -> Texp_match (e, cases, partial, sort)
| _ -> O e

type tpat_var_identifier = Value.t
type tpat_var_identifier = Value.l

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

type tpat_alias_identifier = Value.t
type tpat_alias_identifier = Value.l

let mkTpat_alias ?id:(mode = dummy_value_mode) (p, ident, name) =
Tpat_alias (p, ident, name, Uid.internal_not_actually_unique, mode)
Expand Down
2 changes: 1 addition & 1 deletion native_toplevel/opttoploop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ let name_expression ~loc ~attrs sort exp =
in
let sg = [Sig_value(id, vd, Exported)] in
let pat =
{ pat_desc = Tpat_var(id, mknoloc name, vd.val_uid, Mode.Value.legacy);
{ pat_desc = Tpat_var(id, mknoloc name, vd.val_uid, Mode.Value.disallow_right Mode.Value.legacy);
pat_loc = loc;
pat_extra = [];
pat_type = exp.exp_type;
Expand Down
39 changes: 38 additions & 1 deletion ocaml/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -1106,12 +1106,30 @@ typing/jkind.cmi : \
typing/ident.cmi \
parsing/builtin_attributes.cmi
typing/mode.cmo : \
typing/solver_intf.cmi \
typing/solver.cmi \
typing/mode_intf.cmi \
utils/misc.cmi \
typing/mode.cmi
typing/mode.cmx : \
typing/solver_intf.cmx \
typing/solver.cmx \
typing/mode_intf.cmx \
utils/misc.cmx \
typing/mode.cmi
typing/mode.cmi :
typing/mode.cmi : \
typing/mode_intf.cmi
typing/mode_intf.cmo : \
typing/solver_intf.cmi \
typing/solver.cmi \
typing/mode_intf.cmi
typing/mode_intf.cmx : \
typing/solver_intf.cmx \
typing/solver.cmx \
typing/mode_intf.cmi
typing/mode_intf.cmi : \
typing/solver_intf.cmi \
typing/solver.cmi
typing/mtype.cmo : \
typing/types.cmi \
typing/subst.cmi \
Expand Down Expand Up @@ -1222,6 +1240,7 @@ typing/patterns.cmo : \
typing/mode.cmi \
parsing/longident.cmi \
parsing/location.cmi \
typing/jkind.cmi \
typing/ident.cmi \
typing/env.cmi \
typing/ctype.cmi \
Expand All @@ -1233,6 +1252,7 @@ typing/patterns.cmx : \
typing/mode.cmx \
parsing/longident.cmx \
parsing/location.cmx \
typing/jkind.cmx \
typing/ident.cmx \
typing/env.cmx \
typing/ctype.cmx \
Expand All @@ -1243,6 +1263,7 @@ typing/patterns.cmi : \
typing/typedtree.cmi \
typing/mode.cmi \
parsing/longident.cmi \
typing/jkind.cmi \
typing/ident.cmi \
parsing/asttypes.cmi
typing/persistent_env.cmo : \
Expand Down Expand Up @@ -1489,6 +1510,22 @@ typing/signature_group.cmx : \
typing/signature_group.cmi
typing/signature_group.cmi : \
typing/types.cmi
typing/solver.cmo : \
typing/solver_intf.cmi \
typing/solver.cmi
typing/solver.cmx : \
typing/solver_intf.cmx \
typing/solver.cmi
typing/solver.cmi : \
typing/solver_intf.cmi
typing/solver_intf.cmo : \
utils/misc.cmi \
typing/solver_intf.cmi
typing/solver_intf.cmx : \
utils/misc.cmx \
typing/solver_intf.cmi
typing/solver_intf.cmi : \
utils/misc.cmi
typing/stypes.cmo : \
typing/typedtree.cmi \
typing/printtyp.cmi \
Expand Down
16,993 changes: 8,391 additions & 8,602 deletions ocaml/boot/menhir/parser.ml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions ocaml/compilerlibs/Makefile.compilerlibs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ PARSING_CMI = \
parsing/parsetree.cmi

TYPING = \
typing/solver_intf.cmo \
typing/solver.cmo \
typing/path.cmo \
typing/jkind.cmo \
typing/primitive.cmo \
typing/shape.cmo \
typing/mode_intf.cmo \
typing/mode.cmo \
typing/types.cmo \
typing/btype.cmo \
Expand Down
3 changes: 2 additions & 1 deletion ocaml/dune
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
tast_iterator tast_mapper signature_group cmt_format cms_format untypeast
includemod includemod_errorprinter
typetexp patterns printpat parmatch stypes typedecl typeopt rec_check
typecore mode uniqueness_analysis
typecore solver_intf solver mode_intf mode uniqueness_analysis
typeclass typemod typedecl_variance typedecl_properties
typedecl_separability cmt2annot
; manual update: mli only files
Expand Down Expand Up @@ -319,6 +319,7 @@
(typeopt.mli as compiler-libs/typeopt.mli)
(rec_check.mli as compiler-libs/rec_check.mli)
(typecore.mli as compiler-libs/typecore.mli)
(solver.mli as compiler-libs/solver.mli)
(mode.mli as compiler-libs/mode.mli)
(uniqueness_analysis.mli as compiler-libs/uniqueness_analysis.mli)
(typeclass.mli as compiler-libs/typeclass.mli)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/lambda/lambda.mli
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type locality_mode = private
| Alloc_heap
| Alloc_local

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

Expand Down
Loading