Skip to content

Commit

Permalink
More review and diff-reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
ncik-roberts committed Nov 13, 2023
1 parent b91b4da commit dcc6afa
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
10 changes: 9 additions & 1 deletion src/ocaml/typing/ctype.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ let copy_sep ~copy_scope ~fixed ~(visited : type_expr TypeHash.t) sch =
let univars = free ty in
if is_Tvar ty || may_share && TypeSet.is_empty univars then
if get_level ty <> generic_level then ty else
(* jkind not consulted during copy_sep, so Any is safe *)
let t = newstub ~scope:(get_scope ty) (Jkind.any ~why:Dummy_jkind) in
add_delayed_copy t ty;
t
Expand Down Expand Up @@ -2165,7 +2166,14 @@ let is_immediate64 env ty =
Btype.backtrack snap;
result
else
perform_check ()
(* CR layouts v2.8: Remove the backtracking once mode crossing is
implemented correctly; it's needed for now because checking whether
a jkind is immediate (rightly) sets the sort to be Value. It worked
previous to this patch because the subjkind check failed earlier. *)
let snap = Btype.snapshot () in
let result = perform_check () in
Btype.backtrack snap;
result

(* We will require Int63 to be [global many unique] on 32-bit platforms, so
this is fine *)
Expand Down
8 changes: 4 additions & 4 deletions src/ocaml/typing/ctype.mli
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,12 @@ val remove_mode_and_jkind_variables: type_expr -> unit
(* Ensure mode and jkind variables are fully determined *)

val nongen_vars_in_schema: Env.t -> type_expr -> Btype.TypeSet.t option
(* Return any non-generic variables in the type scheme,
and ensure mode variables are fully determined *)
(* Return any non-generic variables in the type scheme. Also ensures
mode variables are fully determined. *)

val nongen_vars_in_class_declaration:class_declaration -> Btype.TypeSet.t option
(* Return any non-generic variables in the class type, and ensures mode
variables are fully determined. Uses the empty environment. *)
(* Return any non-generic variables in the class type. Also ensures
mode variables are fully determined. Uses the empty environment. *)

type variable_kind = Row_variable | Type_variable
type closed_class_failure = {
Expand Down
4 changes: 2 additions & 2 deletions src/ocaml/typing/datarepr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ let constructor_descrs ~current_unit ty_path decl cstrs rep =
let all_void = all_void jkinds in
if all_void then incr num_consts else incr num_nonconsts;
all_void)
cstr_arg_jkinds
cstr_arg_jkindsNick Roberts
in
let describe_constructor (src_index, const_tag, nonconst_tag, acc)
{cd_id; cd_args; cd_res; cd_loc; cd_attributes; cd_uid} =
Expand All @@ -130,7 +130,7 @@ let constructor_descrs ~current_unit ty_path decl cstrs rep =
(* This is the representation of the inner record, IF there is one *)
let record_repr = Record_inlined (cstr_tag, rep) in
constructor_args ~current_unit decl.type_private cd_args cd_res
(Path.Pextra_ty (ty_path, Pcstr_ty cstr_name)) record_repr
Path.(Pextra_ty (ty_path, Pcstr_ty cstr_name)) record_repr
in
let cstr =
{ cstr_name;
Expand Down
4 changes: 2 additions & 2 deletions src/ocaml/typing/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2870,8 +2870,8 @@ let add_language_extension_types env =
turned on. We can't do this at startup because command line flags haven't
been parsed yet. So, we make the initial environment lazy.
If language extensions are adjusted after [initial_safe_string] and
[initial_unsafe_string] are forced, these environments may be inaccurate.
If language extensions are adjusted after [initial] is forced, these
environments may be inaccurate.
*)
let initial = add_language_extension_types initial

Expand Down
9 changes: 4 additions & 5 deletions src/ocaml/typing/env.mli
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ type address =
type t

val empty: t
(* This environment is lazy so that it may depend on the enabled
extensions, typically adjusted via command line flags. If extensions are
changed after this environment is forced, it may be inaccurate. This
could happen, for example, if extensions are adjusted via the
compiler-libs. *)
(* This environment is lazy so that it may depend on the enabled extensions,
typically adjusted via command line flags. If extensions are changed after
theis environment is forced, they may be inaccurate. This could happen, for
example, if extensions are adjusted via the compiler-libs. *)
val initial: t Lazy.t
val diff: t -> t -> Ident.t list

Expand Down

0 comments on commit dcc6afa

Please sign in to comment.