Skip to content

Commit f4ca17e

Browse files
committed
Remove some dead code.
1 parent 55d7337 commit f4ca17e

File tree

3 files changed

+0
-79
lines changed

3 files changed

+0
-79
lines changed

compiler/ml/typetexp.ml

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ type error =
3030
| Unbound_type_constructor of Longident.t
3131
| Unbound_type_constructor_2 of Path.t
3232
| Type_arity_mismatch of Longident.t * int * int
33-
| Bound_type_variable of string
34-
| Recursive_type
35-
| Unbound_row_variable of Longident.t
3633
| Type_mismatch of (type_expr * type_expr) list
3734
| Alias_type_mismatch of (type_expr * type_expr) list
3835
| Present_has_conjunction of string
@@ -131,7 +128,6 @@ let find_constructor =
131128
let find_all_constructors =
132129
find_component Env.lookup_all_constructors (fun lid ->
133130
Unbound_constructor lid)
134-
let find_label = find_component Env.lookup_label (fun lid -> Unbound_label lid)
135131
let find_all_labels =
136132
find_component Env.lookup_all_labels (fun lid -> Unbound_label lid)
137133

@@ -232,11 +228,6 @@ let validate_name = function
232228
let new_global_var ?name () = new_global_var ?name:(validate_name name) ()
233229
let newvar ?name () = newvar ?name:(validate_name name) ()
234230

235-
let type_variable loc name =
236-
try Tbl.find name !type_variables
237-
with Not_found ->
238-
raise (Error (loc, Env.empty, Unbound_type_variable ("'" ^ name)))
239-
240231
let transl_type_param env styp =
241232
let loc = styp.ptyp_loc in
242233
match styp.ptyp_desc with
@@ -668,8 +659,6 @@ let make_fixed_univars ty =
668659
make_fixed_univars ty;
669660
Btype.unmark_type ty
670661

671-
let create_package_mty = create_package_mty false
672-
673662
let globalize_used_variables env fixed =
674663
let r = ref [] in
675664
Tbl.iter
@@ -709,40 +698,6 @@ let transl_simple_type env fixed styp =
709698
make_fixed_univars typ.ctyp_type;
710699
typ
711700

712-
let transl_simple_type_univars env styp =
713-
univars := [];
714-
used_variables := Tbl.empty;
715-
pre_univars := [];
716-
begin_def ();
717-
let typ = transl_type env Univars styp in
718-
(* Only keep already global variables in used_variables *)
719-
let new_variables = !used_variables in
720-
used_variables := Tbl.empty;
721-
Tbl.iter
722-
(fun name p ->
723-
if Tbl.mem name !type_variables then
724-
used_variables := Tbl.add name p !used_variables)
725-
new_variables;
726-
globalize_used_variables env false ();
727-
end_def ();
728-
generalize typ.ctyp_type;
729-
let univs =
730-
List.fold_left
731-
(fun acc v ->
732-
let v = repr v in
733-
match v.desc with
734-
| Tvar name when v.level = Btype.generic_level ->
735-
v.desc <- Tunivar name;
736-
v :: acc
737-
| _ -> acc)
738-
[] !pre_univars
739-
in
740-
make_fixed_univars typ.ctyp_type;
741-
{
742-
typ with
743-
ctyp_type = instance env (Btype.newgenty (Tpoly (typ.ctyp_type, univs)));
744-
}
745-
746701
let transl_simple_type_delayed env styp =
747702
univars := [];
748703
used_variables := Tbl.empty;
@@ -836,13 +791,6 @@ let report_error env ppf = function
836791
"@[The type constructor %a@ expects %i argument(s),@ but is here \
837792
applied to %i argument(s)@]"
838793
longident lid expected provided
839-
| Bound_type_variable name ->
840-
fprintf ppf "Already bound type parameter '%s" name
841-
| Recursive_type -> fprintf ppf "This type is recursive"
842-
| Unbound_row_variable lid ->
843-
(* we don't use "spellcheck" here: this error is not raised
844-
anywhere so it's unclear how it should be handled *)
845-
fprintf ppf "Unbound row variable in #%a" longident lid
846794
| Type_mismatch trace ->
847795
Printtyp.report_unification_error ppf Env.empty trace
848796
(function

compiler/ml/typetexp.mli

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ open Types
1919

2020
val transl_simple_type :
2121
Env.t -> bool -> Parsetree.core_type -> Typedtree.core_type
22-
val transl_simple_type_univars :
23-
Env.t -> Parsetree.core_type -> Typedtree.core_type
2422
val transl_simple_type_delayed :
2523
Env.t -> Parsetree.core_type -> Typedtree.core_type * (unit -> unit)
2624
(* Translate a type, but leave type variables unbound. Returns
2725
the type and a function that binds the type variable. *)
2826

2927
val transl_type_scheme : Env.t -> Parsetree.core_type -> Typedtree.core_type
3028
val reset_type_variables : unit -> unit
31-
val type_variable : Location.t -> string -> type_expr
3229
val transl_type_param : Env.t -> Parsetree.core_type -> Typedtree.core_type
3330

3431
type variable_context
@@ -42,9 +39,6 @@ type error =
4239
| Unbound_type_constructor of Longident.t
4340
| Unbound_type_constructor_2 of Path.t
4441
| Type_arity_mismatch of Longident.t * int * int
45-
| Bound_type_variable of string
46-
| Recursive_type
47-
| Unbound_row_variable of Longident.t
4842
| Type_mismatch of (type_expr * type_expr) list
4943
| Alias_type_mismatch of (type_expr * type_expr) list
5044
| Present_has_conjunction of string
@@ -80,11 +74,6 @@ val transl_modtype_longident :
8074
val transl_modtype :
8175
(* from Typemod *)
8276
(Env.t -> Parsetree.module_type -> Typedtree.module_type) ref
83-
val create_package_mty :
84-
Location.t ->
85-
Env.t ->
86-
Parsetree.package_type ->
87-
(Longident.t Asttypes.loc * Parsetree.core_type) list * Parsetree.module_type
8877

8978
val find_type : Env.t -> Location.t -> Longident.t -> Path.t * type_declaration
9079
val find_constructor :
@@ -94,7 +83,6 @@ val find_all_constructors :
9483
Location.t ->
9584
Longident.t ->
9685
(constructor_description * (unit -> unit)) list
97-
val find_label : Env.t -> Location.t -> Longident.t -> label_description
9886
val find_all_labels :
9987
Env.t ->
10088
Location.t ->
@@ -110,14 +98,3 @@ val find_modtype :
11098

11199
val unbound_constructor_error : Env.t -> Longident.t Location.loc -> 'a
112100
val unbound_label_error : Env.t -> Longident.t Location.loc -> 'a
113-
114-
val spellcheck :
115-
Format.formatter ->
116-
(('a -> 'a list -> 'a list) ->
117-
Longident.t option ->
118-
'b ->
119-
'c list ->
120-
string list) ->
121-
'b ->
122-
Longident.t ->
123-
unit

compiler/ml/variant_coercion.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ let variant_has_catch_all_case
2121

2222
constructors |> List.exists has_catch_all_string_case
2323

24-
let variant_has_relevant_primitive_catch_all
25-
(constructors : Types.constructor_declaration list) =
26-
variant_has_catch_all_case constructors can_coerce_primitive
27-
2824
(* Checks if every case of the variant has the same runtime representation as the target type. *)
2925
let variant_has_same_runtime_representation_as_target ~(target_path : Path.t)
3026
~unboxed (constructors : Types.constructor_declaration list) =

0 commit comments

Comments
 (0)