diff --git a/ocaml/boot/ocamlc b/ocaml/boot/ocamlc index a1e00553e38..a985930b313 100755 Binary files a/ocaml/boot/ocamlc and b/ocaml/boot/ocamlc differ diff --git a/ocaml/boot/ocamllex b/ocaml/boot/ocamllex index 8b3aa5f3d6b..ba4dd62a955 100755 Binary files a/ocaml/boot/ocamllex and b/ocaml/boot/ocamllex differ diff --git a/ocaml/typing/jkind.ml b/ocaml/typing/jkind.ml index fc789e1713e..0373233e697 100644 --- a/ocaml/typing/jkind.ml +++ b/ocaml/typing/jkind.ml @@ -45,7 +45,6 @@ module Sort = struct let void = Const Void let value = Const Value - let float64 = Const Float64 let some_value = Some value @@ -59,6 +58,7 @@ module Sort = struct let new_var () = Var (ref None) + (* Post-condition: If the result is a [Var v], then [!v] is [None]. *) let rec get : t -> t = function | Const _ as t -> t | Var r as t -> begin match !r with @@ -70,20 +70,6 @@ module Sort = struct end end - (* This is constant-time if [var] was just returned from a previous call to - [get]. That's because [var] will always be [None] in that case. - *) - let var_constraint : var -> const option = fun r -> - match !r with - | None -> None - | Some t -> begin - match get t with - | Const const -> Some const - | Var { contents = None } -> None - | Var _ -> - Misc.fatal_error "[get] should return [Const _] or [Var None]" - end - let default_value : t option = Some (Const Value) let default_void : t option = Some (Const Void) let default_float64 : t option = Some (Const Float64) @@ -515,6 +501,7 @@ let sub_desc d1 d2 = match d1, d2 with | Var v1, Var v2 -> if v1 == v2 then Equal else Not_sub | Const _, Var _ | Var _, Const _ -> Not_sub +(* Post-condition: If the result is [Var v], then [!v] is [None]. *) let get_internal (lay : internal) : desc = match lay with | Any -> Const Any | Immediate -> Const Immediate diff --git a/ocaml/typing/jkind.mli b/ocaml/typing/jkind.mli index 605d247fe95..48f5006d777 100644 --- a/ocaml/typing/jkind.mli +++ b/ocaml/typing/jkind.mli @@ -50,11 +50,6 @@ module Sort : sig (** A sort variable that can be unified during type-checking. *) type var - (** Return the concrete constraint placed on the variable. This check is - constant-time if [var] was just returned from [Jkind.get]. - *) - val var_constraint : var -> const option - (** Create a new sort variable that can be unified. *) val new_var : unit -> t diff --git a/ocaml/typing/subst.ml b/ocaml/typing/subst.ml index 322950347b5..6e862a7c3a3 100644 --- a/ocaml/typing/subst.ml +++ b/ocaml/typing/subst.ml @@ -109,13 +109,7 @@ let with_additional_action (config : additional_action_config) s = | Const Immediate -> immediate | Const Immediate64 -> immediate64 | Const Float64 -> float64 - | Var var -> begin - match Jkind.Sort.var_constraint var with - | Some Void -> void - | Some Value -> value - | Some Float64 -> float64 - | None -> raise(Error (loc, Unconstrained_jkind_variable)) - end + | Var _ -> raise(Error (loc, Unconstrained_jkind_variable)) in Prepare_for_saving prepare_jkind in @@ -228,6 +222,8 @@ let newpersty desc = create_expr desc ~level:generic_level ~scope:Btype.lowest_level ~id:!new_id +(* CR layouts: remove this. While we're still developing, though, it might + be nice to get the location of this kind of error. *) (* We use a ref instead of passing [loc] as an argument to [typexp] because the ref requires no modifications to the body of [typexp], reducing the chance of merge conflicts. This location is not critical --