Skip to content

Commit

Permalink
Remove support for class types
Browse files Browse the repository at this point in the history
Signed-off-by: Paul-Elliot <[email protected]>
  • Loading branch information
panglesd committed Dec 12, 2023
1 parent 2ca32f6 commit ead3969
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 47 deletions.
1 change: 0 additions & 1 deletion src/document/generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ module Make (Syntax : SYNTAX) = struct
| Module v -> to_link v
| ModuleType v -> to_link v
| Type v -> to_link v
| ClassType v -> to_link v
| Value v -> to_link v

let source id syntax_info infos source_code =
Expand Down
4 changes: 0 additions & 4 deletions src/loader/implementation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,6 @@ let process_occurrences env poses loc_to_id local_ident_to_loc =
process p Ident_env.Path.read_module
|> Option.iter @@ fun l ->
AnnotHashtbl.replace occ_tbl (Module l, pos_of_loc loc) ()
| ClassType p, loc ->
process p Ident_env.Path.read_class_type
|> Option.iter @@ fun l ->
AnnotHashtbl.replace occ_tbl (ClassType l, pos_of_loc loc) ()
| ModuleType p, loc ->
process p Ident_env.Path.read_module_type
|> Option.iter @@ fun l ->
Expand Down
13 changes: 0 additions & 13 deletions src/loader/typedtree_traverse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Analysis = struct
| LocalDefinition of Ident.t
| Value of Path.t
| Module of Path.t
| ClassType of Path.t
| ModuleType of Path.t
| Type of Path.t

Expand Down Expand Up @@ -53,13 +52,6 @@ module Analysis = struct
poses := (Module p, mod_loc) :: !poses
| _ -> ()

let class_type poses cltyp =
match cltyp with
| { Typedtree.cltyp_desc = Tcty_constr (p, _, _); cltyp_loc; _ }
when not cltyp_loc.loc_ghost ->
poses := (ClassType p, cltyp_loc) :: !poses
| _ -> ()

let module_type poses mty_expr =
match mty_expr with
| { Typedtree.mty_desc = Tmty_ident (p, _); mty_loc; _ }
Expand Down Expand Up @@ -98,10 +90,6 @@ let of_cmt env structure =
Analysis.module_type poses mty;
iter.module_type iterator mty
in
let class_type iterator cl_type =
Analysis.class_type poses cl_type;
iter.class_type iterator cl_type
in
let module_binding iterator mb =
Analysis.module_binding env poses mb;
iter.module_binding iterator mb
Expand All @@ -114,7 +102,6 @@ let of_cmt env structure =
module_expr;
typ;
module_type;
class_type;
module_binding;
}
in
Expand Down
1 change: 0 additions & 1 deletion src/model/lang.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module Source_info = struct
| Definition of Paths.Identifier.SourceLocation.t
| Value of Path.Value.t jump_to
| Module of Path.Module.t jump_to
| ClassType of Path.ClassType.t jump_to
| ModuleType of Path.ModuleType.t jump_to
| Type of Path.Type.t jump_to

Expand Down
2 changes: 0 additions & 2 deletions src/odoc/occurrences.ml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ let count ~dst ~warnings_options:_ directories include_hidden =
_ ) ->
incr htbl p
| Value { documentation = Some (`Resolved p); _ }, _ -> incr htbl p
| ClassType { documentation = Some (`Resolved p); _ }, _ ->
incr htbl p
| ModuleType { documentation = Some (`Resolved p); _ }, _ ->
incr htbl p
| Type { documentation = Some (`Resolved p); _ }, _ -> incr htbl p
Expand Down
1 change: 0 additions & 1 deletion src/xref2/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ and source_info_infos env infos =
| Module v -> Module (map_doc (module_path env) v)
| ModuleType v -> ModuleType (map_doc (module_type_path env) v)
| Type v -> Type (map_doc (type_path env) v)
| ClassType v -> ClassType (map_doc (class_type_path env) v)
| Definition _ as d -> d
in
(v, pos))
Expand Down
5 changes: 0 additions & 5 deletions src/xref2/link.ml
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,6 @@ let rec unit env t =
(jump_to v
(Shape_tools.lookup_type_path env)
(type_path env))
| ClassType v ->
ClassType
(jump_to v
(Shape_tools.lookup_class_type_path env)
(class_type_path env))
| i -> i
in
(info, pos))
Expand Down
2 changes: 0 additions & 2 deletions test/occurrences/double_wrapped.t/a.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ module type M = sig end
let ( ||> ) x y = x + y

let _ = x + x

class ct = object end
4 changes: 0 additions & 4 deletions test/occurrences/double_wrapped.t/b.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ module type Y = A.M
let _ =
let open A in
1 ||> 2

let ob = new A.ct

class ct : A.ct = A.ct
22 changes: 8 additions & 14 deletions test/occurrences/double_wrapped.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ occurrences information.
$ odoc compile --count-occurrences -I . main__A.cmt
$ odoc compile --count-occurrences -I . main__C.cmt
$ odoc compile --count-occurrences -I . main__B.cmt
File "main__B.cmt":
Warning: Failed to compile expansion for class (root Main__B).ct
$ odoc compile --count-occurrences -I . main__.cmt
$ odoc compile --count-occurrences -I . main.cmt

Expand Down Expand Up @@ -70,11 +68,10 @@ A only uses "persistent" values: one it defines itself.

"Aliased" values are not counted since they become persistent
$ occurrences_print occurrences-main__B.odoc | sort
Main was used directly 0 times and indirectly 8 times
Main.A was used directly 2 times and indirectly 6 times
Main was used directly 0 times and indirectly 7 times
Main.A was used directly 2 times and indirectly 5 times
Main.A.(||>) was used directly 1 times and indirectly 0 times
Main.A.M was used directly 2 times and indirectly 0 times
Main.A.ct was used directly 1 times and indirectly 0 times
Main.A.t was used directly 1 times and indirectly 0 times
Main.A.x was used directly 1 times and indirectly 0 times

Expand All @@ -95,11 +92,10 @@ Now we can merge all tables

$ occurrences_print occurrences-aggregated.odoc | sort > all_merged
$ cat all_merged
Main was used directly 0 times and indirectly 12 times
Main.A was used directly 4 times and indirectly 7 times
Main was used directly 0 times and indirectly 11 times
Main.A was used directly 4 times and indirectly 6 times
Main.A.(||>) was used directly 1 times and indirectly 0 times
Main.A.M was used directly 2 times and indirectly 0 times
Main.A.ct was used directly 1 times and indirectly 0 times
Main.A.t was used directly 1 times and indirectly 0 times
Main.A.x was used directly 2 times and indirectly 0 times
Main.B was used directly 1 times and indirectly 0 times
Expand All @@ -114,11 +110,10 @@ We can also include hidden ids:

$ odoc count-occurrences -I main__B -o occurrences-b.odoc --include-hidden
$ occurrences_print occurrences-b.odoc | sort
Main was used directly 0 times and indirectly 8 times
Main.A was used directly 2 times and indirectly 6 times
Main was used directly 0 times and indirectly 7 times
Main.A was used directly 2 times and indirectly 5 times
Main.A.(||>) was used directly 1 times and indirectly 0 times
Main.A.M was used directly 2 times and indirectly 0 times
Main.A.ct was used directly 1 times and indirectly 0 times
Main.A.t was used directly 1 times and indirectly 0 times
Main.A.x was used directly 1 times and indirectly 0 times
Main__ was used directly 0 times and indirectly 2 times
Expand All @@ -127,11 +122,10 @@ We can also include hidden ids:

$ odoc count-occurrences -I . -o occurrences-all.odoc --include-hidden
$ occurrences_print occurrences-all.odoc | sort
Main was used directly 0 times and indirectly 12 times
Main.A was used directly 4 times and indirectly 7 times
Main was used directly 0 times and indirectly 11 times
Main.A was used directly 4 times and indirectly 6 times
Main.A.(||>) was used directly 1 times and indirectly 0 times
Main.A.M was used directly 2 times and indirectly 0 times
Main.A.ct was used directly 1 times and indirectly 0 times
Main.A.t was used directly 1 times and indirectly 0 times
Main.A.x was used directly 2 times and indirectly 0 times
Main.B was used directly 1 times and indirectly 0 times
Expand Down

0 comments on commit ead3969

Please sign in to comment.