Skip to content

Commit 319fd1f

Browse files
committed
Remove class_type_declaration
1 parent 323a030 commit 319fd1f

14 files changed

+1
-102
lines changed

jscomp/ml/btype.ml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ type type_iterators =
288288
it_module_declaration: type_iterators -> module_declaration -> unit;
289289
it_modtype_declaration: type_iterators -> modtype_declaration -> unit;
290290
it_class_declaration: type_iterators -> class_declaration -> unit;
291-
it_class_type_declaration: type_iterators -> class_type_declaration -> unit;
292291
it_module_type: type_iterators -> module_type -> unit;
293292
it_class_type: type_iterators -> class_type -> unit;
294293
it_type_kind: type_iterators -> type_kind -> unit;
@@ -351,10 +350,6 @@ let type_iterators =
351350
it.it_class_type it cd.cty_type;
352351
may (it.it_type_expr it) cd.cty_new;
353352
it.it_path cd.cty_path
354-
and it_class_type_declaration it ctd =
355-
List.iter (it.it_type_expr it) ctd.clty_params;
356-
it.it_class_type it ctd.clty_type;
357-
it.it_path ctd.clty_path
358353
and it_module_type it = function
359354
Mty_ident p
360355
| Mty_alias(_, p) -> it.it_path p
@@ -392,7 +387,7 @@ let type_iterators =
392387
in
393388
{ it_path; it_type_expr = it_do_type_expr; it_do_type_expr;
394389
it_type_kind; it_class_type; it_module_type;
395-
it_signature; it_class_type_declaration; it_class_declaration;
390+
it_signature; it_class_declaration;
396391
it_modtype_declaration; it_module_declaration; it_extension_constructor;
397392
it_type_declaration; it_value_description; it_signature_item; }
398393

jscomp/ml/btype.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ type type_iterators =
104104
it_module_declaration: type_iterators -> module_declaration -> unit;
105105
it_modtype_declaration: type_iterators -> modtype_declaration -> unit;
106106
it_class_declaration: type_iterators -> class_declaration -> unit;
107-
it_class_type_declaration: type_iterators -> class_type_declaration -> unit;
108107
it_module_type: type_iterators -> module_type -> unit;
109108
it_class_type: type_iterators -> class_type -> unit;
110109
it_type_kind: type_iterators -> type_kind -> unit;

jscomp/ml/ctype.ml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4580,19 +4580,6 @@ let nondep_class_declaration env id decl =
45804580
clear_hash ();
45814581
decl
45824582

4583-
let nondep_cltype_declaration env id decl =
4584-
assert (not (Path.isfree id decl.clty_path));
4585-
let decl =
4586-
{ clty_params = List.map (nondep_type_rec env id) decl.clty_params;
4587-
clty_variance = decl.clty_variance;
4588-
clty_type = nondep_class_type env id decl.clty_type;
4589-
clty_path = decl.clty_path;
4590-
clty_loc = decl.clty_loc;
4591-
clty_attributes = decl.clty_attributes;
4592-
}
4593-
in
4594-
clear_hash ();
4595-
decl
45964583

45974584
(* collapse conjunctive types in class parameters *)
45984585
let rec collapse_conj env visited ty =

jscomp/ml/ctype.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ val nondep_extension_constructor:
244244
val nondep_class_declaration:
245245
Env.t -> Ident.t -> class_declaration -> class_declaration
246246
(* Same for class declarations. *)
247-
val nondep_cltype_declaration:
248-
Env.t -> Ident.t -> class_type_declaration -> class_type_declaration
249247
(* Same for class type declarations. *)
250248
(*val correct_abbrev: Env.t -> Path.t -> type_expr list -> type_expr -> unit*)
251249
val cyclic_abbrev: Env.t -> Ident.t -> type_expr -> bool

jscomp/ml/includeclass.ml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@ open Types
2020
let class_types env cty1 cty2 =
2121
Ctype.match_class_types env cty1 cty2
2222

23-
let class_type_declarations ~loc env cty1 cty2 =
24-
Builtin_attributes.check_deprecated_inclusion
25-
~def:cty1.clty_loc
26-
~use:cty2.clty_loc
27-
loc
28-
cty1.clty_attributes cty2.clty_attributes
29-
(Path.last cty1.clty_path);
30-
Ctype.match_class_declarations env
31-
cty1.clty_params cty1.clty_type
32-
cty2.clty_params cty2.clty_type
33-
3423
let class_declarations env cty1 cty2 =
3524
match cty1.cty_new, cty2.cty_new with
3625
None, Some _ ->

jscomp/ml/includeclass.mli

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

2222
val class_types:
2323
Env.t -> class_type -> class_type -> class_match_failure list
24-
val class_type_declarations:
25-
loc:Location.t ->
26-
Env.t -> class_type_declaration -> class_type_declaration ->
27-
class_match_failure list
2824
val class_declarations:
2925
Env.t -> class_declaration -> class_declaration ->
3026
class_match_failure list

jscomp/ml/tast_mapper.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ type mapper =
2727

2828
class_signature: mapper -> class_signature -> class_signature;
2929
class_type: mapper -> class_type -> class_type;
30-
class_type_declaration: mapper -> class_type_declaration ->
31-
class_type_declaration;
3230
class_type_field: mapper -> class_type_field -> class_type_field;
3331
env: mapper -> Env.t -> Env.t;
3432
expr: mapper -> expression -> expression;
@@ -90,9 +88,6 @@ let module_declaration sub x =
9088

9189
let include_infos f x = {x with incl_mod = f x.incl_mod}
9290

93-
let class_type_declaration sub x =
94-
class_infos sub (sub.class_type sub) x
95-
9691

9792
let structure_item sub {str_desc; str_loc; str_env} =
9893
let str_env = sub.env sub str_env in
@@ -570,7 +565,6 @@ let default =
570565
class_description;
571566
class_signature;
572567
class_type;
573-
class_type_declaration;
574568
class_type_field;
575569
env;
576570
expr;

jscomp/ml/tast_mapper.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ type mapper =
2525
class_description: mapper -> class_description -> class_description;
2626
class_signature: mapper -> class_signature -> class_signature;
2727
class_type: mapper -> class_type -> class_type;
28-
class_type_declaration: mapper -> class_type_declaration ->
29-
class_type_declaration;
3028
class_type_field: mapper -> class_type_field -> class_type_field;
3129
env: mapper -> Env.t -> Env.t;
3230
expr: mapper -> expression -> expression;

jscomp/ml/typedecl.ml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,29 +1266,6 @@ let add_injectivity =
12661266
| Invariant -> (false, false, false)
12671267
)
12681268

1269-
(* for typeclass.ml *)
1270-
let compute_variance_decls env cldecls =
1271-
let decls, required =
1272-
List.fold_right
1273-
(fun (obj_id, obj_abbr, _cl_abbr, _clty, _cltydef, ci) (decls, req) ->
1274-
let variance = List.map snd ci.ci_params in
1275-
(obj_id, obj_abbr) :: decls,
1276-
(add_injectivity variance, ci.ci_loc) :: req)
1277-
cldecls ([],[])
1278-
in
1279-
let (decls, _) =
1280-
compute_properties_fixpoint env decls required
1281-
(List.map init_variance decls)
1282-
(List.map (fun _ -> false) decls)
1283-
in
1284-
List.map2
1285-
(fun (_,decl) (_, _, cl_abbr, clty, cltydef, _) ->
1286-
let variance = decl.type_variance in
1287-
(decl, {cl_abbr with type_variance = variance},
1288-
{clty with cty_variance = variance},
1289-
{cltydef with clty_variance = variance}))
1290-
decls cldecls
1291-
12921269
(* Check multiple declarations of labels/constructors *)
12931270

12941271
let check_duplicates sdecl_list =

jscomp/ml/typedecl.mli

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@ val check_coherence:
5050
(* for fixed types *)
5151
val is_fixed_type : Parsetree.type_declaration -> bool
5252

53-
(* for typeclass.ml *)
54-
val compute_variance_decls:
55-
Env.t ->
56-
(Ident.t * Types.type_declaration * Types.type_declaration *
57-
Types.class_declaration * Types.class_type_declaration *
58-
'a Typedtree.class_infos) list ->
59-
(Types.type_declaration * Types.type_declaration *
60-
Types.class_declaration * Types.class_type_declaration) list
61-
6253
(* for typeopt.ml *)
6354
val get_unboxed_type_representation: Env.t -> type_expr -> type_expr option
6455

jscomp/ml/typedtree.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,6 @@ and class_type_field_desc =
460460
and class_description =
461461
class_type class_infos
462462

463-
and class_type_declaration =
464-
class_type class_infos
465-
466463
and 'a class_infos =
467464
{ ci_virt: virtual_flag;
468465
ci_params: (core_type * variance) list;
@@ -473,7 +470,6 @@ and 'a class_infos =
473470
ci_id_typehash: Ident.t;
474471
ci_expr: 'a;
475472
ci_decl: Types.class_declaration;
476-
ci_type_decl: Types.class_type_declaration;
477473
ci_loc: Location.t;
478474
ci_attributes: attribute list;
479475
}

jscomp/ml/typedtree.mli

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,6 @@ and class_type_field_desc =
578578
and class_description =
579579
class_type class_infos
580580

581-
and class_type_declaration =
582-
class_type class_infos
583-
584581
and 'a class_infos =
585582
{ ci_virt: virtual_flag;
586583
ci_params: (core_type * variance) list;
@@ -591,7 +588,6 @@ and 'a class_infos =
591588
ci_id_typehash : Ident.t;
592589
ci_expr: 'a;
593590
ci_decl: Types.class_declaration;
594-
ci_type_decl : Types.class_type_declaration;
595591
ci_loc: Location.t;
596592
ci_attributes: attributes;
597593
}

jscomp/ml/types.ml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,6 @@ type class_declaration =
231231
cty_attributes: Parsetree.attributes;
232232
}
233233

234-
type class_type_declaration =
235-
{ clty_params: type_expr list;
236-
clty_type: class_type;
237-
clty_path: Path.t;
238-
clty_variance: Variance.t list;
239-
clty_loc: Location.t;
240-
clty_attributes: Parsetree.attributes;
241-
}
242-
243234
(* Type expressions for the module language *)
244235

245236
type module_type =

jscomp/ml/types.mli

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,6 @@ type class_declaration =
383383
cty_attributes: Parsetree.attributes;
384384
}
385385

386-
type class_type_declaration =
387-
{ clty_params: type_expr list;
388-
clty_type: class_type;
389-
clty_path: Path.t;
390-
clty_variance: Variance.t list;
391-
clty_loc: Location.t;
392-
clty_attributes: Parsetree.attributes;
393-
}
394386

395387
(* Type expressions for the module language *)
396388

0 commit comments

Comments
 (0)