diff --git a/check/classic/classic.exp b/check/classic/classic.exp index fa87157e..f46f87e1 100644 --- a/check/classic/classic.exp +++ b/check/classic/classic.exp @@ -660,8 +660,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) diff --git a/check/classic/classic.ref b/check/classic/classic.ref index 35ae2f3d..5fda775e 100644 --- a/check/classic/classic.ref +++ b/check/classic/classic.ref @@ -37,7 +37,6 @@ ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:25: id: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:40: new_method: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:41: public_method_label: Should not be detected -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.mli:10: I.x: Should not be detected ./examples/docs/methods/code_constructs/factory_fun/factory_fun_bin.ml:2: unused_factory ./examples/docs/methods/code_constructs/immediate_object/immediate_object_bin.ml:2: unused_obj @@ -171,6 +170,34 @@ Nothing else to report in this section .> UNUSED METHODS: ================= +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.o#m: Should not be detected ./examples/docs/methods/code_constructs/class/class_bin.ml:2: unused_class#unused_method ./examples/docs/methods/code_constructs/class/class_lib.mli:2: int_stack#reset @@ -264,6 +291,14 @@ Nothing else to report in this section ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:2: either.Right ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:3: both.left +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Ftor_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: With.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Ftor_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: With.field.field: Should not be detected ./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused @@ -340,6 +375,14 @@ Nothing else to report in this section ============================= ./examples/docs/coding_style/opt/opt.ml:15: ?index +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?always: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:3: ?max ./examples/docs/optional_arguments/code_constructs/hof/hof_bin.ml:2: ?index @@ -501,6 +544,14 @@ Nothing else to report in this section .> OPTIONAL ARGUMENTS: NEVER: ============================ +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?never: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:2: ?min ./examples/docs/optional_arguments/code_constructs/internal_app/internal_app_lib.ml:2: ?min @@ -665,8 +716,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) @@ -719,7 +768,7 @@ Nothing else to report in this section -------------------------------------------------------------------------------- -Total: 593 -Success: 586 -Failed: 7 -Ratio: 98.8195615514% +Total: 643 +Success: 585 +Failed: 58 +Ratio: 90.9797822706% diff --git a/check/internal/internal.exp b/check/internal/internal.exp index 899c4c9d..3f47d1c6 100644 --- a/check/internal/internal.exp +++ b/check/internal/internal.exp @@ -612,8 +612,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) diff --git a/check/internal/internal.ref b/check/internal/internal.ref index 5c83976b..2dadd916 100644 --- a/check/internal/internal.ref +++ b/check/internal/internal.ref @@ -27,7 +27,6 @@ ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:25: id: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:40: new_method: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:41: public_method_label: Should not be detected -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.mli:10: I.x: Should not be detected ./examples/docs/methods/code_constructs/factory_fun/factory_fun_bin.ml:2: unused_factory ./examples/docs/methods/code_constructs/immediate_object/immediate_object_bin.ml:2: unused_obj @@ -123,6 +122,34 @@ Nothing else to report in this section .> UNUSED METHODS: ================= +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.o#m: Should not be detected ./examples/docs/methods/code_constructs/class/class_bin.ml:2: unused_class#unused_method ./examples/docs/methods/code_constructs/class/class_lib.mli:2: int_stack#reset @@ -216,6 +243,14 @@ Nothing else to report in this section ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:2: either.Right ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:3: both.left +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Ftor_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: With.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Ftor_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: With.field.field: Should not be detected ./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused @@ -292,6 +327,14 @@ Nothing else to report in this section ============================= ./examples/docs/coding_style/opt/opt.ml:15: ?index +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?always: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:3: ?max ./examples/docs/optional_arguments/code_constructs/hof/hof_bin.ml:2: ?index @@ -453,6 +496,14 @@ Nothing else to report in this section .> OPTIONAL ARGUMENTS: NEVER: ============================ +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?never: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:2: ?min ./examples/docs/optional_arguments/code_constructs/internal_app/internal_app_lib.ml:2: ?min @@ -617,8 +668,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) @@ -671,7 +720,7 @@ Nothing else to report in this section -------------------------------------------------------------------------------- -Total: 549 -Success: 542 -Failed: 7 -Ratio: 98.7249544627% +Total: 599 +Success: 541 +Failed: 58 +Ratio: 90.3171953255% diff --git a/check/threshold-1/threshold-1.exp b/check/threshold-1/threshold-1.exp index 65c58dc3..1b9d1dd9 100644 --- a/check/threshold-1/threshold-1.exp +++ b/check/threshold-1/threshold-1.exp @@ -546,7 +546,6 @@ Nothing else to report in this section ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_fun ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_int -./examples/using_make/advanced/func.mli:3: M.c#f ./examples/using_make/advanced/mod.mli:4: p#f ./examples/using_make/obj/class.mli:1: c#f @@ -1069,8 +1068,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) diff --git a/check/threshold-1/threshold-1.ref b/check/threshold-1/threshold-1.ref index eb6e1268..92c6a0e1 100644 --- a/check/threshold-1/threshold-1.ref +++ b/check/threshold-1/threshold-1.ref @@ -27,7 +27,6 @@ ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:25: id: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:40: new_method: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:41: public_method_label: Should not be detected -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.mli:10: I.x: Should not be detected ./examples/docs/methods/code_constructs/factory_fun/factory_fun_bin.ml:2: unused_factory ./examples/docs/methods/code_constructs/immediate_object/immediate_object_bin.ml:2: unused_obj @@ -405,6 +404,34 @@ Nothing else to report in this section .> UNUSED METHODS: ================= +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.o#m: Should not be detected ./examples/docs/methods/code_constructs/class/class_bin.ml:2: unused_class#unused_method ./examples/docs/methods/code_constructs/class/class_lib.mli:2: int_stack#reset @@ -550,7 +577,7 @@ Nothing else to report in this section ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_fun ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_int -./examples/using_make/advanced/func.mli:3: M.c#f +./examples/using_make/advanced/func.mli:3: M.c#f: Should not be detected ./examples/using_make/advanced/mod.mli:4: p#f ./examples/using_make/obj/class.mli:1: c#f @@ -591,6 +618,14 @@ Nothing else to report in this section ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:2: either.Right ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:3: both.left +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Ftor_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: With.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Ftor_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: With.field.field: Should not be detected ./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused @@ -748,6 +783,14 @@ Nothing else to report in this section ============================= ./examples/docs/coding_style/opt/opt.ml:15: ?index +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?always: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:3: ?max ./examples/docs/optional_arguments/code_constructs/hof/hof_bin.ml:2: ?index @@ -909,6 +952,14 @@ Nothing else to report in this section .> OPTIONAL ARGUMENTS: NEVER: ============================ +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?never: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:2: ?min ./examples/docs/optional_arguments/code_constructs/internal_app/internal_app_lib.ml:2: ?min @@ -1073,8 +1124,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) @@ -1127,7 +1176,7 @@ Nothing else to report in this section -------------------------------------------------------------------------------- -Total: 929 -Success: 921 -Failed: 8 -Ratio: 99.1388589882% +Total: 979 +Success: 919 +Failed: 60 +Ratio: 93.8712972421% diff --git a/check/threshold-3-0.5/threshold-3-0.5.exp b/check/threshold-3-0.5/threshold-3-0.5.exp index 93d15ada..b520252a 100644 --- a/check/threshold-3-0.5/threshold-3-0.5.exp +++ b/check/threshold-3-0.5/threshold-3-0.5.exp @@ -689,7 +689,6 @@ Nothing else to report in this section ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_fun ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_int -./examples/using_make/advanced/func.mli:3: M.c#f ./examples/using_make/advanced/mod.mli:4: p#f ./examples/using_make/obj/class.mli:1: c#f @@ -1477,8 +1476,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) diff --git a/check/threshold-3-0.5/threshold-3-0.5.ref b/check/threshold-3-0.5/threshold-3-0.5.ref index e04bb50c..1f4f76c1 100644 --- a/check/threshold-3-0.5/threshold-3-0.5.ref +++ b/check/threshold-3-0.5/threshold-3-0.5.ref @@ -27,7 +27,6 @@ ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:25: id: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:40: new_method: Should not be detected ./examples/docs/exported_values/limitations/incl_same_name/oo.mli:41: public_method_label: Should not be detected -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.mli:10: I.x: Should not be detected ./examples/docs/methods/code_constructs/factory_fun/factory_fun_bin.ml:2: unused_factory ./examples/docs/methods/code_constructs/immediate_object/immediate_object_bin.ml:2: unused_obj @@ -407,6 +406,10 @@ ./examples/docs/exported_values/hello_world/hello_world_with_intf.mli:4: world ./examples/docs/exported_values/hello_world/hello_world_without_intf.ml:4: world +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.f: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.o: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.x: Should not be detected ./examples/docs/methods/limitations/alias/alias_lib.mli:2: original ./examples/docs/optional_arguments/code_constructs/intext_app/intext_app_lib.mli:2: max @@ -548,6 +551,34 @@ Nothing else to report in this section .> UNUSED METHODS: ================= +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Ftor_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: Incl_with.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:7: With.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Ftor_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: Incl_with.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:8: With.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.o#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.c#m: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.o#m: Should not be detected ./examples/docs/methods/code_constructs/class/class_bin.ml:2: unused_class#unused_method ./examples/docs/methods/code_constructs/class/class_lib.mli:2: int_stack#reset @@ -693,7 +724,7 @@ Nothing else to report in this section ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_fun ./examples/using_dune/wrapped_lib/obj/without_class.mli:28: _self_used_factory#used_int -./examples/using_make/advanced/func.mli:3: M.c#f +./examples/using_make/advanced/func.mli:3: M.c#f: Should not be detected ./examples/using_make/advanced/mod.mli:4: p#f ./examples/using_make/obj/class.mli:1: c#f @@ -773,6 +804,14 @@ Nothing else to report in this section ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:2: either.Right ./examples/docs/fields_and_constructors/code_constructs/polymorphic_type/polymorphic_type_lib.mli:3: both.left +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Ftor_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: Incl_with.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:4: With.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Ftor_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: Incl_with.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:5: With.field.field: Should not be detected ./examples/using_dune/preprocessed_lib/preprocessed.mli:14: constructors.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:19: constr_with_eq.Unused ./examples/using_dune/preprocessed_lib/preprocessed.mli:23: record.unused @@ -926,6 +965,12 @@ Nothing else to report in this section .>-> ALMOST UNUSED CONSTRUCTORS/RECORD FIELDS: Called 2 time(s): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.field.field: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.ctor.Ctor: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.field.field: Should not be detected ./examples/using_dune/preprocessed_lib/preprocessed.mli:15: constructors.Used ./examples/using_dune/preprocessed_lib/preprocessed.mli:24: record.used ./examples/using_dune/preprocessed_lib/preprocessed_no_intf.ml:26: constructors.Used @@ -973,6 +1018,14 @@ Nothing else to report in this section ============================= ./examples/docs/coding_style/opt/opt.ml:15: ?index +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?always: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?always: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:3: ?max ./examples/docs/optional_arguments/code_constructs/hof/hof_bin.ml:2: ?index @@ -1231,6 +1284,14 @@ Nothing else to report in this section .> OPTIONAL ARGUMENTS: NEVER: ============================ +./examples/docs/limitations/modtype/modtype_with_intf.mli:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:18: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:29: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_with_intf.mli:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:9: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:36: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:74: ?never: Should not be detected +./examples/docs/limitations/modtype/modtype_without_intf.ml:108: ?never: Should not be detected ./examples/docs/optional_arguments/code_constructs/external_app/external_app_lib.mli:2: ?min ./examples/docs/optional_arguments/code_constructs/internal_app/internal_app_lib.ml:2: ?min @@ -1477,8 +1538,6 @@ Nothing else to report in this section ./examples/docs/exported_values/code_constructs/module/module_lib.ml:6: unit pattern unused ./examples/docs/exported_values/code_constructs/module/module_lib.ml:7: unit pattern unused_unexported -./examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml:9: unit pattern x - ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:3: let x = ... in x (=> useless binding) ./examples/docs/methods/limitations/factory_fun_indir/factory_fun_indir.ml:12: let x = ... in x (=> useless binding) @@ -1531,7 +1590,7 @@ Nothing else to report in this section -------------------------------------------------------------------------------- -Total: 1251 -Success: 1243 -Failed: 8 -Ratio: 99.3605115907% +Total: 1311 +Success: 1241 +Failed: 70 +Ratio: 94.6605644546% diff --git a/docs/LIMITATIONS.md b/docs/LIMITATIONS.md new file mode 100644 index 00000000..30c78de8 --- /dev/null +++ b/docs/LIMITATIONS.md @@ -0,0 +1,300 @@ +# Table of contents + ++ [Module type](#module-type) ++ [Module type with and inclusion](#module-type-with-and-inclusion) + +The limitations listed below apply to all the reportable elements of code. +Coding style issues are not concerned unless specified otherwise. + +# Module type + +Related issue : +[issue #50](https://github.com/LexiFi/dead_code_analyzer/issues/50). + +As explained in the +[exported values' Module type](./exported_values/code_constructs/MODTYP.md) +example, the analyzer is currently restrcited to not reporting values declared +in module types. This is actually true for all reportable elements of code. +This means that any unused element defined by a module with a module type as +signature, even with constraints or substitutions, will not be reported. + +A future improvement would be to report unused elements declared in module types +by considering all the elemnts defined in modules of such types as instances +of the elements in the module types. + +# Module type with and inclusion + +Related issue : +[issue #64](https://github.com/LexiFi/dead_code_analyzer/issues/64). + +According to the above limitation on elements in module types, elements included +from a module type (`include T`) should not be reported. Even more so according +to the semantics described in the +[exported values' Include](./exported_values/code_constructs/INCLUDE.md) +example. +Similarly, elements defined in a module type with constraints (`T with ...`) +should not be reported. + +This is mostly the case for unused exported values, unless there is a substition +(`T with ... := ...`) and not .mli is provided, or a .mli is provided and the 2 +contructs are mixed into an included module type with substitution +(`include T with ... := ...`). +This is however, not the case at all for constructors, fields, and methods. +Optional arguments always/never used are only affected by substitutions. + +## Example + +The reference files for this example are in the +[modtype](../../examples/docs/limitations/modtype) directory. + +The reference takes place in `/tmp/docs/limitations`, which +is a copy of the [limitations](../../examples/docs/limitations) directory. +Reported locations may differ depending on the location of the source files. + +The compilation command is : +``` +make -C modtype build +``` + +The analysis command is : +``` +make -C modtype analyze +``` + +The compile + analyze command is : +``` +make -C modtype +``` + +Code: +```OCaml +(* modtype_with_intf.mli *) +module type T = sig + type t + type ctor = Ctor + type field = {field : unit} + val x : t + val o : < m : t > + class c : object method m : t end + val f : ?always:t -> ?never:t -> unit -> t + (* to use as [always] in call to [f] *) + val always : t +end + +module Regular : T + +module With : T with type t = int + +module Subst : T with type t := int + +module Incl : sig + include T +end + +module Incl_with : sig + include T with type t = int +end + +module Incl_subst : sig + include T with type t := int +end + +module Ftor () : T + +module Ftor_with () : T with type t = int + +module Ftor_subst () : T with type t := int +``` +The other files are not displayed here. +`modtype_without_intf` is equivalent to `modtype_with_intf`'s interface and +implementation merged together. `modtype_bin` uses the function's `f` to track +its optional parameters. +The modules are all defined as: +```OCaml +struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end +``` + +Compile and analyze: +``` +$ make -C modtype +make: Entering directory '/tmp/docs/limitations/modtype' +ocamlopt -bin-annot modtype_with_intf.mli modtype_with_intf.ml modtype_without_intf.ml modtype_bin.ml +dead_code_analyzer --all -E threshold:4 -M threshold:4 -T threshold:4 . +Scanning files... + [DONE] + +.> UNUSED EXPORTED VALUES: +========================= + + +.>-> ALMOST UNUSED EXPORTED VALUES: Called 2 time(s): +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.always +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.f +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.o +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.x +-------- + + +.>-> ALMOST UNUSED EXPORTED VALUES: Called 4 time(s): +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.always +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.f +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.o +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.x +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.always +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.f +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.o +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.x +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.always +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.f +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.o +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.x + +Nothing else to report in this section +-------------------------------------------------------------------------------- + + +.> UNUSED METHODS: +================= +/tmp/docs/limitations/modtype/modtype_with_intf.mli:7: Ftor_with.o#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:7: Incl.o#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:7: Incl_with.o#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:7: With.o#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:8: Ftor_with.c#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:8: Incl.c#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:8: Incl_with.c#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:8: With.c#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.c#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.o#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.c#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.o#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.c#m +/tmp/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.o#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:7: Ftor_with.o#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:7: Incl.o#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:7: Incl_with.o#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:7: With.o#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:8: Ftor_with.c#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:8: Incl.c#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:8: Incl_with.c#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:8: With.c#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.c#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.o#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.c#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.o#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.c#m +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.o#m +-------- + + + +Nothing else to report in this section +-------------------------------------------------------------------------------- + + +.> UNUSED CONSTRUCTORS/RECORD FIELDS: +==================================== +/tmp/docs/limitations/modtype/modtype_with_intf.mli:4: Ftor_with.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_with_intf.mli:4: Incl.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_with_intf.mli:4: Incl_with.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_with_intf.mli:4: With.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_with_intf.mli:5: Ftor_with.field.field +/tmp/docs/limitations/modtype/modtype_with_intf.mli:5: Incl.field.field +/tmp/docs/limitations/modtype/modtype_with_intf.mli:5: Incl_with.field.field +/tmp/docs/limitations/modtype/modtype_with_intf.mli:5: With.field.field +-------- + + +.>-> ALMOST UNUSED CONSTRUCTORS/RECORD FIELDS: Called 2 time(s): +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/tmp/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_with_intf.mli:18: Subst.field.field +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: Incl_subst.field.field +/tmp/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_with_intf.mli:36: Ftor_subst.field.field +-------- + + +.>-> ALMOST UNUSED CONSTRUCTORS/RECORD FIELDS: Called 4 time(s): +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/tmp/docs/limitations/modtype/modtype_without_intf.ml:4: Ftor_with.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_without_intf.ml:4: Incl.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_without_intf.ml:4: Incl_with.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_without_intf.ml:4: With.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_without_intf.ml:5: Ftor_with.field.field +/tmp/docs/limitations/modtype/modtype_without_intf.ml:5: Incl.field.field +/tmp/docs/limitations/modtype/modtype_without_intf.ml:5: Incl_with.field.field +/tmp/docs/limitations/modtype/modtype_without_intf.ml:5: With.field.field +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: Subst.field.field +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: Incl_subst.field.field +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.ctor.Ctor +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: Ftor_subst.field.field + +Nothing else to report in this section +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- + + +.> OPTIONAL ARGUMENTS: ALWAYS: +============================= +/tmp/docs/limitations/modtype/modtype_with_intf.mli:9: ?always +/tmp/docs/limitations/modtype/modtype_with_intf.mli:18: ?always +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: ?always +/tmp/docs/limitations/modtype/modtype_with_intf.mli:36: ?always +/tmp/docs/limitations/modtype/modtype_without_intf.ml:9: ?always +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: ?always +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: ?always +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: ?always + +Nothing else to report in this section +-------------------------------------------------------------------------------- + + +.> OPTIONAL ARGUMENTS: NEVER: +============================ +/tmp/docs/limitations/modtype/modtype_with_intf.mli:9: ?never +/tmp/docs/limitations/modtype/modtype_with_intf.mli:18: ?never +/tmp/docs/limitations/modtype/modtype_with_intf.mli:29: ?never +/tmp/docs/limitations/modtype/modtype_with_intf.mli:36: ?never +/tmp/docs/limitations/modtype/modtype_without_intf.ml:9: ?never +/tmp/docs/limitations/modtype/modtype_without_intf.ml:36: ?never +/tmp/docs/limitations/modtype/modtype_without_intf.ml:74: ?never +/tmp/docs/limitations/modtype/modtype_without_intf.ml:108: ?never + +Nothing else to report in this section +-------------------------------------------------------------------------------- + + +.> CODING STYLE: +=============== + +Nothing else to report in this section +-------------------------------------------------------------------------------- + + +make: Leaving directory '/tmp/docs/limitations/modtype' +``` +> [!NOTE] +> The analyzer is run with thresholds. Because elements of `T` share the same +> location at the point of use of `T`, the analyzer gets confused and considers +> some unused elements as used. Using thresholds enables reporting elements used +> up to a fixed amount. +> For more details about the command line arguments see [the more general Usage +documentation](../USAGE.md). + +The analyzer reports elements although they are all defined within module type +`T`. +Following its semantics on module types, the report should be empty. diff --git a/docs/USER_DOC.md b/docs/USER_DOC.md index 6d69e268..84d56ee8 100644 --- a/docs/USER_DOC.md +++ b/docs/USER_DOC.md @@ -58,6 +58,7 @@ This documentation is split accross different topics: - [Constructors/Record fields](fields_and_constructors/FIELDS_AND_CONSTRUCTORS.md) describes the semantics and usage of the "unused constructors/record fields" report section, and provides examples. - [Optional arguments](optional_arguments/OPTIONAL_ARGUMENTS.md) describes the semantics and usage of the optional arguments always/never used report sections, and provides examples. - [Coding style](coding_style/CODING_STYLE.md) describes the semantics and usage of the "coding style" report section, and provides examples. +- [Limitations](LIMITATIONS.md) describes overall limitations of the `dead_code_analyzer`, and provides examples. ## Footnotes diff --git a/docs/exported_values/EXPORTED_VALUES.md b/docs/exported_values/EXPORTED_VALUES.md index bff356f5..4cf21af2 100644 --- a/docs/exported_values/EXPORTED_VALUES.md +++ b/docs/exported_values/EXPORTED_VALUES.md @@ -9,8 +9,6 @@ + [Usage](#usage) + [Examples](#examples) + [Limitations](#limitations) - + [Module type](#module-type) - + [Include module type with substitution](#include-module-type-with-substitution) + [Including a module with same name](#including-a-module-with-the-same-name) # Exported Values @@ -232,107 +230,6 @@ Warning 26 [unused-var]: unused variable y. # Limitations -## Module type - -Related issue : -[issue #50](https://github.com/LexiFi/dead_code_analyzer/issues/50). - -As explained in the [Module type](./code_constructs/MODTYP.md) example, the -analyzer is currently restrcited to not reporting values declared in module -types. This means that any unused value defined by a module with a module type -as signature, even with constraints or substitutions, will not be reported. - -A future improvement would be to report unused exported values declared in -module types by considering all the values defined in modules of such types as -instances of the values in the module types. - -## Include module type with substitution - -Related issue : -[issue #64](https://github.com/LexiFi/dead_code_analyzer/issues/64). - -According to the above limitation on values in module types, values included -from a module type should not be reported. Even more so according to the -semantics described in the [Include](./code_constructs/INCLUDE.md) example. -This is the case unless there is a substitution on the module type. - -### Example - -The reference files for this example are in the -[sigincl](../../examples/docs/exported_values/limitations/sigincl) directory. - -The reference takes place in `/tmp/docs/exported_values/limitations`, which -is a copy of the [limitations](../../examples/docs/exported_values/limitations) -directory. Reported locations may differ depending on the location of the source -files. - -The compilation command is : -``` -make -C sigincl build -``` - -The analysis command is : -``` -make -C sigincl analyze -``` - -The compile + analyze command is : -``` -make -C sigincl -``` - -Code: -```OCaml -(* sigincl_lib.mli *) -module type T = sig - type t - val x : t -end - -module M : T - -module I : sig - include T with type t := unit -end -``` -```OCaml -(* sigincl_lib.ml *) -module type T = sig - type t - val x : t -end - -module M = struct - type t = unit - let x = () -end - -module I = M -``` - -Compile and analyze: -``` -$ make -C sigincl -make: Entering directory '/tmp/docs/exported_values/limitations/sigincl' -ocamlopt -bin-annot sigincl_lib.mli sigincl_lib.ml -dead_code_analyzer --nothing -E all . -Scanning files... - [DONE] - -.> UNUSED EXPORTED VALUES: -========================= -/tmp/docs/exported_values/limitations/sigincl/sigincl_lib.mli:10: I.x - -Nothing else to report in this section --------------------------------------------------------------------------------- - - -make: Leaving directory '/tmp/docs/exported_values/limitations/sigincl' -``` - -The analyzer reports `I.x` at the line where `T` is included although it is -actually declared in `T`. - ## Including a module with the same name Related issue : diff --git a/examples/docs/Makefile b/examples/docs/Makefile index 87e4dab0..d165abe3 100644 --- a/examples/docs/Makefile +++ b/examples/docs/Makefile @@ -8,6 +8,7 @@ build: make -C fields_and_constructors make -C optional_arguments make -C coding_style + make -C limitations clean: rm -f *~ *.cm* *.o *.obj @@ -16,4 +17,5 @@ clean: make -C fields_and_constructors clean make -C optional_arguments clean make -C coding_style clean + make -C limitations clean diff --git a/examples/docs/exported_values/limitations/Makefile b/examples/docs/exported_values/limitations/Makefile index e54f6339..532d49c0 100644 --- a/examples/docs/exported_values/limitations/Makefile +++ b/examples/docs/exported_values/limitations/Makefile @@ -3,10 +3,8 @@ all: build build: - make -C sigincl build make -C incl_same_name build clean: rm -f *~ *.cm* *.o *.obj - make -C sigincl clean make -C incl_same_name clean diff --git a/examples/docs/exported_values/limitations/sigincl/Makefile b/examples/docs/exported_values/limitations/sigincl/Makefile deleted file mode 100644 index faff1949..00000000 --- a/examples/docs/exported_values/limitations/sigincl/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -SRC:=sigincl_lib.mli sigincl_lib.ml - -all: build analyze - -build: - ocamlopt -bin-annot ${SRC} - -analyze: - dead_code_analyzer --nothing -E all . - -clean: - rm -f *.cm* *.o a.out diff --git a/examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml b/examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml deleted file mode 100644 index f30d1341..00000000 --- a/examples/docs/exported_values/limitations/sigincl/sigincl_lib.ml +++ /dev/null @@ -1,12 +0,0 @@ -(* sigincl_lib.ml *) -module type T = sig - type t - val x : t -end - -module M = struct - type t = unit - let x = () -end - -module I = M diff --git a/examples/docs/exported_values/limitations/sigincl/sigincl_lib.mli b/examples/docs/exported_values/limitations/sigincl/sigincl_lib.mli deleted file mode 100644 index a0c32a3f..00000000 --- a/examples/docs/exported_values/limitations/sigincl/sigincl_lib.mli +++ /dev/null @@ -1,11 +0,0 @@ -(* sigincl_lib.mli *) -module type T = sig - type t - val x : t -end - -module M : T - -module I : sig - include T with type t := unit -end diff --git a/examples/docs/limitations/Makefile b/examples/docs/limitations/Makefile new file mode 100644 index 00000000..b14152c6 --- /dev/null +++ b/examples/docs/limitations/Makefile @@ -0,0 +1,10 @@ +.PHONY: clean build + +all: build + +build: + make -C modtype build + +clean: + rm -f *~ *.cm* *.o *.obj + make -C modtype clean diff --git a/examples/docs/limitations/modtype/Makefile b/examples/docs/limitations/modtype/Makefile new file mode 100644 index 00000000..e2d7de8b --- /dev/null +++ b/examples/docs/limitations/modtype/Makefile @@ -0,0 +1,12 @@ +SRC:=modtype_with_intf.mli modtype_with_intf.ml modtype_without_intf.ml modtype_bin.ml + +all: build analyze + +build: + ocamlopt -bin-annot ${SRC} + +analyze: + dead_code_analyzer --all -E threshold:4 -M threshold:4 -T threshold:4 . + +clean: + rm -f *.cm* *.o a.out diff --git a/examples/docs/limitations/modtype/modtype_bin.ml b/examples/docs/limitations/modtype/modtype_bin.ml new file mode 100644 index 00000000..9759f41b --- /dev/null +++ b/examples/docs/limitations/modtype/modtype_bin.ml @@ -0,0 +1,29 @@ +module M_intf = Modtype_with_intf.Ftor () +module M_intf_with = Modtype_with_intf.Ftor_with () +module M_intf_subst = Modtype_with_intf.Ftor_subst () + +let () = + let open Modtype_with_intf in + With.(f ~always ()) |> ignore; + Subst.(f ~always ()) |> ignore; + Incl.(f ~always ()) |> ignore; + Incl_with.(f ~always ()) |> ignore; + Incl_subst.f ~always:Incl_subst.always () |> ignore; + M_intf.(f ~always ()) |> ignore; + M_intf_with.(f ~always ()) |> ignore; + M_intf_subst.(f ~always ()) |> ignore + +module M_no_intf = Modtype_without_intf.Ftor () +module M_no_intf_with = Modtype_without_intf.Ftor_with () +module M_no_intf_subst = Modtype_without_intf.Ftor_subst () + +let () = + let open Modtype_without_intf in + With.(f ~always ()) |> ignore; + Subst.(f ~always ()) |> ignore; + Incl.(f ~always ()) |> ignore; + Incl_with.(f ~always ()) |> ignore; + Incl_subst.f ~always:Incl_subst.always () |> ignore; + M_no_intf.(f ~always ()) |> ignore; + M_no_intf_with.(f ~always ()) |> ignore; + M_no_intf_subst.(f ~always ()) |> ignore diff --git a/examples/docs/limitations/modtype/modtype_with_intf.ml b/examples/docs/limitations/modtype/modtype_with_intf.ml new file mode 100644 index 00000000..364caf7c --- /dev/null +++ b/examples/docs/limitations/modtype/modtype_with_intf.ml @@ -0,0 +1,111 @@ +(* modtype_with_intf.mli *) +module type T = sig + type t + type ctor = Ctor + type field = {field : unit} + val x : t + val o : < m : t > + class c : object method m : t end + val f : ?always:t -> ?never:t -> unit -> t + (* to use as [always] in call to [f] *) + val always : t +end + +module Regular = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module With = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Subst = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Incl = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Incl_with = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Incl_subst = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Ftor() = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Ftor_with() = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Ftor_subst() = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end diff --git a/examples/docs/limitations/modtype/modtype_with_intf.mli b/examples/docs/limitations/modtype/modtype_with_intf.mli new file mode 100644 index 00000000..8b688610 --- /dev/null +++ b/examples/docs/limitations/modtype/modtype_with_intf.mli @@ -0,0 +1,36 @@ +(* modtype_with_intf.mli *) +module type T = sig + type t + type ctor = Ctor + type field = {field : unit} + val x : t + val o : < m : t > + class c : object method m : t end + val f : ?always:t -> ?never:t -> unit -> t + (* to use as [always] in call to [f] *) + val always : t +end + +module Regular : T + +module With : T with type t = int + +module Subst : T with type t := int + +module Incl : sig + include T +end + +module Incl_with : sig + include T with type t = int +end + +module Incl_subst : sig + include T with type t := int +end + +module Ftor () : T + +module Ftor_with () : T with type t = int + +module Ftor_subst () : T with type t := int diff --git a/examples/docs/limitations/modtype/modtype_without_intf.ml b/examples/docs/limitations/modtype/modtype_without_intf.ml new file mode 100644 index 00000000..073d259a --- /dev/null +++ b/examples/docs/limitations/modtype/modtype_without_intf.ml @@ -0,0 +1,117 @@ +(* modtype_without_intf.ml *) +module type T = sig + type t + type ctor = Ctor + type field = {field : unit} + val x : t + val o : < m : t > + class c : object method m : t end + val f : ?always:t -> ?never:t -> unit -> t + (* to use as [always] in call to [f] *) + val always : t +end + +module Regular : T = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module With : T with type t = int = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Subst : T with type t := int = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Incl : sig + include T +end = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Incl_with : sig + include T with type t = int +end = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Incl_subst : sig + include T with type t := int +end = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Ftor() : T = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Ftor_with() : T with type t = int = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end + +module Ftor_subst() : T with type t := int = struct + type t = int + type ctor = Ctor + type field = {field : unit} + let x = 0 + let o = object method m = 0 end + class c = object method m = 0 end + let f ?always:_ ?never:_ () = 0 + let always = 0 +end