├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── TODO.md ├── check ├── Makefile ├── aggregate.ml ├── check.ml ├── classic │ └── examples │ │ ├── advanced │ │ ├── inc_val.mli │ │ └── mod.mlio │ │ ├── bar-fn.mli │ │ ├── bar.mli │ │ ├── baz.mli │ │ ├── baz.mlopta │ │ ├── cond_sel.mli │ │ ├── cond_sel.mlopta │ │ ├── dir │ │ ├── alias-opt.mli │ │ ├── alias-opt.mlopta │ │ ├── alias-opt.mloptn │ │ ├── anon-call.mli │ │ ├── anon-call2.mli │ │ ├── anonFn.mli │ │ ├── anonFn.mlopta │ │ ├── anonFn.mloptn │ │ ├── anonFn2.mli │ │ ├── fn-arg.mli │ │ ├── fn-arg.mlopta │ │ ├── fn-arg.mloptn │ │ ├── fn-arg.mlstyle │ │ ├── hidden_opt_use.mli │ │ ├── hidden_opt_use.mlopta │ │ ├── hidden_opt_use.mloptn │ │ ├── hidden_opt_use.mlstyle │ │ ├── match-opt.mli │ │ ├── match-opt.mlopta │ │ ├── match-opt.mloptn │ │ ├── match-opt.mlstyle │ │ ├── matchopt.mli │ │ ├── mod.mli │ │ ├── partial.mli │ │ ├── partial.mlopta │ │ ├── partial.mloptn │ │ ├── ref-fn.mli │ │ ├── ref-fn.mlopta │ │ ├── ref-fn.mloptn │ │ ├── ref-opt.mli │ │ ├── ref-opt.mlopta │ │ ├── ref-opt.mloptn │ │ ├── refFn.mli │ │ ├── refFn.mloptn │ │ └── sub_mod.mli │ │ ├── exported.mli │ │ ├── foo.mli │ │ ├── foo.mlopta │ │ ├── foo.mloptn │ │ ├── fooFn.mli │ │ ├── functor.mli │ │ ├── if_end.mli │ │ ├── if_end.mlopta │ │ ├── if_end.mloptn │ │ ├── let-in.mli │ │ ├── let-in.mlopta │ │ ├── let-in.mloptn │ │ ├── let-in.mlstyle │ │ ├── let-test.mli │ │ ├── letIn.mlopta │ │ ├── letIn.mloptn │ │ ├── matchopt.mli │ │ ├── mod_alias.mli │ │ ├── obj │ │ ├── barCl.mlio │ │ ├── class.mli │ │ ├── class.mlio │ │ ├── class_type.mlio │ │ ├── coerce.mlio │ │ ├── constraint.mlio │ │ ├── depend.mlio │ │ ├── fooCl.mlio │ │ ├── fun_class.mlio │ │ ├── inher.mli │ │ ├── inher.mlio │ │ ├── named.mlio │ │ ├── obj_inher.mlio │ │ ├── object.mli │ │ ├── object.mlio │ │ └── overr.mlio │ │ ├── opt-in-opt.mli │ │ ├── opt-in-opt.mlopta │ │ ├── opt-in-opt.mloptn │ │ ├── partial_opt.mli │ │ ├── partial_opt.mlopta │ │ ├── qux.mli │ │ ├── record.mlit │ │ ├── record.mlopta │ │ ├── record.mloptn │ │ ├── record.mlstyle │ │ ├── unused-fn.mli │ │ ├── useless-opt.mli │ │ ├── useless-opt.mlopta │ │ ├── variant.mli │ │ └── variant.mlit ├── internal │ └── examples │ │ ├── advanced │ │ ├── inc_val.mli │ │ └── mod.mlio │ │ ├── bar-fn.mli │ │ ├── bar.mli │ │ ├── baz.mli │ │ ├── baz.mlopta │ │ ├── cond_sel.mli │ │ ├── cond_sel.mlopta │ │ ├── dir │ │ ├── alias-opt.mli │ │ ├── alias-opt.mlopta │ │ ├── alias-opt.mloptn │ │ ├── anon-call.mli │ │ ├── anon-call2.mli │ │ ├── anonFn.mli │ │ ├── anonFn.mlopta │ │ ├── anonFn.mloptn │ │ ├── anonFn2.mli │ │ ├── fn-arg.mli │ │ ├── fn-arg.mlopta │ │ ├── fn-arg.mloptn │ │ ├── fn-arg.mlstyle │ │ ├── hidden_opt_use.mlopta │ │ ├── hidden_opt_use.mloptn │ │ ├── hidden_opt_use.mlstyle │ │ ├── match-opt.mli │ │ ├── match-opt.mlopta │ │ ├── match-opt.mloptn │ │ ├── match-opt.mlstyle │ │ ├── matchopt.mli │ │ ├── mod.mli │ │ ├── partial.mli │ │ ├── partial.mlopta │ │ ├── partial.mloptn │ │ ├── ref-fn.mli │ │ ├── ref-fn.mlopta │ │ ├── ref-fn.mloptn │ │ ├── ref-opt.mli │ │ ├── ref-opt.mlopta │ │ ├── ref-opt.mloptn │ │ ├── refFn.mli │ │ ├── refFn.mloptn │ │ └── sub_mod.mli │ │ ├── exported.mli │ │ ├── foo.mli │ │ ├── foo.mlopta │ │ ├── foo.mloptn │ │ ├── fooFn.mli │ │ ├── functor.mli │ │ ├── if_end.mlopta │ │ ├── if_end.mloptn │ │ ├── let-in.mli │ │ ├── let-in.mlopta │ │ ├── let-in.mloptn │ │ ├── let-in.mlstyle │ │ ├── let-test.mli │ │ ├── letIn.mlopta │ │ ├── letIn.mloptn │ │ ├── matchopt.mli │ │ ├── mod_alias.mli │ │ ├── obj │ │ ├── barCl.mlio │ │ ├── class.mlio │ │ ├── class_type.mlio │ │ ├── coerce.mlio │ │ ├── constraint.mlio │ │ ├── depend.mlio │ │ ├── fooCl.mlio │ │ ├── fun_class.mlio │ │ ├── inher.mlio │ │ ├── named.mlio │ │ ├── obj_inher.mlio │ │ ├── object.mlio │ │ └── overr.mlio │ │ ├── opt-in-opt.mli │ │ ├── opt-in-opt.mlopta │ │ ├── opt-in-opt.mloptn │ │ ├── partial_opt.mlopta │ │ ├── qux.mli │ │ ├── record.mlit │ │ ├── record.mlopta │ │ ├── record.mloptn │ │ ├── record.mlstyle │ │ ├── unused-fn.mli │ │ ├── useless-opt.mli │ │ ├── useless-opt.mlopta │ │ └── variant.mlit ├── threshold-1 │ └── examples │ │ ├── advanced │ │ ├── func.mlio1 │ │ ├── inc_val.mli │ │ ├── incl.mli1 │ │ ├── incl.mlio1 │ │ ├── mod.mli1 │ │ ├── mod.mlio │ │ ├── mod.mlio1 │ │ └── val.mli1 │ │ ├── bar-fn.mli │ │ ├── bar.mli │ │ ├── baz.mli │ │ ├── baz.mli1 │ │ ├── baz.mlopta │ │ ├── cond_sel.mli │ │ ├── cond_sel.mli1 │ │ ├── cond_sel.mlopta │ │ ├── dir │ │ ├── alias-opt.mli │ │ ├── alias-opt.mli1 │ │ ├── alias-opt.mlopta │ │ ├── alias-opt.mloptn │ │ ├── anon-call.mli │ │ ├── anon-call2.mli │ │ ├── anonFn.mli │ │ ├── anonFn.mlopta │ │ ├── anonFn.mloptn │ │ ├── anonFn2.mli │ │ ├── fn-arg.mli │ │ ├── fn-arg.mli1 │ │ ├── fn-arg.mlopta │ │ ├── fn-arg.mloptn │ │ ├── fn-arg.mlstyle │ │ ├── hidden_opt_use.mli1 │ │ ├── hidden_opt_use.mlopta │ │ ├── hidden_opt_use.mloptn │ │ ├── hidden_opt_use.mlstyle │ │ ├── match-opt.mli │ │ ├── match-opt.mli1 │ │ ├── match-opt.mlopta │ │ ├── match-opt.mloptn │ │ ├── match-opt.mlstyle │ │ ├── matchopt.mli │ │ ├── mod.mli │ │ ├── mod.mli1 │ │ ├── partial.mli │ │ ├── partial.mli1 │ │ ├── partial.mlopta │ │ ├── partial.mloptn │ │ ├── ref-fn.mli │ │ ├── ref-fn.mli1 │ │ ├── ref-fn.mlopta │ │ ├── ref-fn.mloptn │ │ ├── ref-opt.mli │ │ ├── ref-opt.mli1 │ │ ├── ref-opt.mlopta │ │ ├── ref-opt.mloptn │ │ ├── refFn.mli │ │ ├── refFn.mloptn │ │ └── sub_mod.mli │ │ ├── exported.mli │ │ ├── exported.mli1 │ │ ├── foo.mli │ │ ├── foo.mli1 │ │ ├── foo.mlopta │ │ ├── foo.mloptn │ │ ├── fooFn.mli │ │ ├── fooFn.mli1 │ │ ├── functor.mli │ │ ├── functor.mli1 │ │ ├── if_end.mli1 │ │ ├── if_end.mlopta │ │ ├── if_end.mloptn │ │ ├── let-in.mli │ │ ├── let-in.mlopta │ │ ├── let-in.mloptn │ │ ├── let-in.mlstyle │ │ ├── let-test.mli │ │ ├── letIn.mli1 │ │ ├── letIn.mlopta │ │ ├── letIn.mloptn │ │ ├── matchopt.mli │ │ ├── mod_alias.mli │ │ ├── mod_alias.mli1 │ │ ├── obj │ │ ├── barCl.mlio │ │ ├── barCl.mlio1 │ │ ├── class.mli1 │ │ ├── class.mlio │ │ ├── class.mlio1 │ │ ├── class_type.mlio │ │ ├── class_type.mlio1 │ │ ├── coerce.mlio │ │ ├── coerce.mlio1 │ │ ├── constraint.mlio │ │ ├── constraint.mlio1 │ │ ├── depend.mlio │ │ ├── depend.mlio1 │ │ ├── fooCl.mlio │ │ ├── fooCl.mlio1 │ │ ├── fun_class.mli1 │ │ ├── fun_class.mlio │ │ ├── fun_class.mlio1 │ │ ├── fun_obj_param.mli1 │ │ ├── fun_obj_param.mlio1 │ │ ├── inher.mli1 │ │ ├── inher.mlio │ │ ├── inher.mlio1 │ │ ├── named.mlio │ │ ├── named.mlio1 │ │ ├── obj_inher.mli1 │ │ ├── obj_inher.mlio │ │ ├── object.mli1 │ │ ├── object.mlio │ │ ├── object.mlio1 │ │ ├── overr.mlio │ │ └── overr.mlio1 │ │ ├── opt-in-opt.mli │ │ ├── opt-in-opt.mli1 │ │ ├── opt-in-opt.mlopta │ │ ├── opt-in-opt.mloptn │ │ ├── partial_opt.mli1 │ │ ├── partial_opt.mlopta │ │ ├── qux.mli │ │ ├── record.mlit │ │ ├── record.mlit1 │ │ ├── record.mlopta │ │ ├── record.mloptn │ │ ├── record.mlstyle │ │ ├── unused-fn.mli │ │ ├── useless-opt.mli │ │ ├── useless-opt.mli1 │ │ ├── useless-opt.mlopta │ │ ├── variant.mli1 │ │ ├── variant.mlit │ │ └── variant.mlit1 └── threshold-3-0.5 │ └── examples │ ├── advanced │ ├── func.mlio1 │ ├── inc_val.mli │ ├── incl.mli1 │ ├── incl.mlio1 │ ├── mod.mli1 │ ├── mod.mlio │ ├── mod.mlio1 │ └── val.mli1 │ ├── bar-fn.mli │ ├── bar.mli │ ├── baz.mli │ ├── baz.mli1 │ ├── baz.mlopta │ ├── baz.mloptn1 │ ├── cond_sel.mli │ ├── cond_sel.mli1 │ ├── cond_sel.mlopta │ ├── dir │ ├── alias-opt.mli │ ├── alias-opt.mli1 │ ├── alias-opt.mlopta │ ├── alias-opt.mloptn │ ├── anon-call.mli │ ├── anon-call2.mli │ ├── anonFn.mli │ ├── anonFn.mli2 │ ├── anonFn.mlopta │ ├── anonFn.mlopta1 │ ├── anonFn.mloptn │ ├── anonFn.mloptn1 │ ├── anonFn2.mli │ ├── anonFn2.mli3 │ ├── anonFn2.mlopta1 │ ├── anonFn2.mloptn1 │ ├── fn-arg.mli │ ├── fn-arg.mli1 │ ├── fn-arg.mli2 │ ├── fn-arg.mlopta │ ├── fn-arg.mloptn │ ├── fn-arg.mlstyle │ ├── hidden_opt_use.mli1 │ ├── hidden_opt_use.mlopta │ ├── hidden_opt_use.mloptn │ ├── hidden_opt_use.mlstyle │ ├── match-opt.mli │ ├── match-opt.mli1 │ ├── match-opt.mli3 │ ├── match-opt.mlopta │ ├── match-opt.mlopta1 │ ├── match-opt.mloptn │ ├── match-opt.mlstyle │ ├── matchopt.mli │ ├── mod.mli │ ├── mod.mli1 │ ├── partial.mli │ ├── partial.mli1 │ ├── partial.mli2 │ ├── partial.mlopta │ ├── partial.mloptn │ ├── ref-fn.mli │ ├── ref-fn.mli1 │ ├── ref-fn.mli3 │ ├── ref-fn.mlopta │ ├── ref-fn.mlopta1 │ ├── ref-fn.mloptn │ ├── ref-opt.mli │ ├── ref-opt.mli1 │ ├── ref-opt.mli2 │ ├── ref-opt.mlopta │ ├── ref-opt.mloptn │ ├── refFn.mli │ ├── refFn.mloptn │ └── sub_mod.mli │ ├── exported.mli │ ├── exported.mli1 │ ├── exported.mli2 │ ├── exported.mli3 │ ├── foo.mli │ ├── foo.mli1 │ ├── foo.mlopta │ ├── foo.mloptn │ ├── fooFn.mli │ ├── fooFn.mli1 │ ├── functor.mli │ ├── functor.mli1 │ ├── functor.mli2 │ ├── if_end.mli1 │ ├── if_end.mlopta │ ├── if_end.mloptn │ ├── let-in.mli │ ├── let-in.mli3 │ ├── let-in.mlopta │ ├── let-in.mloptn │ ├── let-in.mloptn1 │ ├── let-in.mlstyle │ ├── let-test.mli │ ├── letIn.mli1 │ ├── letIn.mlopta │ ├── letIn.mloptn │ ├── matchopt.mli │ ├── matchopt.mlopta1 │ ├── matchopt.mloptn1 │ ├── mod_alias.mli │ ├── mod_alias.mli1 │ ├── obj │ ├── barCl.mlio │ ├── barCl.mlio1 │ ├── class.mli1 │ ├── class.mli2 │ ├── class.mlio │ ├── class.mlio1 │ ├── class_type.mlio │ ├── class_type.mlio1 │ ├── class_type.mlio2 │ ├── coerce.mlio │ ├── coerce.mlio1 │ ├── coerce.mlio2 │ ├── constraint.mlio │ ├── constraint.mlio1 │ ├── depend.mlio │ ├── depend.mlio1 │ ├── fooCl.mlio │ ├── fooCl.mlio1 │ ├── fun_class.mli1 │ ├── fun_class.mlio │ ├── fun_class.mlio1 │ ├── fun_obj_param.mli1 │ ├── fun_obj_param.mli2 │ ├── fun_obj_param.mlio1 │ ├── fun_obj_param.mlio2 │ ├── inher.mli1 │ ├── inher.mli2 │ ├── inher.mlio │ ├── inher.mlio1 │ ├── named.mlio │ ├── named.mlio1 │ ├── named.mlio2 │ ├── obj_inher.mli1 │ ├── obj_inher.mlio │ ├── obj_inher.mlio2 │ ├── object.mli1 │ ├── object.mli2 │ ├── object.mlio │ ├── object.mlio1 │ ├── object.mlio2 │ ├── overr.mlio │ └── overr.mlio1 │ ├── opt-in-opt.mli │ ├── opt-in-opt.mli1 │ ├── opt-in-opt.mli2 │ ├── opt-in-opt.mlopta │ ├── opt-in-opt.mlopta1 │ ├── opt-in-opt.mloptn │ ├── opt-in-opt.mloptn1 │ ├── opt │ ├── sig_struct.mli2 │ ├── sig_struct.mli3 │ ├── sig_struct.mlopta1 │ └── sig_struct.mloptn1 │ ├── partial_opt.mli1 │ ├── partial_opt.mlopta │ ├── qux.mli │ ├── record.mlit │ ├── record.mlit1 │ ├── record.mlit2 │ ├── record.mlopta │ ├── record.mloptn │ ├── record.mlstyle │ ├── unused-fn.mli │ ├── unused-fn.mli2 │ ├── useless-opt.mli │ ├── useless-opt.mli1 │ ├── useless-opt.mlopta │ ├── variant.mli1 │ ├── variant.mlit │ ├── variant.mlit1 │ └── variant.mlit2 ├── dead_code_analyzer.install ├── doc └── Makefile ├── examples ├── Makefile ├── advanced │ ├── Makefile │ ├── func.ml │ ├── func.mli │ ├── inc_val.ml │ ├── inc_val.mli │ ├── incl.ml │ ├── mod.ml │ ├── mod.mli │ ├── use_func.ml │ ├── val.ml │ └── val.mli ├── bar-fn.ml ├── bar.ml ├── baz.ml ├── baz.mli ├── cond_sel.ml ├── dir │ ├── Makefile │ ├── alias-opt.ml │ ├── anon-call.ml │ ├── anon-call2.ml │ ├── anonFn.ml │ ├── anonFn.mli │ ├── anonFn2.ml │ ├── anonFn2.mli │ ├── fn-arg.ml │ ├── hidden_opt_use.ml │ ├── match-opt.ml │ ├── matchopt.ml │ ├── mod.ml │ ├── mod.mli │ ├── partial.ml │ ├── ref-fn.ml │ ├── ref-opt.ml │ ├── refFn.ml │ ├── refFn.mli │ ├── sub_mod.ml │ └── sub_mod.mli ├── exported.ml ├── exported.mli ├── foo.ml ├── foo.mli ├── fooFn.ml ├── fooFn.mli ├── functor.ml ├── functor.mli ├── if_end.ml ├── ifelse.ml ├── let-in.ml ├── let-test.ml ├── letIn.ml ├── letIn.mli ├── match.ml ├── matchopt.ml ├── mod_alias.ml ├── mod_alias.mli ├── obj │ ├── Makefile │ ├── barCl.ml │ ├── barCl.mli │ ├── class.ml │ ├── class.mli │ ├── class_type.ml │ ├── class_type.mli │ ├── coerce.ml │ ├── coerce.mli │ ├── constraint.ml │ ├── depend.ml │ ├── fooCl.ml │ ├── fooCl.mli │ ├── fun_class.ml │ ├── fun_obj_param.ml │ ├── inher.ml │ ├── inher.mli │ ├── named.ml │ ├── named.mli │ ├── obj_inher.ml │ ├── object.ml │ ├── overr.ml │ └── overr.mli ├── opt-in-opt.ml ├── opt │ ├── Makefile │ └── sig_struct.ml ├── partial_opt.ml ├── qux.ml ├── record.ml ├── record.mli ├── unused-fn.ml ├── useless-opt.ml ├── variant.ml └── variant.mli ├── man └── Makefile ├── opam └── src ├── .merlin ├── Makefile ├── deadArg.ml ├── deadArg.mli ├── deadCode.ml ├── deadCode.mli ├── deadCommon.ml ├── deadFlag.ml ├── deadLexiFi.ml ├── deadMod.ml ├── deadObj.ml ├── deadObj.mli ├── deadType.ml └── deadType.mli /.gitignore: -------------------------------------------------------------------------------- 1 | *.3o 2 | *.a 3 | *.annot 4 | *.byt 5 | *.cma 6 | *.cmi 7 | *.cmo 8 | *.cmt 9 | *.cmti 10 | *.cmx 11 | *.cmxa 12 | *.cmxs 13 | *.css 14 | *.exe 15 | *.html 16 | *.o 17 | *.opt 18 | *.out 19 | *.swo 20 | *.swp 21 | build 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | dist: trusty 4 | install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-docker.sh 5 | script: bash -ex .travis-docker.sh 6 | env: 7 | global: 8 | - DISTRO="ubuntu-16.04" 9 | - PACKAGE="dead_code_analyzer" 10 | matrix: 11 | - OCAML_VERSION=4.05.0 12 | - OCAML_VERSION=4.06.0 13 | 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | You are welcome to clone this repository and send us back pull requests. 2 | 3 | 4 | ## Coding guidelines 5 | 6 | You should not: 7 | - use tabs for indentation: use spaces instead (2 or 4 spaces are good enough); 8 | - use more than 100 columns. Less than 80 is even better; 9 | - leave trailing whitespace. 10 | 11 | Otherwise, try to keep constitent with surrounding code and avoid any super-weird construct 12 | (unless it is really useful, very well documented and maintainable). 13 | 14 | 15 | ## Testing 16 | 17 | Please verify that your modifications are valid: 18 | - Add tests for your work in the `examples` directory; 19 | - Update the expected results found in the `check` directory according to your changes 20 | and common sense (i.e. do not expect a result that is obviously wrong); 21 | - Run `make check` and verify nothing is broken; 22 | - Optionally: compare your old and new results on external projects like OPAM or js_of_ocaml 23 | and check that no errors have been introduced 24 | (some cases may not have their corresponding simplified test written yet). 25 | 26 | 27 | ## Misc 28 | 29 | Any kind of contribution may be accepted, from fixing typos to adding a new killer feature 30 | with its documentation. 31 | 32 | If you would like to contribute but do not know where to start, you can still check the `TODO.md` 33 | 34 | Separating style-related, code cleaning and similar changes from functional ones would be nice. 35 | Writing new tests (i.e. not something already existing) for existing features would be very nice. 36 | Having fun would be the best. 37 | 38 | 39 | Last but not least, **thank you for taking time to contribute!** 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2016 LexiFi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all opt doc man clean examples check 2 | 3 | all: 4 | make -C src all 5 | 6 | opt: 7 | make -C src opt 8 | 9 | lexifi: 10 | make -C src lexifi 11 | 12 | lexifi-opt: 13 | make -C src lexifi-opt 14 | 15 | doc: 16 | make -C doc all 17 | 18 | man: 19 | make -C man all 20 | 21 | debug: 22 | make -C src debug 23 | 24 | prof: 25 | make -C src prof 26 | 27 | prof-opt: 28 | make -C src prof-opt 29 | 30 | clean: 31 | make -C src clean 32 | make -C doc clean 33 | make -C man clean 34 | make -C examples clean 35 | make -C check clean 36 | rm -rf build 37 | 38 | check: 39 | make -C check 40 | 41 | 42 | examples: all 43 | make -C examples all 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dead code analyzer 2 | Dead-code analyzer for OCaml 3 | 4 | 5 | [![Build Status](https://travis-ci.com/LexiFi/dead_code_analyzer.svg?branch=master)](https://travis-ci.com/LexiFi/dead_code_analyzer) 6 | 7 | ## Overview 8 | 9 | The tool assumes that **.mli** files are compiled with **-keep-locs** and **.ml** 10 | files with **-bin-annot**. Exported values are collected by reading .cmi or .cmt 11 | files (depending on the existence of an explicit .mli interface). 12 | References to such values are collected by reading typed trees from .cmt files 13 | 14 | 15 | This tool scans a compiled OCaml project and reports various warnings 16 | about suspicious code: 17 | 18 | - Exported values never used. 19 | (The declaration can be dropped from the interface, and then from 20 | the implementation if there is no internal use -- which will be reported 21 | by standard OCaml warnings). 22 | 23 | - Types fields and constructors never used. (Can be dropped from the type) 24 | 25 | - Class fields never used. (Can be dropped from the signature) 26 | 27 | - Optional arguments for which either all call sites or none of them 28 | provide a value (other than `None`). (The argument can be made mandatory or dropped.) 29 | 30 | - Other stylistic issues: patterns matching a value of type `unit` 31 | which are not `()` (typically, `_` or a variable); let-binding 32 | `let () = ... in ...` (it's usually better to use sequencing); 33 | let-binding of the form `let x = ... in x` (the binding is useless); 34 | optional argument in argument's type: `val f: ... -> (... -> ?_:_ -> ...) -> ...` 35 | 36 | 37 | ## Requirements 38 | 39 | - Currently tested and working on **OCaml 4.05.0+trunk** 40 | 41 | 42 | ## Install 43 | 44 | ### OPAM 45 | 46 | `opam install dead_code_analyzer` 47 | 48 | ### Manual 49 | 50 | 1. Download the sources. 51 | 2. Build by either 52 | - running `make` to generate the `dead_code_analyzer.byt` bytecode executable file; 53 | - running `make opt` to generate the `dead_code_analyzer.opt` native-code executable file. 54 | Both will be produced in the `build` directory. 55 | 56 | 57 | ## Usage 58 | 59 | `dead_code_analyzer. ` 60 | 61 | The given paths can be files and directories. 62 | For more information about the usage, use the *-help* option. 63 | 64 | 65 | ## Testing 66 | 67 | To run the tests use `make check`. 68 | For each subset of the tests a file `.out` is generated, containg the output 69 | of the execution on it. 70 | 71 | To run a subset of the tests call `make -C check `. 72 | 73 | 74 | ## Documentation 75 | 76 | Running `make doc` will produce the documentation as html files in the `doc` directory. 77 | 78 | Running `make man` will produce documentation as man pages in the `man/man3` directory. 79 | 80 | 81 | ## Contribute 82 | 83 | You are welcome to clone this repository and send us back pull requests. 84 | 85 | Read `CONTRIBUTING.md` at the root of this directory for more informations on how to contribute. 86 | 87 | 88 | ## Status 89 | 90 | The project is used internally at LexiFi. 91 | 92 | There has been no official release yet. 93 | 94 | 95 | ## Limitations 96 | 97 | Tracking the optional arguments uses may consume a lot of memory. 98 | Tracking the methods uses may consume a lot of memory. 99 | 100 | 101 | ## Copyright 102 | 103 | Source code is distributed under the conditions stated in file `License` 104 | 105 | 106 | ## Contact 107 | 108 | This project was initiated by LexiFi (http://www.lexifi.com) and is part 109 | of the SecurOCaml project. 110 | 111 | Contact: alain.frisch@lexifi.com 112 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # Waiting 2 | - better doc 3 | - handle module types better 4 | - improve optional arguments memory cost 5 | - handle branching (for methods and opt args) 6 | - make check/\*.ml Str-independent 7 | - improve performances 8 | 9 | 10 | # Testing 11 | - \[X\] Test suite 12 | - \[ \] Create tests for all options 13 | 14 | 15 | # Note 16 | - The `UNUSED EXPORTED VALUES` section may have both FN and FP (none known). 17 | - The `UNUSED METHODS` section may have both FN and FP. 18 | It may consume a lot of memory to compute. 19 | - The `UNUSED CONSTRUCTORS/RECORD FIELDS` section may have both FN and FP (none known). 20 | - The `OPTIONAL ARGUMENTS` sections may have both FN and FP. 21 | It may consume a lot of memory to compute. 22 | - The `CODING STYLE` section may have both FN and FP (none known). 23 | 24 | ratio: **100%** succesful (over 255 unique expected results) 25 | -------------------------------------------------------------------------------- /check/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell ocamlc -where)/Makefile.config 2 | 3 | LIBS=str.cma 4 | COMPFLAGS=-w +A-4-9-40-42 -bin-annot -keep-locs 5 | OCAMLC=ocamlc $(COMPFLAGS) 6 | OCAMLOPT=ocamlopt $(COMPFLAGS) 7 | SRC=check.ml 8 | TARGET=res.out 9 | EXT=byt 10 | 11 | all: aggr.$(EXT)$(EXE) 12 | make internal > internal.out 2>&1 EXT=$(EXT) 13 | make classic > classic.out 2>&1 EXT=$(EXT) 14 | make threshold-1 > threshold-1.out 2>&1 EXT=$(EXT) 15 | make threshold-3-0.5 > threshold-3-0.5.out 2>&1 EXT=$(EXT) 16 | ./aggr.$(EXT)$(EXE) threshold-3-0.5.out threshold-1.out internal.out classic.out 17 | 18 | opt: 19 | make EXT=opt 20 | 21 | internal: prepare check.$(EXT)$(EXE) 22 | ../build/dead_code_analyzer.$(EXT)$(EXE) -A --internal ../examples > $(TARGET) 23 | ./check.$(EXT)$(EXE) ./internal $(TARGET) 24 | 25 | classic: prepare check.$(EXT)$(EXE) 26 | ../build/dead_code_analyzer.$(EXT)$(EXE) -A ../examples > $(TARGET) 27 | ./check.$(EXT)$(EXE) ./classic $(TARGET) 28 | 29 | threshold-1: prepare check.$(EXT)$(EXE) 30 | ../build/dead_code_analyzer.$(EXT)$(EXE) -A --internal -E threshold:1 -M threshold:1 -T threshold:1 ../examples > $(TARGET) 31 | ./check.$(EXT)$(EXE) ./threshold-1 $(TARGET) 32 | 33 | threshold-3-0.5: prepare check.$(EXT)$(EXE) 34 | ../build/dead_code_analyzer.$(EXT)$(EXE) -A --internal -E threshold:3 -Oa both:3,0.5 -On both:3,0.5 -M threshold:3 -T threshold:3 ../examples > $(TARGET) 35 | ./check.$(EXT)$(EXE) ./threshold-3-0.5 $(TARGET) 36 | 37 | prepare: 38 | make -C ../src dead_code_analyzer.$(EXT)$(EXE) > /dev/null 2>&1 39 | make -C ../examples build > /dev/null 2>&1 40 | 41 | check.byt$(EXE): $(SRC) 42 | $(OCAMLC) -o $@ $(LIBS) $^ 43 | 44 | check.opt$(EXE): $(SRC) 45 | $(OCAMLOPT) -o $@ $(LIBS:.cma=.cmxa) $^ 46 | 47 | aggr.byt$(EXE): aggregate.ml 48 | $(OCAMLC) -o $@ $^ 49 | 50 | aggr.opt$(EXE): aggregate.ml 51 | $(OCAMLOPT) -o $@ $^ 52 | 53 | clean: 54 | rm -f *~ *.cm* *.a *.lib *.o *.obj *.byt$(EXE) *.opt$(EXE) **.out 55 | -------------------------------------------------------------------------------- /check/aggregate.ml: -------------------------------------------------------------------------------- 1 | let total = ref 0 2 | let err = ref 0 3 | let res = Hashtbl.create 256 4 | 5 | let print_title title = 6 | print_string "\x1b[1;37m"; 7 | print_endline title; 8 | print_endline (String.make (String.length title) '~'); 9 | print_endline "\x1b[0m" 10 | 11 | let rec update file form value = 12 | try 13 | let line = input_line file in 14 | if String.length line > 2 && not (Hashtbl.mem res line) then 15 | if line.[0] = '.' && line.[1] <> '>' && not (Hashtbl.mem res line) then 16 | Hashtbl.add res line true 17 | else if line.[0] = '\x1b' && not (Hashtbl.mem res line) then 18 | Hashtbl.add res line false; 19 | try 20 | let tot = Scanf.sscanf line form (fun _ x _ -> x) in 21 | print_endline line; 22 | value := tot + !value 23 | with 24 | | _ -> update file form value 25 | with End_of_file -> close_in file 26 | 27 | let rec process n = 28 | if n = 0 then () 29 | else begin 30 | let file = open_in Sys.argv.(n) in 31 | print_title (Filename.chop_extension Sys.argv.(n)); 32 | 33 | update file "Total: \x1b[0;%dm%d%s" total; 34 | update file "Failed: \x1b[0;%dm%d%s" err; 35 | begin try print_endline (input_line file); print_endline "\n\n" 36 | with _ -> () end; 37 | close_in file; 38 | process (n - 1) 39 | end 40 | 41 | let print_res title total err = 42 | print_title title; 43 | print_string "Total: \x1b[0;34m"; 44 | print_int total; 45 | print_string "\x1b[0m\nFailed: \x1b[0;31m"; 46 | print_int err; 47 | let ratio = ( -. ) 100. @@ ( *. ) 100. @@ (float_of_int total |> ( /. ) @@ float_of_int err) in 48 | print_string @@ "\x1b[0m\nRatio: \x1b[0;3" 49 | ^ (if ratio < 50. then "1m" else if ratio < 80. then "3m" else "2m"); 50 | print_float ratio; 51 | print_endline "%\x1b[0m" 52 | 53 | let () = 54 | process (Array.length Sys.argv - 1); 55 | print_endline "...............................................\n\n\x1b[1;37m"; 56 | 57 | print_endline "~~~~~~~~~~~~~~~~~~~~~~"; 58 | print_endline "| |"; 59 | print_endline "+- Summed Results -+"; 60 | print_res "| |" !total !err; 61 | 62 | let total, err = Hashtbl.fold 63 | (fun _ valid (total, err) -> 64 | if valid then (total + 1, err) 65 | else (total + 1, err + 1)) 66 | res 67 | (0, 0) 68 | in 69 | 70 | print_endline "\n\n\x1b[1;37m"; 71 | 72 | print_endline "~~~~~~~~~~~~~~~~~~~~~~~"; 73 | print_endline "| |"; 74 | print_endline "[> Unified Results <]"; 75 | print_res "| |" total err; 76 | 77 | if err > 0 then 78 | exit 1 79 | 80 | -------------------------------------------------------------------------------- /check/classic/examples/advanced/inc_val.mli: -------------------------------------------------------------------------------- 1 | ./examples/advanced/inc_val.mli:1: x 2 | ./examples/advanced/inc_val.mli:2: y 3 | -------------------------------------------------------------------------------- /check/classic/examples/advanced/mod.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/advanced/mod.mlio -------------------------------------------------------------------------------- /check/classic/examples/bar-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar-fn.ml:3: h 2 | -------------------------------------------------------------------------------- /check/classic/examples/bar.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar.ml:1: x 2 | -------------------------------------------------------------------------------- /check/classic/examples/baz.mli: -------------------------------------------------------------------------------- 1 | ./examples/baz.mli:1: z 2 | ./examples/baz.mli:3: u 3 | -------------------------------------------------------------------------------- /check/classic/examples/baz.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/baz.ml:1: ?d 2 | ./examples/baz.ml:5: ?d 3 | -------------------------------------------------------------------------------- /check/classic/examples/cond_sel.mli: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:13: h 2 | -------------------------------------------------------------------------------- /check/classic/examples/cond_sel.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:1: ?a 2 | ./examples/cond_sel.ml:1: ?b 3 | ./examples/cond_sel.ml:3: ?a 4 | ./examples/cond_sel.ml:3: ?b 5 | ./examples/cond_sel.ml:9: ?a 6 | ./examples/cond_sel.ml:9: ?b 7 | ./examples/cond_sel.ml:11: ?a 8 | ./examples/cond_sel.ml:11: ?b 9 | -------------------------------------------------------------------------------- /check/classic/examples/dir/alias-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:7: y 2 | ./examples/dir/alias-opt.ml:14: x 3 | -------------------------------------------------------------------------------- /check/classic/examples/dir/alias-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?a 2 | ./examples/dir/alias-opt.ml:3: ?a 3 | ./examples/dir/alias-opt.ml:12: ?a 4 | -------------------------------------------------------------------------------- /check/classic/examples/dir/alias-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?b 2 | ./examples/dir/alias-opt.ml:11: ?a 3 | ./examples/dir/alias-opt.ml:11: ?b 4 | -------------------------------------------------------------------------------- /check/classic/examples/dir/anon-call.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call.ml:1: f 2 | ./examples/dir/anon-call.ml:5: g 3 | ./examples/dir/anon-call.ml:9: h 4 | -------------------------------------------------------------------------------- /check/classic/examples/dir/anon-call2.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call2.ml:1: f 2 | ./examples/dir/anon-call2.ml:5: g 3 | ./examples/dir/anon-call2.ml:9: h 4 | -------------------------------------------------------------------------------- /check/classic/examples/dir/anonFn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/anonFn.mli -------------------------------------------------------------------------------- /check/classic/examples/dir/anonFn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:2: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/anonFn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:1: ?b 2 | ./examples/dir/anonFn.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/classic/examples/dir/anonFn2.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/anonFn2.mli -------------------------------------------------------------------------------- /check/classic/examples/dir/fn-arg.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/fn-arg.mli -------------------------------------------------------------------------------- /check/classic/examples/dir/fn-arg.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:1: ?a 2 | ./examples/dir/fn-arg.ml:1: ?b 3 | ./examples/dir/fn-arg.ml:3: ?b 4 | ./examples/dir/fn-arg.ml:7: ?a 5 | ./examples/dir/fn-arg.ml:7: ?b 6 | ./examples/dir/fn-arg.ml:9: ?c 7 | ./examples/dir/fn-arg.ml:9: ?b 8 | ./examples/dir/fn-arg.ml:11: ?b 9 | ./examples/dir/fn-arg.ml:11: ?b 10 | -------------------------------------------------------------------------------- /check/classic/examples/dir/fn-arg.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/fn-arg.mlstyle: -------------------------------------------------------------------------------- 1 | ./dir/fn-arg.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | ./dir/fn-arg.ml:9: val f: ... -> (... -> ?_:_ -> ...) -> ... 3 | ./dir/fn-arg.ml:11: val f: ... -> (... -> ?_:_ -> ...) -> ... 4 | -------------------------------------------------------------------------------- /check/classic/examples/dir/hidden_opt_use.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/hidden_opt_use.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:1: ?a 2 | ./examples/dir/hidden_opt_use.ml:1: ?b 3 | ./examples/dir/hidden_opt_use.ml:3: ?a 4 | ./examples/dir/hidden_opt_use.ml:3: ?b 5 | -------------------------------------------------------------------------------- /check/classic/examples/dir/hidden_opt_use.mloptn: -------------------------------------------------------------------------------- 1 | ./exmaples/dir/hidden_opt_use.ml:3: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/hidden_opt_use.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/match-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:8: l 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/match-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/match-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/match-opt.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:5: let () = ... in ... (=> use sequence) 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/mod.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/mod.mli:10: M.f 2 | ./examples/dir/mod.mli:11: M.g 3 | -------------------------------------------------------------------------------- /check/classic/examples/dir/partial.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/partial.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?a 2 | ./examples/dir/partial.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/classic/examples/dir/partial.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/ref-fn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/ref-fn.mli -------------------------------------------------------------------------------- /check/classic/examples/dir/ref-fn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/ref-fn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/ref-fn.mloptn -------------------------------------------------------------------------------- /check/classic/examples/dir/ref-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:3: no 2 | ./examples/dir/ref-opt.ml:11: x 3 | -------------------------------------------------------------------------------- /check/classic/examples/dir/ref-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:1: ?a 2 | ./examples/dir/ref-opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/classic/examples/dir/ref-opt.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/ref-opt.mloptn -------------------------------------------------------------------------------- /check/classic/examples/dir/refFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/refFn.mli:3: x 2 | -------------------------------------------------------------------------------- /check/classic/examples/dir/refFn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/refFn.mloptn -------------------------------------------------------------------------------- /check/classic/examples/dir/sub_mod.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/dir/sub_mod.mli -------------------------------------------------------------------------------- /check/classic/examples/exported.mli: -------------------------------------------------------------------------------- 1 | ./examples/exported.mli:6: M1.five 2 | ./examples/exported.mli:10: F.plus_five 3 | ./examples/exported.mli:11: F.times_five 4 | ./examples/exported.mli:15: M2.five 5 | ./examples/exported.mli:16: M2.plus_five 6 | ./examples/exported.mli:17: M2.ten 7 | -------------------------------------------------------------------------------- /check/classic/examples/foo.mli: -------------------------------------------------------------------------------- 1 | ./examples/foo.mli:2: y 2 | -------------------------------------------------------------------------------- /check/classic/examples/foo.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/classic/examples/foo.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/fooFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/fooFn.mli:2: g 2 | -------------------------------------------------------------------------------- /check/classic/examples/functor.mli: -------------------------------------------------------------------------------- 1 | ./examples/functor.mli:2: M.f 2 | ./examples/functor.mli:3: M.none 3 | ./examples/functor.mli:7: F.g 4 | ./examples/functor.mli:11: N.g 5 | -------------------------------------------------------------------------------- /check/classic/examples/if_end.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/if_end.mli -------------------------------------------------------------------------------- /check/classic/examples/if_end.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/if_end.ml:3: ?d 2 | ./examples/if_end.ml:5: ?a 3 | ./examples/if_end.ml:5: ?b 4 | -------------------------------------------------------------------------------- /check/classic/examples/if_end.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/if_end.mloptn -------------------------------------------------------------------------------- /check/classic/examples/let-in.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-in.ml:3: parent 2 | -------------------------------------------------------------------------------- /check/classic/examples/let-in.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/let-in.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/classic/examples/let-in.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:8: let x = ... in x (=> useless binding) 2 | -------------------------------------------------------------------------------- /check/classic/examples/let-test.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-test.ml:3: g 2 | -------------------------------------------------------------------------------- /check/classic/examples/letIn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/letIn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/classic/examples/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/classic/examples/mod_alias.mli: -------------------------------------------------------------------------------- 1 | ./examples/mod-alias.ml:2: M1.id 2 | ./examples/mod-alias.ml:6: M2.id 3 | -------------------------------------------------------------------------------- /check/classic/examples/obj/barCl.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/obj/barCl.mlio -------------------------------------------------------------------------------- /check/classic/examples/obj/class.mli: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:7: o 2 | ./examples/obj/class.mli:9: f 3 | -------------------------------------------------------------------------------- /check/classic/examples/obj/class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:1: c#h 2 | -------------------------------------------------------------------------------- /check/classic/examples/obj/class_type.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class_type.mli:9: c#h 2 | -------------------------------------------------------------------------------- /check/classic/examples/obj/coerce.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/coerce.mli:6: p#f 2 | ./examples/obj/coerce.mli:6: p#h 3 | -------------------------------------------------------------------------------- /check/classic/examples/obj/constraint.mlio: -------------------------------------------------------------------------------- 1 | ./example/obj/constraint.ml:1: p#g 2 | -------------------------------------------------------------------------------- /check/classic/examples/obj/depend.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/obj/depend.mlio -------------------------------------------------------------------------------- /check/classic/examples/obj/fooCl.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fooCl.mli:1: p1#g 2 | ./examples/obj/fooCl.mli:1: p1#h 3 | ./examples/obj/fooCl.mli:7: p2#h 4 | -------------------------------------------------------------------------------- /check/classic/examples/obj/fun_class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:1: c#m3 2 | -------------------------------------------------------------------------------- /check/classic/examples/obj/inher.mli: -------------------------------------------------------------------------------- 1 | ./exmaples/obj/inher.mli:11: o 2 | ./exmaples/obj/inher.mli:13: f 3 | -------------------------------------------------------------------------------- /check/classic/examples/obj/inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:1: p#h 2 | -------------------------------------------------------------------------------- /check/classic/examples/obj/named.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/named.mli:10: c#g 2 | -------------------------------------------------------------------------------- /check/classic/examples/obj/obj_inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/obj_inher.ml:1: c#g 2 | ./examples/obj/obj_inher.ml:1: c#h 3 | ./examples/obj/obj_inher.ml:19: o3#k 4 | -------------------------------------------------------------------------------- /check/classic/examples/obj/object.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/obj/object.mli -------------------------------------------------------------------------------- /check/classic/examples/obj/object.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:1: o#h 2 | -------------------------------------------------------------------------------- /check/classic/examples/obj/overr.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/overr.mli:1: p1#g 2 | ./examples/obj/overr.mli:1: p1#h 3 | ./examples/obj/overr.mli:7: p2#g 4 | ./examples/obj/overr.mli:7: p2#h 5 | -------------------------------------------------------------------------------- /check/classic/examples/opt-in-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:7: x 2 | -------------------------------------------------------------------------------- /check/classic/examples/opt-in-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:1: ?a 2 | ./examples/opt-in-opt.ml:5: ?a 3 | -------------------------------------------------------------------------------- /check/classic/examples/opt-in-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:2: ?a 2 | ./examples/opt-in-opt.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/classic/examples/partial_opt.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/classic/examples/partial_opt.mli -------------------------------------------------------------------------------- /check/classic/examples/partial_opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examlpes/partial_opt.ml:1: ?a 2 | ./examlpes/partial_opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/classic/examples/qux.mli: -------------------------------------------------------------------------------- 1 | ./examples/qux.ml:1: z 2 | -------------------------------------------------------------------------------- /check/classic/examples/record.mlit: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:3: t0.unused 2 | ./examples/record.mli:4: t0.f 3 | ./examples/record.mli:10: X.t.unused 4 | -------------------------------------------------------------------------------- /check/classic/examples/record.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/record.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?b 2 | -------------------------------------------------------------------------------- /check/classic/examples/record.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/record.ml:20: unit pattern c 2 | ./examples/record.ml:45: unit pattern c 3 | -------------------------------------------------------------------------------- /check/classic/examples/unused-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/unused-fn.ml:3: g 2 | ./examples/unused-fn.ml:5: var 3 | -------------------------------------------------------------------------------- /check/classic/examples/useless-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:3: x 2 | -------------------------------------------------------------------------------- /check/classic/examples/useless-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/classic/examples/variant.mli: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:5: f 2 | -------------------------------------------------------------------------------- /check/classic/examples/variant.mlit: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:1: v.Unused 2 | ./examples/variant.mli:3: v2.Float 3 | ./examples/variant.mli:3: v2.Nothing 4 | -------------------------------------------------------------------------------- /check/internal/examples/advanced/inc_val.mli: -------------------------------------------------------------------------------- 1 | ./examples/advanced/inc_val.mli:1: x 2 | ./examples/advanced/inc_val.mli:2: y 3 | -------------------------------------------------------------------------------- /check/internal/examples/advanced/mod.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/advanced/mod.mlio -------------------------------------------------------------------------------- /check/internal/examples/bar-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar-fn.ml:3: h 2 | -------------------------------------------------------------------------------- /check/internal/examples/bar.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar.ml:1: x 2 | -------------------------------------------------------------------------------- /check/internal/examples/baz.mli: -------------------------------------------------------------------------------- 1 | ./examples/baz.mli:1: z 2 | ./examples/baz.mli:3: u 3 | -------------------------------------------------------------------------------- /check/internal/examples/baz.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/baz.ml:1: ?d 2 | ./examples/baz.ml:5: ?d 3 | -------------------------------------------------------------------------------- /check/internal/examples/cond_sel.mli: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:13: h 2 | -------------------------------------------------------------------------------- /check/internal/examples/cond_sel.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:1: ?a 2 | ./examples/cond_sel.ml:1: ?b 3 | ./examples/cond_sel.ml:3: ?a 4 | ./examples/cond_sel.ml:3: ?b 5 | ./examples/cond_sel.ml:9: ?a 6 | ./examples/cond_sel.ml:9: ?b 7 | ./examples/cond_sel.ml:11: ?a 8 | ./examples/cond_sel.ml:11: ?b 9 | -------------------------------------------------------------------------------- /check/internal/examples/dir/alias-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:7: y 2 | ./examples/dir/alias-opt.ml:14: x 3 | -------------------------------------------------------------------------------- /check/internal/examples/dir/alias-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?a 2 | ./examples/dir/alias-opt.ml:3: ?a 3 | ./examples/dir/alias-opt.ml:12: ?a 4 | -------------------------------------------------------------------------------- /check/internal/examples/dir/alias-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?b 2 | ./examples/dir/alias-opt.ml:11: ?a 3 | ./examples/dir/alias-opt.ml:11: ?b 4 | -------------------------------------------------------------------------------- /check/internal/examples/dir/anon-call.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call.ml:1: f 2 | ./examples/dir/anon-call.ml:5: g 3 | ./examples/dir/anon-call.ml:9: h 4 | -------------------------------------------------------------------------------- /check/internal/examples/dir/anon-call2.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call2.ml:1: f 2 | ./examples/dir/anon-call2.ml:5: g 3 | ./examples/dir/anon-call2.ml:9: h 4 | -------------------------------------------------------------------------------- /check/internal/examples/dir/anonFn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/dir/anonFn.mli -------------------------------------------------------------------------------- /check/internal/examples/dir/anonFn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:2: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/anonFn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:1: ?b 2 | ./examples/dir/anonFn.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/internal/examples/dir/anonFn2.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/dir/anonFn2.mli -------------------------------------------------------------------------------- /check/internal/examples/dir/fn-arg.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/fn-arg.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:1: ?a 2 | ./examples/dir/fn-arg.ml:1: ?b 3 | ./examples/dir/fn-arg.ml:3: ?b 4 | ./examples/dir/fn-arg.ml:7: ?a 5 | ./examples/dir/fn-arg.ml:7: ?b 6 | ./examples/dir/fn-arg.ml:9: ?c 7 | ./examples/dir/fn-arg.ml:9: ?b 8 | ./examples/dir/fn-arg.ml:11: ?b 9 | ./examples/dir/fn-arg.ml:11: ?b 10 | -------------------------------------------------------------------------------- /check/internal/examples/dir/fn-arg.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/fn-arg.mlstyle: -------------------------------------------------------------------------------- 1 | ./dir/fn-arg.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | ./dir/fn-arg.ml:9: val f: ... -> (... -> ?_:_ -> ...) -> ... 3 | ./dir/fn-arg.ml:11: val f: ... -> (... -> ?_:_ -> ...) -> ... 4 | -------------------------------------------------------------------------------- /check/internal/examples/dir/hidden_opt_use.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:1: ?a 2 | ./examples/dir/hidden_opt_use.ml:1: ?b 3 | ./examples/dir/hidden_opt_use.ml:3: ?a 4 | ./examples/dir/hidden_opt_use.ml:3: ?b 5 | -------------------------------------------------------------------------------- /check/internal/examples/dir/hidden_opt_use.mloptn: -------------------------------------------------------------------------------- 1 | ./exmaples/dir/hidden_opt_use.ml:3: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/hidden_opt_use.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/match-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:8: l 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/match-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/match-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/match-opt.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:5: let () = ... in ... (=> use sequence) 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/mod.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/mod.mli:11: M.g 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/partial.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/partial.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?a 2 | ./examples/dir/partial.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/internal/examples/dir/partial.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/ref-fn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/dir/ref-fn.mli -------------------------------------------------------------------------------- /check/internal/examples/dir/ref-fn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/ref-fn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/dir/ref-fn.mloptn -------------------------------------------------------------------------------- /check/internal/examples/dir/ref-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:3: no 2 | ./examples/dir/ref-opt.ml:11: x 3 | -------------------------------------------------------------------------------- /check/internal/examples/dir/ref-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:1: ?a 2 | ./examples/dir/ref-opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/internal/examples/dir/ref-opt.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/dir/ref-opt.mloptn -------------------------------------------------------------------------------- /check/internal/examples/dir/refFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/refFn.mli:3: x 2 | -------------------------------------------------------------------------------- /check/internal/examples/dir/refFn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/dir/refFn.mloptn -------------------------------------------------------------------------------- /check/internal/examples/dir/sub_mod.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/dir/sub_mod.mli -------------------------------------------------------------------------------- /check/internal/examples/exported.mli: -------------------------------------------------------------------------------- 1 | ./examples/exported.mli:11: F.times_five 2 | ./examples/exported.mli:17: M2.ten 3 | -------------------------------------------------------------------------------- /check/internal/examples/foo.mli: -------------------------------------------------------------------------------- 1 | ./examples/foo.mli:2: y 2 | -------------------------------------------------------------------------------- /check/internal/examples/foo.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/internal/examples/foo.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/fooFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/fooFn.mli:2: g 2 | -------------------------------------------------------------------------------- /check/internal/examples/functor.mli: -------------------------------------------------------------------------------- 1 | ./examples/functor.mli:3: M.none 2 | -------------------------------------------------------------------------------- /check/internal/examples/if_end.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/if_end.ml:3: ?d 2 | ./examples/if_end.ml:5: ?a 3 | ./examples/if_end.ml:5: ?b 4 | -------------------------------------------------------------------------------- /check/internal/examples/if_end.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/if_end.mloptn -------------------------------------------------------------------------------- /check/internal/examples/let-in.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-in.ml:3: parent 2 | -------------------------------------------------------------------------------- /check/internal/examples/let-in.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/let-in.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/internal/examples/let-in.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:8: let x = ... in x (=> useless binding) 2 | -------------------------------------------------------------------------------- /check/internal/examples/let-test.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-test.ml:3: g 2 | -------------------------------------------------------------------------------- /check/internal/examples/letIn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/letIn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/internal/examples/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/internal/examples/mod_alias.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/mod_alias.mli -------------------------------------------------------------------------------- /check/internal/examples/obj/barCl.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/obj/barCl.mlio -------------------------------------------------------------------------------- /check/internal/examples/obj/class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:1: c#h 2 | -------------------------------------------------------------------------------- /check/internal/examples/obj/class_type.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class_type.mli:9: c#h 2 | -------------------------------------------------------------------------------- /check/internal/examples/obj/coerce.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/coerce.mli:6: p#f 2 | ./examples/obj/coerce.mli:6: p#h 3 | -------------------------------------------------------------------------------- /check/internal/examples/obj/constraint.mlio: -------------------------------------------------------------------------------- 1 | ./example/obj/constraint.ml:1: p#g 2 | -------------------------------------------------------------------------------- /check/internal/examples/obj/depend.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/internal/examples/obj/depend.mlio -------------------------------------------------------------------------------- /check/internal/examples/obj/fooCl.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fooCl.mli:1: p1#g 2 | ./examples/obj/fooCl.mli:1: p1#h 3 | ./examples/obj/fooCl.mli:7: p2#h 4 | -------------------------------------------------------------------------------- /check/internal/examples/obj/fun_class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:1: c#m3 2 | -------------------------------------------------------------------------------- /check/internal/examples/obj/inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:1: p#h 2 | -------------------------------------------------------------------------------- /check/internal/examples/obj/named.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/named.mli:10: c#g 2 | -------------------------------------------------------------------------------- /check/internal/examples/obj/obj_inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/obj_inher.ml:1: c#g 2 | ./examples/obj/obj_inher.ml:1: c#h 3 | ./examples/obj/obj_inher.ml:19: o3#k 4 | -------------------------------------------------------------------------------- /check/internal/examples/obj/object.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:1: o#h 2 | -------------------------------------------------------------------------------- /check/internal/examples/obj/overr.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/overr.mli:1: p1#g 2 | ./examples/obj/overr.mli:1: p1#h 3 | ./examples/obj/overr.mli:7: p2#g 4 | ./examples/obj/overr.mli:7: p2#h 5 | -------------------------------------------------------------------------------- /check/internal/examples/opt-in-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:7: x 2 | -------------------------------------------------------------------------------- /check/internal/examples/opt-in-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:1: ?a 2 | ./examples/opt-in-opt.ml:5: ?a 3 | -------------------------------------------------------------------------------- /check/internal/examples/opt-in-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:2: ?a 2 | ./examples/opt-in-opt.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/internal/examples/partial_opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examlpes/partial_opt.ml:1: ?a 2 | ./examlpes/partial_opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/internal/examples/qux.mli: -------------------------------------------------------------------------------- 1 | ./examples/qux.ml:1: z 2 | -------------------------------------------------------------------------------- /check/internal/examples/record.mlit: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:3: t0.unused 2 | ./examples/record.mli:4: t0.f 3 | ./examples/record.mli:10: X.t.unused 4 | -------------------------------------------------------------------------------- /check/internal/examples/record.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/record.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?b 2 | -------------------------------------------------------------------------------- /check/internal/examples/record.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/record.ml:20: unit pattern c 2 | ./examples/record.ml:45: unit pattern c 3 | -------------------------------------------------------------------------------- /check/internal/examples/unused-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/unused-fn.ml:3: g 2 | ./examples/unused-fn.ml:5: var 3 | -------------------------------------------------------------------------------- /check/internal/examples/useless-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:3: x 2 | -------------------------------------------------------------------------------- /check/internal/examples/useless-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/internal/examples/variant.mlit: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:1: v.Unused 2 | ./examples/variant.mli:3: v2.Float 3 | ./examples/variant.mli:3: v2.Nothing 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/func.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/func.mli:3: M.c#f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/inc_val.mli: -------------------------------------------------------------------------------- 1 | ./examples/advanced/inc_val.mli:1: x 2 | ./examples/advanced/inc_val.mli:2: y 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/incl.mli1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/incl.ml:7: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/incl.mlio1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/advanced/incl.mlio1 -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/mod.mli1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/mod.mli:1: f 2 | ./examples/advanced/mod.mli:2: x 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/mod.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/advanced/mod.mlio -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/mod.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/mod.mli:4: p#f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/advanced/val.mli1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/val.mli:1: x 2 | ./examples/advanced/val.mli:2: y 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/bar-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar-fn.ml:3: h 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/bar.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar.ml:1: x 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/baz.mli: -------------------------------------------------------------------------------- 1 | ./examples/baz.mli:1: z 2 | ./examples/baz.mli:3: u 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/baz.mli1: -------------------------------------------------------------------------------- 1 | ./examples/baz.mli:2: t 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/baz.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/baz.ml:1: ?d 2 | ./examples/baz.ml:5: ?d 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/cond_sel.mli: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:13: h 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/cond_sel.mli1: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:9: f 2 | ./examples/cond_sel.ml:11: g 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/cond_sel.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:1: ?a 2 | ./examples/cond_sel.ml:1: ?b 3 | ./examples/cond_sel.ml:3: ?a 4 | ./examples/cond_sel.ml:3: ?b 5 | ./examples/cond_sel.ml:9: ?a 6 | ./examples/cond_sel.ml:9: ?b 7 | ./examples/cond_sel.ml:11: ?a 8 | ./examples/cond_sel.ml:11: ?b 9 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/alias-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:7: y 2 | ./examples/dir/alias-opt.ml:14: x 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/alias-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:4: baz 2 | ./examples/dir/alias-opt.ml:11: foo 3 | ./examples/dir/alias-opt.ml:12: bar 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/alias-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?a 2 | ./examples/dir/alias-opt.ml:3: ?a 3 | ./examples/dir/alias-opt.ml:12: ?a 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/alias-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?b 2 | ./examples/dir/alias-opt.ml:11: ?a 3 | ./examples/dir/alias-opt.ml:11: ?b 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/anon-call.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call.ml:1: f 2 | ./examples/dir/anon-call.ml:5: g 3 | ./examples/dir/anon-call.ml:9: h 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/anon-call2.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call2.ml:1: f 2 | ./examples/dir/anon-call2.ml:5: g 3 | ./examples/dir/anon-call2.ml:9: h 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/anonFn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/dir/anonFn.mli -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/anonFn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:2: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/anonFn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:1: ?b 2 | ./examples/dir/anonFn.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/anonFn2.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/dir/anonFn2.mli -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/fn-arg.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/fn-arg.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:1: f 2 | ./examples/dir/fn-arg.ml:3: g 3 | ./examples/dir/fn-arg.ml:9: i 4 | ./examples/dir/fn-arg.ml:11: j 5 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/fn-arg.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:1: ?a 2 | ./examples/dir/fn-arg.ml:1: ?b 3 | ./examples/dir/fn-arg.ml:3: ?b 4 | ./examples/dir/fn-arg.ml:7: ?a 5 | ./examples/dir/fn-arg.ml:7: ?b 6 | ./examples/dir/fn-arg.ml:9: ?c 7 | ./examples/dir/fn-arg.ml:9: ?b 8 | ./examples/dir/fn-arg.ml:11: ?b 9 | ./examples/dir/fn-arg.ml:11: ?b 10 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/fn-arg.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/fn-arg.mlstyle: -------------------------------------------------------------------------------- 1 | ./dir/fn-arg.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | ./dir/fn-arg.ml:9: val f: ... -> (... -> ?_:_ -> ...) -> ... 3 | ./dir/fn-arg.ml:11: val f: ... -> (... -> ?_:_ -> ...) -> ... 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/hidden_opt_use.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:1: f 2 | ./examples/dir/hidden_opt_use.ml:3: apply 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/hidden_opt_use.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:1: ?a 2 | ./examples/dir/hidden_opt_use.ml:1: ?b 3 | ./examples/dir/hidden_opt_use.ml:3: ?a 4 | ./examples/dir/hidden_opt_use.ml:3: ?b 5 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/hidden_opt_use.mloptn: -------------------------------------------------------------------------------- 1 | ./exmaples/dir/hidden_opt_use.ml:3: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/hidden_opt_use.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/match-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:8: l 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/match-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:3: m 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/match-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/match-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/match-opt.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:5: let () = ... in ... (=> use sequence) 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/mod.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/mod.mli:11: M.g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/mod.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/mod.mli:10: M.f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/partial.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/partial.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:5: g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/partial.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?a 2 | ./examples/dir/partial.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/partial.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-fn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/dir/ref-fn.mli -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-fn.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:5: g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-fn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-fn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/dir/ref-fn.mloptn -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:3: no 2 | ./examples/dir/ref-opt.ml:11: x 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:7: g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:1: ?a 2 | ./examples/dir/ref-opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/ref-opt.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/dir/ref-opt.mloptn -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/refFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/refFn.mli:3: x 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/refFn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/dir/refFn.mloptn -------------------------------------------------------------------------------- /check/threshold-1/examples/dir/sub_mod.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/dir/sub_mod.mli -------------------------------------------------------------------------------- /check/threshold-1/examples/exported.mli: -------------------------------------------------------------------------------- 1 | ./examples/exported.mli:11: F.times_five 2 | ./examples/exported.mli:17: M2.ten 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/exported.mli1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/exported.mli1 -------------------------------------------------------------------------------- /check/threshold-1/examples/foo.mli: -------------------------------------------------------------------------------- 1 | ./examples/foo.mli:2: y 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/foo.mli1: -------------------------------------------------------------------------------- 1 | ./exmaples/foo.mli:1: x 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/foo.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/foo.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/fooFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/fooFn.mli:2: g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/fooFn.mli1: -------------------------------------------------------------------------------- 1 | ./examples/fooFn.mli:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/functor.mli: -------------------------------------------------------------------------------- 1 | ./examples/functor.mli:3: M.none 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/functor.mli1: -------------------------------------------------------------------------------- 1 | ./exmaples/functor.mli:2: M.f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/if_end.mli1: -------------------------------------------------------------------------------- 1 | ./examples/if_end.ml:1: f 2 | ./examples/if_end.ml:3: g 3 | ./examples/if_end.ml:5: h 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/if_end.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/if_end.ml:3: ?d 2 | ./examples/if_end.ml:5: ?a 3 | ./examples/if_end.ml:5: ?b 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/if_end.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/if_end.mloptn -------------------------------------------------------------------------------- /check/threshold-1/examples/let-in.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-in.ml:3: parent 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/let-in.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/let-in.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/let-in.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:8: let x = ... in x (=> useless binding) 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/let-test.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-test.ml:3: g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/letIn.mli1: -------------------------------------------------------------------------------- 1 | ./exmaples/letIn.mli:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/letIn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/letIn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/mod_alias.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/mod_alias.mli -------------------------------------------------------------------------------- /check/threshold-1/examples/mod_alias.mli1: -------------------------------------------------------------------------------- 1 | ./examples/mod_alias.mli:2: M1.id 2 | ./examples/mod_alias.mli:6: M2.id 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/barCl.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/obj/barCl.mlio -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/barCl.mlio1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/obj/barCl.mlio1 -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/class.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:9: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:1: c#h 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/class.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:1: c#f 2 | ./examples/obj/class.mli:1: c#g 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/class_type.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class_type.mli:9: c#h 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/class_type.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/class_type.mli:7: p#f 2 | ./examples/obj/class_type.mli:7: p#h 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/coerce.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/coerce.mli:6: p#f 2 | ./examples/obj/coerce.mli:6: p#h 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/coerce.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/coerce.mli:8: c#h 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/constraint.mlio: -------------------------------------------------------------------------------- 1 | ./example/obj/constraint.ml:1: p#g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/constraint.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/constraint.ml:1: p#f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/depend.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-1/examples/obj/depend.mlio -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/depend.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/depend.ml:8: M.c#f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/fooCl.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fooCl.mli:1: p1#g 2 | ./examples/obj/fooCl.mli:1: p1#h 3 | ./examples/obj/fooCl.mli:7: p2#h 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/fooCl.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fooCl.mli:1: p1#f 2 | ./examples/obj/fooCl.mli:7: p2#g 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/fun_class.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:8: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/fun_class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:1: c#m3 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/fun_class.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:1: c#m1 2 | ./examples/obj/fun_class.ml:1: c#m2 3 | ./examples/obj/fun_class.ml:1: c#m4 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/fun_obj_param.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_obj_param.ml:7: app_m 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/fun_obj_param.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_obj_param.ml:1: f#m 2 | ./examples/obj/fun_obj_param.ml:1: f#n 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/inher.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:13: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:1: p#h 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/inher.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:1: p#f 2 | ./examples/obj/inher.mli:1: p#g 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/named.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/named.mli:10: c#g 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/named.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/named.mli:1: p1#g 2 | ./examples/obj/named.mli:6: p2#f 3 | ./examples/obj/named.mli:10: c#f 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/obj_inher.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/obj_inher.ml:7: o 2 | ./examples/obj/obj_inher.ml:12: o4 3 | ./examples/obj/obj_inher.ml:17: o2 4 | ./examples/obj/obj_inher.ml:19: o3 5 | ./examples/obj/obj_inher.ml:24: f 6 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/obj_inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/obj_inher.ml:1: c#g 2 | ./examples/obj/obj_inher.ml:1: c#h 3 | ./examples/obj/obj_inher.ml:19: o3#k 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/object.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:7: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/object.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:1: o#h 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/object.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:1: o#f 2 | ./examples/obj/object.ml:1: o#g 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/overr.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/overr.mli:1: p1#g 2 | ./examples/obj/overr.mli:1: p1#h 3 | ./examples/obj/overr.mli:7: p2#g 4 | ./examples/obj/overr.mli:7: p2#h 5 | -------------------------------------------------------------------------------- /check/threshold-1/examples/obj/overr.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/overr.mli:1: p1#f 2 | ./examples/obj/overr.mli:12: c#g 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/opt-in-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:7: x 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/opt-in-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:5: baz 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/opt-in-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:1: ?a 2 | ./examples/opt-in-opt.ml:5: ?a 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/opt-in-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:2: ?a 2 | ./examples/opt-in-opt.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/partial_opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/partial_opt.ml:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/partial_opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examlpes/partial_opt.ml:1: ?a 2 | ./examlpes/partial_opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/qux.mli: -------------------------------------------------------------------------------- 1 | ./examples/qux.ml:1: z 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/record.mlit: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:3: t0.unused 2 | ./examples/record.mli:4: t0.f 3 | ./examples/record.mli:10: X.t.unused 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/record.mlit1: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:11: X.t.used 2 | ./examples/record.mli:18: t2.r 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/record.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/record.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/record.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/record.ml:20: unit pattern c 2 | ./examples/record.ml:45: unit pattern c 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/unused-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/unused-fn.ml:3: g 2 | ./examples/unused-fn.ml:5: var 3 | -------------------------------------------------------------------------------- /check/threshold-1/examples/useless-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:3: x 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/useless-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:1: foo 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/useless-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/variant.mli1: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:5: f 2 | -------------------------------------------------------------------------------- /check/threshold-1/examples/variant.mlit: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:1: v.Unused 2 | ./examples/variant.mli:3: v2.Float 3 | ./examples/variant.mli:3: v2.Nothing 4 | -------------------------------------------------------------------------------- /check/threshold-1/examples/variant.mlit1: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:1: v.Used 2 | ./examples/variant.mli:3: v2.Nan 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/func.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/func.mli:3: M.c#f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/inc_val.mli: -------------------------------------------------------------------------------- 1 | ./examples/advanced/inc_val.mli:1: x 2 | ./examples/advanced/inc_val.mli:2: y 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/incl.mli1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/incl.ml:7: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/incl.mlio1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/advanced/incl.mlio1 -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/mod.mli1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/mod.mli:1: f 2 | ./examples/advanced/mod.mli:2: x 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/mod.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/advanced/mod.mlio -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/mod.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/mod.mli:4: p#f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/advanced/val.mli1: -------------------------------------------------------------------------------- 1 | ./examples/advanced/val.mli:1: x 2 | ./examples/advanced/val.mli:2: y 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/bar-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar-fn.ml:3: h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/bar.mli: -------------------------------------------------------------------------------- 1 | ./examples/bar.ml:1: x 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/baz.mli: -------------------------------------------------------------------------------- 1 | ./examples/baz.mli:1: z 2 | ./examples/baz.mli:3: u 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/baz.mli1: -------------------------------------------------------------------------------- 1 | ./examples/baz.mli:2: t 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/baz.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/baz.ml:1: ?d 2 | ./examples/baz.ml:5: ?d 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/baz.mloptn1: -------------------------------------------------------------------------------- 1 | ./examples/baz.ml:1: ?c (2/3 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/cond_sel.mli: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:13: h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/cond_sel.mli1: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:9: f 2 | ./examples/cond_sel.ml:11: g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/cond_sel.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/cond_sel.ml:1: ?a 2 | ./examples/cond_sel.ml:1: ?b 3 | ./examples/cond_sel.ml:3: ?a 4 | ./examples/cond_sel.ml:3: ?b 5 | ./examples/cond_sel.ml:9: ?a 6 | ./examples/cond_sel.ml:9: ?b 7 | ./examples/cond_sel.ml:11: ?a 8 | ./examples/cond_sel.ml:11: ?b 9 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/alias-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:7: y 2 | ./examples/dir/alias-opt.ml:14: x 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/alias-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:4: baz 2 | ./examples/dir/alias-opt.ml:11: foo 3 | ./examples/dir/alias-opt.ml:12: bar 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/alias-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?a 2 | ./examples/dir/alias-opt.ml:3: ?a 3 | ./examples/dir/alias-opt.ml:12: ?a 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/alias-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/alias-opt.ml:2: ?b 2 | ./examples/dir/alias-opt.ml:11: ?a 3 | ./examples/dir/alias-opt.ml:11: ?b 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anon-call.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call.ml:1: f 2 | ./examples/dir/anon-call.ml:5: g 3 | ./examples/dir/anon-call.ml:9: h 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anon-call2.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/anon-call2.ml:1: f 2 | ./examples/dir/anon-call2.ml:5: g 3 | ./examples/dir/anon-call2.ml:9: h 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/dir/anonFn.mli -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn.mli2: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.mli:1: f 2 | ./examples/dir/anonFn.mli:2: g 3 | ./examples/dir/anonFn.mli:3: h 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:2: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn.mlopta1: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.mli:1: ?a (1/2 calls) 2 | ./examples/dir/anonFn.mli:3: ?a (1/2 calls) 3 | ./examples/dir/anonFn.mli:3: ?b (1/2 calls) 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.ml:1: ?b 2 | ./examples/dir/anonFn.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn.mloptn1: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn.mli:1: ?a (1/2 calls) 2 | ./examples/dir/anonFn.mli:3: ?a (1/2 calls) 3 | ./examples/dir/anonFn.mli:3: ?b (1/2 calls) 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn2.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/dir/anonFn2.mli -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn2.mli3: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn2.mli:1: f 2 | ./examples/dir/anonFn2.mli:2: g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn2.mlopta1: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn2.mli:1: ?a (2/3 calls) 2 | ./examples/dir/anonFn2.mli:2: ?a (2/3 calls) 3 | ./examples/dir/anonFn2.mli:2: ?b (2/3 calls) 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/anonFn2.mloptn1: -------------------------------------------------------------------------------- 1 | ./examples/dir/anonFn2.mli:1: ?b (2/3 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/fn-arg.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/fn-arg.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:1: f 2 | ./examples/dir/fn-arg.ml:3: g 3 | ./examples/dir/fn-arg.ml:9: i 4 | ./examples/dir/fn-arg.ml:11: j 5 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/fn-arg.mli2: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:7: h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/fn-arg.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:1: ?a 2 | ./examples/dir/fn-arg.ml:1: ?b 3 | ./examples/dir/fn-arg.ml:3: ?b 4 | ./examples/dir/fn-arg.ml:7: ?a 5 | ./examples/dir/fn-arg.ml:7: ?b 6 | ./examples/dir/fn-arg.ml:9: ?c 7 | ./examples/dir/fn-arg.ml:9: ?b 8 | ./examples/dir/fn-arg.ml:11: ?b 9 | ./examples/dir/fn-arg.ml:11: ?b 10 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/fn-arg.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/fn-arg.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/fn-arg.mlstyle: -------------------------------------------------------------------------------- 1 | ./dir/fn-arg.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | ./dir/fn-arg.ml:9: val f: ... -> (... -> ?_:_ -> ...) -> ... 3 | ./dir/fn-arg.ml:11: val f: ... -> (... -> ?_:_ -> ...) -> ... 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/hidden_opt_use.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:1: f 2 | ./examples/dir/hidden_opt_use.ml:3: apply 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/hidden_opt_use.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:1: ?a 2 | ./examples/dir/hidden_opt_use.ml:1: ?b 3 | ./examples/dir/hidden_opt_use.ml:3: ?a 4 | ./examples/dir/hidden_opt_use.ml:3: ?b 5 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/hidden_opt_use.mloptn: -------------------------------------------------------------------------------- 1 | ./exmaples/dir/hidden_opt_use.ml:3: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/hidden_opt_use.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/hidden_opt_use.ml:3: val f: ... -> (... -> ?_:_ -> ...) -> ... 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/match-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:8: l 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/match-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:3: m 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/match-opt.mli3: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/match-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/match-opt.mlopta1: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:1: ?b (2/3 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/match-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:3: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/match-opt.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/dir/match-opt.ml:5: let () = ... in ... (=> use sequence) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/mod.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/mod.mli:11: M.g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/mod.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/mod.mli:10: M.f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/partial.mli: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/partial.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:5: g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/partial.mli2: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/partial.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?a 2 | ./examples/dir/partial.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/partial.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/dir/partial.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-fn.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/dir/ref-fn.mli -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-fn.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:5: g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-fn.mli3: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-fn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-fn.mlopta1: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-fn.ml:1: ?a (2/3 calls) 2 | ./examples/dir/ref-fn.ml:1: ?b (2/3 calls) 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-fn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/dir/ref-fn.mloptn -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:3: no 2 | ./examples/dir/ref-opt.ml:11: x 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:7: g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-opt.mli2: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:1: f 2 | ./examples/dir/ref-opt.ml:5: r 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/dir/ref-opt.ml:1: ?a 2 | ./examples/dir/ref-opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/ref-opt.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/dir/ref-opt.mloptn -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/refFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/dir/refFn.mli:3: x 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/refFn.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/dir/refFn.mloptn -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/dir/sub_mod.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/dir/sub_mod.mli -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/exported.mli: -------------------------------------------------------------------------------- 1 | ./examples/exported.mli:11: F.times_five 2 | ./examples/exported.mli:17: M2.ten 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/exported.mli1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/exported.mli1 -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/exported.mli2: -------------------------------------------------------------------------------- 1 | ./examples/exported.mli:6: M1.five 2 | ./examples/exported.mli:15: M2.five 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/exported.mli3: -------------------------------------------------------------------------------- 1 | ./examples/exported.mli:10: F.plus_five 2 | ./examples/exported.mli:16: M2.plus_five 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/foo.mli: -------------------------------------------------------------------------------- 1 | ./examples/foo.mli:2: y 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/foo.mli1: -------------------------------------------------------------------------------- 1 | ./exmaples/foo.mli:1: x 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/foo.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/foo.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/foo.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/fooFn.mli: -------------------------------------------------------------------------------- 1 | ./examples/fooFn.mli:2: g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/fooFn.mli1: -------------------------------------------------------------------------------- 1 | ./examples/fooFn.mli:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/functor.mli: -------------------------------------------------------------------------------- 1 | ./examples/functor.mli:3: M.none 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/functor.mli1: -------------------------------------------------------------------------------- 1 | ./exmaples/functor.mli:2: M.f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/functor.mli2: -------------------------------------------------------------------------------- 1 | ./examples/functor.mli:7: F.g 2 | ./examples/functor.mli:11: N.g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/if_end.mli1: -------------------------------------------------------------------------------- 1 | ./examples/if_end.ml:1: f 2 | ./examples/if_end.ml:3: g 3 | ./examples/if_end.ml:5: h 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/if_end.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/if_end.ml:3: ?d 2 | ./examples/if_end.ml:5: ?a 3 | ./examples/if_end.ml:5: ?b 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/if_end.mloptn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/if_end.mloptn -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/let-in.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-in.ml:3: parent 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/let-in.mli3: -------------------------------------------------------------------------------- 1 | ./examples/let-in.ml:1: complicated 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/let-in.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/let-in.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:1: ?c 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/let-in.mloptn1: -------------------------------------------------------------------------------- 1 | ./examples/let-in.ml:1: ?b (2/3 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/let-in.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/opam/let-in.ml:8: let x = ... in x (=> useless binding) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/let-test.mli: -------------------------------------------------------------------------------- 1 | ./examples/let-test.ml:3: g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/letIn.mli1: -------------------------------------------------------------------------------- 1 | ./exmaples/letIn.mli:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/letIn.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/letIn.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/letIn.ml:1: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/matchopt.mli: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:5: w 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/matchopt.mlopta1: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:1: ?x (3/4 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/matchopt.mloptn1: -------------------------------------------------------------------------------- 1 | ./examples/matchopt.ml:1: ?y (3/4 calls) 2 | ./examples/matchopt.ml:1: ?z (3/4 calls) 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/mod_alias.mli: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/mod_alias.mli -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/mod_alias.mli1: -------------------------------------------------------------------------------- 1 | ./examples/mod_alias.mli:2: M1.id 2 | ./examples/mod_alias.mli:6: M2.id 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/barCl.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/obj/barCl.mlio -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/barCl.mlio1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/obj/barCl.mlio1 -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/class.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:9: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/class.mli2: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:7: o 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:1: c#h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/class.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/class.mli:1: c#f 2 | ./examples/obj/class.mli:1: c#g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/class_type.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/class_type.mli:9: c#h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/class_type.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/class_type.mli:7: p#f 2 | ./examples/obj/class_type.mli:7: p#h 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/class_type.mlio2: -------------------------------------------------------------------------------- 1 | ./examples/obj/class_type.mli:7: p#g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/coerce.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/coerce.mli:6: p#f 2 | ./examples/obj/coerce.mli:6: p#h 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/coerce.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/coerce.mli:8: c#h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/coerce.mlio2: -------------------------------------------------------------------------------- 1 | ./examples/obj/coerce.mli:8: c#f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/constraint.mlio: -------------------------------------------------------------------------------- 1 | ./example/obj/constraint.ml:1: p#g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/constraint.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/constraint.ml:1: p#f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/depend.mlio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/obj/depend.mlio -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/depend.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/depend.ml:8: M.c#f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fooCl.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fooCl.mli:1: p1#g 2 | ./examples/obj/fooCl.mli:1: p1#h 3 | ./examples/obj/fooCl.mli:7: p2#h 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fooCl.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fooCl.mli:1: p1#f 2 | ./examples/obj/fooCl.mli:7: p2#g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fun_class.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:8: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fun_class.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:1: c#m3 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fun_class.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_class.ml:1: c#m1 2 | ./examples/obj/fun_class.ml:1: c#m2 3 | ./examples/obj/fun_class.ml:1: c#m4 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fun_obj_param.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_obj_param.ml:7: app_m 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fun_obj_param.mli2: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_obj_param.ml:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fun_obj_param.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_obj_param.ml:1: f#m 2 | ./examples/obj/fun_obj_param.ml:1: f#n 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/fun_obj_param.mlio2: -------------------------------------------------------------------------------- 1 | ./examples/obj/fun_obj_param.ml:1: f#x 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/inher.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:13: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/inher.mli2: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:11: o 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:1: p#h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/inher.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/inher.mli:1: p#f 2 | ./examples/obj/inher.mli:1: p#g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/named.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/named.mli:10: c#g 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/named.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/named.mli:1: p1#g 2 | ./examples/obj/named.mli:6: p2#f 3 | ./examples/obj/named.mli:10: c#f 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/named.mlio2: -------------------------------------------------------------------------------- 1 | ./examples/obj/named.mli:1: p1#f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/obj_inher.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/obj_inher.ml:7: o 2 | ./examples/obj/obj_inher.ml:12: o4 3 | ./examples/obj/obj_inher.ml:17: o2 4 | ./examples/obj/obj_inher.ml:19: o3 5 | ./examples/obj/obj_inher.ml:24: f 6 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/obj_inher.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/obj_inher.ml:1: c#g 2 | ./examples/obj/obj_inher.ml:1: c#h 3 | ./examples/obj/obj_inher.ml:19: o3#k 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/obj_inher.mlio2: -------------------------------------------------------------------------------- 1 | ./examples/obj/obj_inher.ml:1: c#f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/object.mli1: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:7: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/object.mli2: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:1: o 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/object.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:1: o#h 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/object.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/object.ml:1: o#f 2 | ./examples/obj/object.ml:1: o#g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/object.mlio2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/obj/object.mlio2 -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/overr.mlio: -------------------------------------------------------------------------------- 1 | ./examples/obj/overr.mli:1: p1#g 2 | ./examples/obj/overr.mli:1: p1#h 3 | ./examples/obj/overr.mli:7: p2#g 4 | ./examples/obj/overr.mli:7: p2#h 5 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/obj/overr.mlio1: -------------------------------------------------------------------------------- 1 | ./examples/obj/overr.mli:1: p1#f 2 | ./examples/obj/overr.mli:12: c#g 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt-in-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:7: x 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt-in-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:5: baz 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt-in-opt.mli2: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:1: foo 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt-in-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:1: ?a 2 | ./examples/opt-in-opt.ml:5: ?a 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt-in-opt.mlopta1: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:1: ?b (1/2 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt-in-opt.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:2: ?a 2 | ./examples/opt-in-opt.ml:2: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt-in-opt.mloptn1: -------------------------------------------------------------------------------- 1 | ./examples/opt-in-opt.ml:1: ?b (1/2 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt/sig_struct.mli2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/opt/sig_struct.mli2 -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt/sig_struct.mli3: -------------------------------------------------------------------------------- 1 | ./examples/opt/sig_struct.ml:6: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt/sig_struct.mlopta1: -------------------------------------------------------------------------------- 1 | ./examples/opt/sig_struct.ml:2: ?x (2/3 calls) 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/opt/sig_struct.mloptn1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LexiFi/dead_code_analyzer/c44dc2ea5ccb13df2145e9316e21c39f09dad506/check/threshold-3-0.5/examples/opt/sig_struct.mloptn1 -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/partial_opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/partial_opt.ml:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/partial_opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examlpes/partial_opt.ml:1: ?a 2 | ./examlpes/partial_opt.ml:1: ?b 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/qux.mli: -------------------------------------------------------------------------------- 1 | ./examples/qux.ml:1: z 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/record.mlit: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:3: t0.unused 2 | ./examples/record.mli:4: t0.f 3 | ./examples/record.mli:10: X.t.unused 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/record.mlit1: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:11: X.t.used 2 | ./examples/record.mli:18: t2.r 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/record.mlit2: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: X.t.f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/record.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/record.mloptn: -------------------------------------------------------------------------------- 1 | ./examples/record.mli:12: ?b 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/record.mlstyle: -------------------------------------------------------------------------------- 1 | ./examples/record.ml:20: unit pattern c 2 | ./examples/record.ml:45: unit pattern c 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/unused-fn.mli: -------------------------------------------------------------------------------- 1 | ./examples/unused-fn.ml:3: g 2 | ./examples/unused-fn.ml:5: var 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/unused-fn.mli2: -------------------------------------------------------------------------------- 1 | ./examples/unused-fn.ml:1: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/useless-opt.mli: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:3: x 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/useless-opt.mli1: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:1: foo 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/useless-opt.mlopta: -------------------------------------------------------------------------------- 1 | ./examples/useless-opt.ml:1: ?a 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/variant.mli1: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:5: f 2 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/variant.mlit: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:1: v.Unused 2 | ./examples/variant.mli:3: v2.Float 3 | ./examples/variant.mli:3: v2.Nothing 4 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/variant.mlit1: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:1: v.Used 2 | ./examples/variant.mli:3: v2.Nan 3 | -------------------------------------------------------------------------------- /check/threshold-3-0.5/examples/variant.mlit2: -------------------------------------------------------------------------------- 1 | ./examples/variant.mli:3: v2.Int 2 | -------------------------------------------------------------------------------- /dead_code_analyzer.install: -------------------------------------------------------------------------------- 1 | bin: [ 2 | "build/dead_code_analyzer.byt" 3 | "build/dead_code_analyzer.opt" 4 | ] 5 | 6 | man: [ "man/man3/dead_code_analyzer.3o" ] 7 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | SRCS=../src/deadCode.mli 2 | LIBS=-I +compiler-libs 3 | DOCFLAGS=-html 4 | 5 | all: 6 | ocamldoc $(LIBS) $(DOCFLAGS) $(SRCS) 7 | 8 | clean: 9 | rm -f *.html *.css 10 | -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | COMPFLAGS=-w +A -I +compiler-libs -bin-annot -keep-locs 2 | OCAMLC=ocamlc $(COMPFLAGS) 3 | OCAMLOPT=ocamlopt $(COMPFLAGS) 4 | SRC=foo.mli foo.ml bar.ml baz.mli baz.ml qux.ml ifelse.ml match.ml matchopt.ml\ 5 | opt-in-opt.ml useless-opt.ml unused-fn.ml fooFn.mli fooFn.ml bar-fn.ml\ 6 | letIn.mli letIn.ml let-test.ml let-in.ml cond_sel.ml if_end.ml\ 7 | mod_alias.mli mod_alias.ml functor.mli functor.ml partial_opt.ml\ 8 | record.mli record.ml variant.mli variant.ml exported.mli exported.ml 9 | 10 | all: build 11 | ../build/dead_code_analyzer.byt $(DEADFLAGS) . 12 | 13 | build: 14 | $(OCAMLC) -c $(SRC) 15 | make -C dir 16 | make -C obj 17 | make -C opt 18 | make -C advanced 19 | 20 | clean: 21 | rm -f *~ *.cm* *.o *.obj 22 | make -C dir clean 23 | make -C obj clean 24 | make -C opt clean 25 | make -C advanced clean 26 | -------------------------------------------------------------------------------- /examples/advanced/Makefile: -------------------------------------------------------------------------------- 1 | COMPFLAGS=-w +A -I +compiler-libs -bin-annot -keep-locs 2 | OCAMLC=ocamlc $(COMPFLAGS) 3 | OCAMLOPT=ocamlopt $(COMPFLAGS) 4 | SRC=mod.mli mod.ml incl.ml func.mli func.ml use_func.ml val.mli inc_val.mli val.ml inc_val.ml 5 | 6 | all: 7 | $(OCAMLC) -c $(SRC) 8 | 9 | build: 10 | $(OCAMLC) -c $(SRC) 11 | 12 | clean: 13 | rm -f *~ *.cm* *.o *.obj 14 | -------------------------------------------------------------------------------- /examples/advanced/func.ml: -------------------------------------------------------------------------------- 1 | module type T = sig 2 | type t 3 | class c : object 4 | method f : t 5 | end 6 | end 7 | 8 | module M ( ) : (T with type t = unit) = struct 9 | type t = unit 10 | class c = object 11 | method f = () 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /examples/advanced/func.mli: -------------------------------------------------------------------------------- 1 | module type T = sig 2 | type t 3 | class c : object 4 | method f : t 5 | end 6 | end 7 | 8 | module M ( ) : T with type t = unit 9 | -------------------------------------------------------------------------------- /examples/advanced/inc_val.ml: -------------------------------------------------------------------------------- 1 | include Val 2 | -------------------------------------------------------------------------------- /examples/advanced/inc_val.mli: -------------------------------------------------------------------------------- 1 | val x : int 2 | val y : int 3 | -------------------------------------------------------------------------------- /examples/advanced/incl.ml: -------------------------------------------------------------------------------- 1 | let f () = () 2 | 3 | include Mod 4 | 5 | class d = c 6 | 7 | let f () = ignore x |> f 8 | 9 | let () = 10 | let o = new d in 11 | o#f |> f 12 | -------------------------------------------------------------------------------- /examples/advanced/mod.ml: -------------------------------------------------------------------------------- 1 | let f () = () 2 | let x = 2 3 | 4 | class p = object 5 | method f = () 6 | end 7 | 8 | class c = object 9 | inherit p 10 | end 11 | -------------------------------------------------------------------------------- /examples/advanced/mod.mli: -------------------------------------------------------------------------------- 1 | val f : unit -> unit 2 | val x : int 3 | 4 | class p : object 5 | method f : unit 6 | end 7 | 8 | class c : object 9 | inherit p 10 | end 11 | -------------------------------------------------------------------------------- /examples/advanced/use_func.ml: -------------------------------------------------------------------------------- 1 | module M = Func.M ( ) 2 | 3 | include M 4 | 5 | let () = let o = new c in o#f 6 | -------------------------------------------------------------------------------- /examples/advanced/val.ml: -------------------------------------------------------------------------------- 1 | let x = 0 2 | let y = 0 3 | -------------------------------------------------------------------------------- /examples/advanced/val.mli: -------------------------------------------------------------------------------- 1 | val x : int 2 | val y : int 3 | -------------------------------------------------------------------------------- /examples/bar-fn.ml: -------------------------------------------------------------------------------- 1 | open FooFn 2 | 3 | let h = f 4 | -------------------------------------------------------------------------------- /examples/bar.ml: -------------------------------------------------------------------------------- 1 | let x = Foo.x 2 | -------------------------------------------------------------------------------- /examples/baz.ml: -------------------------------------------------------------------------------- 1 | let g ?(c = 0) ?(d = 0) () = c + d 2 | 3 | let z = g ~d:30 () 4 | 5 | let t = let tmp ?(d = 12) () = d in g ~c:(tmp ~d:5 ()) ~d:0 () 6 | 7 | let u = g ~d:40 () 8 | -------------------------------------------------------------------------------- /examples/baz.mli: -------------------------------------------------------------------------------- 1 | val z : int 2 | val t : int 3 | val u : int 4 | -------------------------------------------------------------------------------- /examples/cond_sel.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?b c = c 2 | 3 | let g ?a ?b c = c 4 | 5 | let h ?a ?b c d = 6 | (if (d >= 0) then f 7 | else g) ?a ?b c 8 | 9 | let f ?a ?b c = c 10 | 11 | let g ?a ?b c = c 12 | 13 | let h ?a ?b c d = 14 | begin match d with 15 | | 0 -> f 16 | | _ -> g end 17 | ?a ?b c 18 | -------------------------------------------------------------------------------- /examples/dir/Makefile: -------------------------------------------------------------------------------- 1 | COMPFLAGS=-w +A -I +compiler-libs -bin-annot -keep-locs 2 | OCAMLC=ocamlc $(COMPFLAGS) 3 | OCAMLOPT=ocamlopt $(COMPFLAGS) 4 | SRC=refFn.mli refFn.ml ref-fn.ml ref-opt.ml anonFn.mli anonFn.ml anon-call.ml\ 5 | anonFn2.mli anonFn2.ml anon-call2.ml alias-opt.ml ref-opt.ml fn-arg.ml\ 6 | partial.ml match-opt.ml mod.mli mod.ml sub_mod.mli sub_mod.ml\ 7 | hidden_opt_use.ml matchopt.ml 8 | 9 | all: 10 | $(OCAMLC) -c $(SRC) 11 | 12 | clean: 13 | rm -f *~ *.cm* *.o *.obj 14 | -------------------------------------------------------------------------------- /examples/dir/alias-opt.ml: -------------------------------------------------------------------------------- 1 | (* foo's and bar's a are always used; b never is *) 2 | let foo ?a ?b () = 0 3 | let bar ?a = foo ~a 4 | let baz = foo 5 | 6 | let x = bar ~a:0 () 7 | let y = baz ~a:0 () 8 | 9 | 10 | (* foo's a and b are never used; bar's a is always used *) 11 | let foo ?a ?b () = 0 12 | let bar ?a = foo 13 | 14 | let x = bar ~a:0 () 15 | -------------------------------------------------------------------------------- /examples/dir/anon-call.ml: -------------------------------------------------------------------------------- 1 | let f x = 2 | if x > 32 then let tmp = (fun l -> List.map (AnonFn.f ~a:12) l) in ignore (tmp []) 3 | else if x mod 4 <> 0 then let tmp = (fun l -> List.map (AnonFn.f) l) in ignore (tmp []) 4 | 5 | let g x = 6 | if x > 32 then let tmp = (fun l -> List.map (AnonFn.g ~a:12) l) in ignore (tmp []) 7 | else if x mod 4 <> 0 then let tmp = (fun l -> List.map (AnonFn.g ~a:12) l) in ignore (tmp []) 8 | 9 | let h x = 10 | if x > 32 then let tmp = (fun l -> List.map (AnonFn.h ~b:12) l) in ignore (tmp []) 11 | else if x mod 4 <> 0 then let tmp = (fun l -> List.map (AnonFn.h ~a:12) l) in ignore (tmp []) 12 | -------------------------------------------------------------------------------- /examples/dir/anon-call2.ml: -------------------------------------------------------------------------------- 1 | let f x = 2 | if x > 32 then let tmp = (fun l -> List.map (AnonFn2.f ~a:12) l) in ignore (tmp []) 3 | else if x mod 4 <> 0 then let tmp = (fun l -> List.map (AnonFn2.f ~a:12) l) in ignore (tmp []) 4 | 5 | let g x = 6 | if x > 32 then let tmp = (fun l -> List.map (AnonFn2.g ~a:12) l) in ignore (tmp []) 7 | else if x mod 4 <> 0 then let tmp = (fun l -> List.map (AnonFn2.g ~b:12 ~a:12) l) in ignore (tmp []) 8 | 9 | let h x = 10 | if x > 32 then let tmp = (fun l -> List.map (AnonFn2.g ~b:12) l) in ignore (tmp []) 11 | else if x mod 4 <> 0 then let tmp = (fun l -> List.map (AnonFn2.f ~b:12) l) in ignore (tmp []) 12 | -------------------------------------------------------------------------------- /examples/dir/anonFn.ml: -------------------------------------------------------------------------------- 1 | let f ?(a = 0) ?(b = 0) x = a + b + x 2 | let g ?(a = 0) ?(b = 0) x = a + b + x 3 | let h ?(a = 0) ?(b = 0) x = a + b + x 4 | -------------------------------------------------------------------------------- /examples/dir/anonFn.mli: -------------------------------------------------------------------------------- 1 | val f: ?a:int -> ?b:int -> int -> int 2 | val g: ?a:int -> ?b:int -> int -> int 3 | val h: ?a:int -> ?b:int -> int -> int 4 | -------------------------------------------------------------------------------- /examples/dir/anonFn2.ml: -------------------------------------------------------------------------------- 1 | let f ?(a = 0) ?(b = 0) x = a + b + x 2 | let g ?(a = 0) ?(b = 0) x = a + b + x 3 | -------------------------------------------------------------------------------- /examples/dir/anonFn2.mli: -------------------------------------------------------------------------------- 1 | val f: ?a:int -> ?b:int -> int -> int 2 | val g: ?a:int -> ?b:int -> int -> int 3 | -------------------------------------------------------------------------------- /examples/dir/fn-arg.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?b c = c 2 | 3 | let g ?b f x = f ?b x 4 | 5 | let () = ignore (g (f ~a:1) 0) 6 | 7 | let h ?a ?b c = c 8 | 9 | let i ?c f x= f ?b:c x 10 | 11 | let j ?b f x = f ?b x 12 | 13 | let () = ignore (i (h ~a:1) ~c:5 0) 14 | 15 | let () = ignore (j (h ~a:1) ~b:3 0) 16 | -------------------------------------------------------------------------------- /examples/dir/hidden_opt_use.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?b x = x 2 | 3 | let apply (f: ?a:'a -> ?b:'b -> 'c -> 'd) ?a x = f ?a ~b:0 x 4 | 5 | let () = apply f 2 |> ignore 6 | -------------------------------------------------------------------------------- /examples/dir/match-opt.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?b c = c 2 | 3 | let m ?b = function 4 | _::_ as l -> 5 | let () = f ~a:1 ?b 0 |> ignore in [f ~a:1 ?b 0] 6 | | [] -> [f ~a:1 0] 7 | 8 | let l = m [] 9 | -------------------------------------------------------------------------------- /examples/dir/matchopt.ml: -------------------------------------------------------------------------------- 1 | let foo ?(x = true) ?(y = 42) ?z () = match z with 2 | Some n -> n 3 | | _ -> y 4 | 5 | let w = match foo ~x:false () with 6 | n when n = foo ~x:true ~z:12 () -> n 7 | | _ when true -> foo ~x:true () 8 | | 1 -> foo ~y:1 () 9 | -------------------------------------------------------------------------------- /examples/dir/mod.ml: -------------------------------------------------------------------------------- 1 | module type G = sig 2 | val is_even: int -> bool 3 | val is_odd: int -> bool 4 | end 5 | 6 | module I: G = struct 7 | let is_even x = x mod 2 = 0 8 | let is_odd x = not @@ is_even x 9 | end 10 | 11 | 12 | module M(G: G) = struct 13 | module G = G 14 | 15 | let f = G.is_even 16 | let g = G.is_odd 17 | end 18 | 19 | module MG = M(I) 20 | 21 | let test = MG.f 12 22 | -------------------------------------------------------------------------------- /examples/dir/mod.mli: -------------------------------------------------------------------------------- 1 | module type G = sig 2 | val is_even: int -> bool 3 | val is_odd: int -> bool 4 | end 5 | 6 | module I: G 7 | 8 | module M(G: G): sig 9 | module G: G 10 | val f: int -> bool 11 | val g: int -> bool 12 | end 13 | -------------------------------------------------------------------------------- /examples/dir/partial.ml: -------------------------------------------------------------------------------- 1 | let f ?(a = 1) ?(b = 1) ?(c = 1) d = ignore d 2 | 3 | let () = f ~a:1 ~b:1 0 4 | 5 | let g = f ~a:1 6 | 7 | let () = g ~b:1 0 8 | -------------------------------------------------------------------------------- /examples/dir/ref-fn.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?b ?c () = 312 2 | 3 | let () = RefFn.r := f ~c:0 4 | 5 | let g = f ~c:0 6 | 7 | let () = 8 | let a = f ~c:1 () 9 | in RefFn.r := g; print_int (a - (!RefFn.r ~b:1 ())) 10 | 11 | -------------------------------------------------------------------------------- /examples/dir/ref-opt.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?(b = 12) x = x 2 | 3 | let no x = x + 12 4 | 5 | let r = ref f 6 | 7 | let g = f 8 | 9 | let () = r := g 10 | 11 | let x = !r ~a:1 0 12 | -------------------------------------------------------------------------------- /examples/dir/refFn.ml: -------------------------------------------------------------------------------- 1 | let r = ref (fun ?a ?b () -> 0) 2 | 3 | let x = !r () + 12 4 | -------------------------------------------------------------------------------- /examples/dir/refFn.mli: -------------------------------------------------------------------------------- 1 | val r: (?a:int -> ?b:int -> unit -> int) ref 2 | 3 | val x: int 4 | -------------------------------------------------------------------------------- /examples/dir/sub_mod.ml: -------------------------------------------------------------------------------- 1 | module type T = sig 2 | val nothing: unit -> unit 3 | end 4 | 5 | module I: T = struct 6 | let nothing () = () 7 | end 8 | 9 | module F(I: T) = struct 10 | module M = I 11 | end 12 | -------------------------------------------------------------------------------- /examples/dir/sub_mod.mli: -------------------------------------------------------------------------------- 1 | module type T = sig 2 | val nothing: unit -> unit 3 | end 4 | 5 | module I: T 6 | 7 | module F(I: T): sig 8 | module M: T 9 | end 10 | -------------------------------------------------------------------------------- /examples/exported.ml: -------------------------------------------------------------------------------- 1 | module type T = sig 2 | val five : int 3 | end 4 | 5 | module M1 = struct 6 | 7 | let five = 5 8 | end 9 | 10 | module F (M: T) = struct 11 | 12 | let plus_five n = n + M.five 13 | let times_five n = n * M.five 14 | end 15 | 16 | module M2 = struct 17 | 18 | include M1 19 | include F(M1) 20 | 21 | let ten = plus_five five 22 | end 23 | 24 | let () = 25 | let twenty = M2.plus_five 5 + M2.plus_five 5 in 26 | print_int twenty 27 | -------------------------------------------------------------------------------- /examples/exported.mli: -------------------------------------------------------------------------------- 1 | module type T = sig 2 | val five : int 3 | end 4 | 5 | module M1 : sig 6 | val five : int 7 | end 8 | 9 | module F (M: T) : sig 10 | val plus_five : int -> int 11 | val times_five : int -> int 12 | end 13 | 14 | module M2 : sig 15 | val five : int 16 | val plus_five : int -> int 17 | val ten : int 18 | end 19 | -------------------------------------------------------------------------------- /examples/foo.ml: -------------------------------------------------------------------------------- 1 | let f ?(a = 0) ?(b = 0) () = a + b 2 | 3 | let x = f ~b:30 () 4 | 5 | let y = f ~b:40 () 6 | -------------------------------------------------------------------------------- /examples/foo.mli: -------------------------------------------------------------------------------- 1 | val x: int 2 | val y: int 3 | -------------------------------------------------------------------------------- /examples/fooFn.ml: -------------------------------------------------------------------------------- 1 | let f x = 12 2 | let g x = 0 3 | -------------------------------------------------------------------------------- /examples/fooFn.mli: -------------------------------------------------------------------------------- 1 | val f: 'a -> int 2 | val g: 'a -> int 3 | -------------------------------------------------------------------------------- /examples/functor.ml: -------------------------------------------------------------------------------- 1 | module M = struct 2 | let f x = x mod 2 = 0 3 | let none () = () 4 | end 5 | 6 | module F(M:sig val f: int -> bool end) = struct 7 | let g x = not @@ M.f x 8 | end 9 | 10 | module N = F(M) 11 | 12 | let () = ignore @@ N.g 12 13 | 14 | module X = F(struct let f _ = false end) 15 | 16 | let () = ignore @@ X.g 14 17 | 18 | module Unused = Set.Make(struct 19 | type t = int 20 | let compare a b = if a > b then 0 else 12 21 | let none () = () 22 | end) 23 | -------------------------------------------------------------------------------- /examples/functor.mli: -------------------------------------------------------------------------------- 1 | module M: sig 2 | val f: int -> bool 3 | val none: unit -> unit 4 | end 5 | 6 | module F(M: sig val f: int -> bool end):sig 7 | val g: int -> bool 8 | end 9 | 10 | module N: sig 11 | val g: int -> bool 12 | end 13 | 14 | module Unused: Set.S 15 | -------------------------------------------------------------------------------- /examples/if_end.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?b c = c 2 | 3 | let g ?a ?b ?d c = c 4 | 5 | let h d = if d then f else g ~d 6 | 7 | let () = h false ~a:1 ~b:3 0 |> ignore 8 | -------------------------------------------------------------------------------- /examples/ifelse.ml: -------------------------------------------------------------------------------- 1 | if false then () 2 | else if true then () 3 | else () 4 | -------------------------------------------------------------------------------- /examples/let-in.ml: -------------------------------------------------------------------------------- 1 | let complicated ?a ?b ?c d = d 2 | 3 | let parent = 4 | let fst_son = complicated ~a:2 0 in 5 | let snd_son = 6 | let fst_grand_son = complicated ~a:0 ~b:1 12 in 7 | let snd_grand_son = 8 | let great_greand_son = complicated ~a:13 0 in 9 | great_greand_son in 10 | snd_grand_son + fst_grand_son in 11 | fst_son + snd_son 12 | -------------------------------------------------------------------------------- /examples/let-test.ml: -------------------------------------------------------------------------------- 1 | open LetIn 2 | 3 | let g x y z = match (z, x) with 4 | (a, b) when b mod 2 <> 0 -> () 5 | | _ -> let h a b = a + b in 6 | let i = f x y ~a:0 z in 7 | ignore (h i i) 8 | -------------------------------------------------------------------------------- /examples/letIn.ml: -------------------------------------------------------------------------------- 1 | let f n c ?a ?b s = n 2 | -------------------------------------------------------------------------------- /examples/letIn.mli: -------------------------------------------------------------------------------- 1 | val f: 'a -> 'b -> ?a:'c -> ?b:'b -> 'd -> 'a 2 | -------------------------------------------------------------------------------- /examples/match.ml: -------------------------------------------------------------------------------- 1 | match 1 with 2 | 0 -> () 3 | | 3 -> () 4 | | _ -> () 5 | | 1 -> () 6 | -------------------------------------------------------------------------------- /examples/matchopt.ml: -------------------------------------------------------------------------------- 1 | let foo ?(x = true) ?(y = 42) ?z () = match z with 2 | Some n -> n 3 | | _ -> y 4 | 5 | let w = match foo ~x:false () with 6 | n when n = foo ~x:true ~z:12 () -> n 7 | | _ when true -> foo ~x:true () 8 | | 1 -> foo ~y:1 () 9 | -------------------------------------------------------------------------------- /examples/mod_alias.ml: -------------------------------------------------------------------------------- 1 | module M1 = struct 2 | let id x = x 3 | end 4 | 5 | module M2 = M1 6 | 7 | let id = M2.id 8 | -------------------------------------------------------------------------------- /examples/mod_alias.mli: -------------------------------------------------------------------------------- 1 | module M1: sig 2 | val id: 'a -> 'a 3 | end 4 | 5 | module M2: sig 6 | val id: 'a -> 'a 7 | end 8 | -------------------------------------------------------------------------------- /examples/obj/Makefile: -------------------------------------------------------------------------------- 1 | COMPFLAGS=-w +A -I +compiler-libs -bin-annot -keep-locs 2 | OCAMLC=ocamlc $(COMPFLAGS) 3 | OCAMLOPT=ocamlopt $(COMPFLAGS) 4 | SRC=class.mli class.ml inher.mli inher.ml fooCl.mli fooCl.ml barCl.mli barCl.ml\ 5 | overr.mli overr.ml named.mli named.ml class_type.mli class_type.ml coerce.mli coerce.ml\ 6 | obj_inher.ml object.ml constraint.ml depend.ml fun_class.ml fun_obj_param.ml 7 | 8 | all: 9 | $(OCAMLC) -c $(SRC) 10 | 11 | clean: 12 | rm -f *~ *.cm* *.o *.obj 13 | -------------------------------------------------------------------------------- /examples/obj/barCl.ml: -------------------------------------------------------------------------------- 1 | open FooCl 2 | 3 | class c = object 4 | inherit p1 5 | inherit p2 6 | end 7 | 8 | let o = new c 9 | 10 | let f o = o#f () 11 | 12 | let () = o#g (); f o 13 | -------------------------------------------------------------------------------- /examples/obj/barCl.mli: -------------------------------------------------------------------------------- 1 | class c : object 2 | inherit FooCl.p1 3 | inherit FooCl.p2 4 | end 5 | -------------------------------------------------------------------------------- /examples/obj/class.ml: -------------------------------------------------------------------------------- 1 | class c = object 2 | method f () = () 3 | method g () = () 4 | method h () = () 5 | end 6 | 7 | let o = new c 8 | 9 | let f o = o#f () 10 | 11 | let () = o#g (); f o 12 | 13 | -------------------------------------------------------------------------------- /examples/obj/class.mli: -------------------------------------------------------------------------------- 1 | class c : object 2 | method f : unit-> unit 3 | method g : unit-> unit 4 | method h : unit-> unit 5 | end 6 | 7 | val o : c 8 | 9 | val f: unit> -> unit 10 | -------------------------------------------------------------------------------- /examples/obj/class_type.ml: -------------------------------------------------------------------------------- 1 | class type ct = object 2 | method f : unit -> unit 3 | method g : unit -> unit 4 | method h : unit -> unit 5 | end 6 | 7 | class p : ct = object(self) 8 | method f () = () 9 | method g () = self#f() 10 | method h () = self#g() 11 | end 12 | 13 | class c = object 14 | inherit p as super 15 | method h () = super#g (super#h()) 16 | end 17 | -------------------------------------------------------------------------------- /examples/obj/class_type.mli: -------------------------------------------------------------------------------- 1 | class type ct = object 2 | method f : unit -> unit 3 | method g : unit -> unit 4 | method h : unit -> unit 5 | end 6 | 7 | class p : ct 8 | 9 | class c : object 10 | inherit p 11 | method h : unit -> unit 12 | end 13 | -------------------------------------------------------------------------------- /examples/obj/coerce.ml: -------------------------------------------------------------------------------- 1 | class type ct = object 2 | method f : unit 3 | method h : unit -> unit 4 | end 5 | 6 | class p : ct = object 7 | method f = () 8 | method h () = () 9 | end 10 | 11 | 12 | class c = object 13 | inherit p 14 | method! f = () 15 | method h () = () 16 | end 17 | 18 | let f o = (o :> p)#h() 19 | 20 | let () = 21 | f (new c); 22 | let o = (new c :> p) in 23 | o#f 24 | -------------------------------------------------------------------------------- /examples/obj/coerce.mli: -------------------------------------------------------------------------------- 1 | class type ct = object 2 | method f : unit 3 | method h : unit -> unit 4 | end 5 | 6 | class p : ct 7 | 8 | class c : ct 9 | -------------------------------------------------------------------------------- /examples/obj/constraint.ml: -------------------------------------------------------------------------------- 1 | class p = object 2 | method f = () 3 | method g = () 4 | end 5 | 6 | class virtual c = object(this: 'this) 7 | constraint 'this = #p 8 | initializer this#f 9 | end 10 | 11 | class x = object 12 | inherit p 13 | inherit c 14 | end 15 | -------------------------------------------------------------------------------- /examples/obj/depend.ml: -------------------------------------------------------------------------------- 1 | module type T = sig 2 | class c : object 3 | method f : unit 4 | end 5 | end 6 | 7 | module M = struct 8 | class c = object 9 | method f = () 10 | end 11 | end 12 | 13 | include (M : T) 14 | 15 | class alias = c 16 | 17 | let () = (new alias) # f 18 | -------------------------------------------------------------------------------- /examples/obj/fooCl.ml: -------------------------------------------------------------------------------- 1 | class p1 = object 2 | method f () = () 3 | method g () = () 4 | method h () = () 5 | end 6 | 7 | class p2 = object 8 | method g () = () 9 | method h () = () 10 | end 11 | -------------------------------------------------------------------------------- /examples/obj/fooCl.mli: -------------------------------------------------------------------------------- 1 | class p1 : object 2 | method f : unit -> unit 3 | method g : unit -> unit 4 | method h : unit -> unit 5 | end 6 | 7 | class p2 : object 8 | method g : unit -> unit 9 | method h : unit -> unit 10 | end 11 | -------------------------------------------------------------------------------- /examples/obj/fun_class.ml: -------------------------------------------------------------------------------- 1 | class c () = object 2 | method m1 = () 3 | method m2 = () 4 | method m3 = () 5 | method m4 = () 6 | end 7 | 8 | let f o = o#m1 9 | 10 | let () = 11 | let obj = new c () in 12 | obj # m2; 13 | f obj; 14 | let o = (new c () :> ) in 15 | ignore (o) 16 | -------------------------------------------------------------------------------- /examples/obj/fun_obj_param.ml: -------------------------------------------------------------------------------- 1 | let f x = object 2 | method x = x 3 | method m = () 4 | method n = () 5 | end 6 | 7 | let app_m f = (f ()) # m 8 | 9 | let () = 10 | ignore (((fun () -> f 0) ()) # x); 11 | app_m (fun () -> f 0) 12 | -------------------------------------------------------------------------------- /examples/obj/inher.ml: -------------------------------------------------------------------------------- 1 | class p = object 2 | method f () = () 3 | method g () = () 4 | method h () = () 5 | end 6 | 7 | class c = object 8 | inherit p 9 | end 10 | 11 | let o = new c 12 | 13 | let f o = o#f () 14 | 15 | let () = o#g (); f o 16 | 17 | -------------------------------------------------------------------------------- /examples/obj/inher.mli: -------------------------------------------------------------------------------- 1 | class p : object 2 | method f : unit -> unit 3 | method g : unit -> unit 4 | method h : unit -> unit 5 | end 6 | 7 | class c : object 8 | inherit p 9 | end 10 | 11 | val o : c 12 | 13 | val f: unit> -> unit 14 | -------------------------------------------------------------------------------- /examples/obj/named.ml: -------------------------------------------------------------------------------- 1 | class p1 = object(p) 2 | method f () = () 3 | method g () = p#f () 4 | end 5 | 6 | class p2 = object 7 | method f () = () 8 | end 9 | 10 | class c = object(self) 11 | inherit p1 as super1 12 | inherit p2 as super2 13 | method f () = super1#f (super2#f ()) 14 | method g () = super1#g () 15 | end 16 | -------------------------------------------------------------------------------- /examples/obj/named.mli: -------------------------------------------------------------------------------- 1 | class p1 : object 2 | method f : unit -> unit 3 | method g : unit -> unit 4 | end 5 | 6 | class p2 : object 7 | method f : unit -> unit 8 | end 9 | 10 | class c : object 11 | inherit p1 12 | inherit p2 13 | method f : unit -> unit 14 | method g : unit -> unit 15 | end 16 | -------------------------------------------------------------------------------- /examples/obj/obj_inher.ml: -------------------------------------------------------------------------------- 1 | class c = object 2 | method f = () 3 | method g = () 4 | method h = () 5 | end 6 | 7 | let o : c = object 8 | inherit c 9 | method g = () 10 | end 11 | 12 | let o4 = object 13 | inherit c 14 | method g = () 15 | end 16 | 17 | let o2 = new c 18 | 19 | let o3 = object 20 | inherit c 21 | method k = () 22 | end 23 | 24 | let f () = object 25 | inherit c 26 | method g = () 27 | end 28 | 29 | let () = 30 | (f o4#g)#g; 31 | o3#f; 32 | o2#f; 33 | o#g 34 | -------------------------------------------------------------------------------- /examples/obj/object.ml: -------------------------------------------------------------------------------- 1 | let o = object 2 | method f () = () 3 | method g () = () 4 | method h () = () 5 | end 6 | 7 | let f o = o#f () 8 | 9 | let () = o#g (); f o 10 | -------------------------------------------------------------------------------- /examples/obj/overr.ml: -------------------------------------------------------------------------------- 1 | class p1 = object 2 | method f () = () 3 | method g () = () 4 | method h () = () 5 | end 6 | 7 | class p2 = object 8 | method g () = () 9 | method h () = () 10 | end 11 | 12 | class c = object 13 | method f () = () 14 | inherit p1 15 | inherit p2 16 | method g () = () 17 | end 18 | 19 | let o = new c 20 | 21 | let f o = o#f () 22 | 23 | let () = o#g (); f o 24 | -------------------------------------------------------------------------------- /examples/obj/overr.mli: -------------------------------------------------------------------------------- 1 | class p1 : object 2 | method f : unit -> unit 3 | method g : unit -> unit 4 | method h : unit -> unit 5 | end 6 | 7 | class p2 : object 8 | method g : unit -> unit 9 | method h : unit -> unit 10 | end 11 | 12 | class c : object 13 | method f : unit -> unit 14 | inherit p1 15 | inherit p2 16 | method g : unit -> unit 17 | end 18 | -------------------------------------------------------------------------------- /examples/opt-in-opt.ml: -------------------------------------------------------------------------------- 1 | let foo ?a ?b () = 2 | let bar ?(a = 0) ?(b = 0) () = a + b 3 | in bar () 4 | 5 | let baz ?(b = 0) ?(a = 0) () = if a <> 0 then foo ~a () else foo ~a ~b () 6 | 7 | let x = baz ~a:12 8 | -------------------------------------------------------------------------------- /examples/opt/Makefile: -------------------------------------------------------------------------------- 1 | COMPFLAGS=-w +A -I +compiler-libs -bin-annot -keep-locs 2 | OCAMLC=ocamlc $(COMPFLAGS) 3 | OCAMLOPT=ocamlopt $(COMPFLAGS) 4 | SRC= sig_struct.ml 5 | 6 | all: 7 | $(OCAMLC) -c $(SRC) 8 | 9 | clean: 10 | rm -f *~ *.cm* *.o *.obj 11 | -------------------------------------------------------------------------------- /examples/opt/sig_struct.ml: -------------------------------------------------------------------------------- 1 | include (struct 2 | let f ?(x = 0) ~y () = ignore (x+y) 3 | 4 | let () = f ~y:1 () 5 | end : sig 6 | val f : ?x:int -> y:int -> unit -> unit 7 | end) 8 | 9 | 10 | let () = 11 | let g = f ~y:1 in 12 | g ~x:1 (f ~y:0 ~x:0 ()) 13 | -------------------------------------------------------------------------------- /examples/partial_opt.ml: -------------------------------------------------------------------------------- 1 | let f ?a ?b c = c 2 | 3 | let () = (f ~a:0) ~b:0 0 |> ignore 4 | -------------------------------------------------------------------------------- /examples/qux.ml: -------------------------------------------------------------------------------- 1 | let z = Baz.t 2 | -------------------------------------------------------------------------------- /examples/record.ml: -------------------------------------------------------------------------------- 1 | type t0 = 2 | { 3 | unused: char; 4 | mutable f: (?a:int -> ?b:int -> unit -> unit); 5 | } 6 | 7 | module X=struct 8 | type t = 9 | { 10 | unused: char; 11 | used: char; 12 | mutable f: (?a:int -> ?b:int -> unit -> unit); 13 | } 14 | end 15 | 16 | let r:X.t = 17 | { 18 | unused = '_'; 19 | used = '_'; 20 | f = fun ?a ?b c -> c; 21 | } 22 | 23 | let () = r.f ~a:0 () 24 | 25 | type t2 = 26 | { 27 | r: X.t 28 | } 29 | 30 | let r = {r = r} 31 | 32 | let () = r.r.f ~a:0 () 33 | 34 | type u = X.t = 35 | { 36 | unused: char; 37 | used: char; 38 | mutable f: (?a:int -> ?b:int -> unit -> unit); 39 | } 40 | 41 | let r:u = 42 | { 43 | unused = '_'; 44 | used = '_'; 45 | f = fun ?a ?b c -> c; 46 | } 47 | 48 | let () = ignore r.used 49 | -------------------------------------------------------------------------------- /examples/record.mli: -------------------------------------------------------------------------------- 1 | type t0 = 2 | { 3 | unused: char; 4 | mutable f: (?a:int -> ?b:int -> unit -> unit); 5 | } 6 | 7 | module X:sig 8 | type t = 9 | { 10 | unused: char; 11 | used: char; 12 | mutable f: (?a:int -> ?b:int -> unit -> unit); 13 | } 14 | end 15 | 16 | type t2 = 17 | { 18 | r: X.t 19 | } 20 | 21 | type u = X.t = 22 | { 23 | unused: char; 24 | used: char; 25 | mutable f: (?a:int -> ?b:int -> unit -> unit); 26 | } 27 | -------------------------------------------------------------------------------- /examples/unused-fn.ml: -------------------------------------------------------------------------------- 1 | let f x = 32 + x 2 | 3 | let g x = f x - 32 4 | 5 | let var = f 1 6 | -------------------------------------------------------------------------------- /examples/useless-opt.ml: -------------------------------------------------------------------------------- 1 | let foo ?(a = []) () = None 2 | 3 | let x = foo ~a:[] () 4 | -------------------------------------------------------------------------------- /examples/variant.ml: -------------------------------------------------------------------------------- 1 | type v = Used | Unused 2 | 3 | type v2 = Int of int | Float of float | Nan | Nothing 4 | 5 | let i = Int 0 6 | 7 | let print_number = function 8 | | Int i -> print_int i 9 | | Float f -> print_float f 10 | | _ -> () 11 | 12 | let f: [`Value of int (* Should be detected ? *)| `Unit] -> v2 = function 13 | | `Value i -> Int i 14 | | `Unit -> Nan 15 | 16 | let () = 17 | let a = f `Unit in 18 | match Used with 19 | | Used -> if a = i then print_number a 20 | -------------------------------------------------------------------------------- /examples/variant.mli: -------------------------------------------------------------------------------- 1 | type v = Used | Unused 2 | 3 | type v2 = Int of int | Float of float | Nan | Nothing 4 | 5 | val f: [`Value of int (* Should be detected ? *)| `Unit] -> v2 6 | -------------------------------------------------------------------------------- /man/Makefile: -------------------------------------------------------------------------------- 1 | SRCS=../src/deadCode.mli 2 | LIBS=-I +compiler-libs 3 | DOCFLAGS=-man -man-mini 4 | 5 | all: 6 | ocamldoc $(LIBS) $(DOCFLAGS) $(SRCS) 7 | rm -rf man3/ 8 | mkdir man3 9 | mv *.3o man3/ 10 | mv man3/DeadCode.3o man3/dead_code_analyzer.3o 11 | 12 | clean: 13 | rm -rf man3 14 | -------------------------------------------------------------------------------- /opam: -------------------------------------------------------------------------------- 1 | opam-version: "1.2" 2 | name: "dead_code_analyzer" 3 | version: "0.9" 4 | maintainer: "Alain Frisch " 5 | authors: [ 6 | "Alain Frisch " 7 | "Corentin De Souza " 8 | ] 9 | homepage: "https://github.com/LexiFi/dead_code_analyzer" 10 | bug-reports: "https://github.com/LexiFi/dead_code_analyzer/issues" 11 | license: "MIT" 12 | dev-repo: "https://github.com/LexiFi/dead_code_analyzer.git" 13 | build: [make "all" "opt" "man"] 14 | build-test : [make "check"] 15 | available: [ocaml-version >= "4.05.0"] 16 | -------------------------------------------------------------------------------- /src/.merlin: -------------------------------------------------------------------------------- 1 | B +compiler-libs 2 | B ../build -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | include $(shell ocamlc -where)/Makefile.config 2 | 3 | SRCFST=deadCode.mli deadFlag.ml deadCommon.ml deadArg.mli deadType.mli deadObj.mli 4 | SRCSND=deadType.ml deadArg.ml deadMod.ml deadObj.ml deadCode.ml 5 | LIBS=ocamlcommon.cma 6 | 7 | COMPFLAGS=-w +A-4-9-40-42 -I +compiler-libs -bin-annot -keep-locs -g 8 | OCAMLC=ocamlc $(COMPFLAGS) 9 | OCAMLOPT=ocamlopt $(COMPFLAGS) 10 | 11 | all: dead_code_analyzer.byt$(EXE) 12 | 13 | opt: dead_code_analyzer.opt$(EXE) 14 | 15 | dead_code_analyzer.byt$(EXE): $(SRCFST) $(SRCSND) 16 | $(OCAMLC) -o $@ $(LIBS) $(SRCFST) $(SRCSND) 17 | cp -rf . ../build 18 | make clean 19 | 20 | dead_code_analyzer.opt$(EXE): $(SRCFST) $(SRCSND) 21 | $(OCAMLOPT) -o $@ $(LIBS:.cma=.cmxa) $(SRCFST) $(SRCSND) 22 | cp -rf . ../build 23 | make clean 24 | 25 | lexifi: $(SRCFST) deadLexiFi.ml $(SRCSND) 26 | $(OCAMLC) -o dead_code_analyzer.byt$(EXE) $(LIBS) $(SRCFST) deadLexiFi.ml $(SRCSND) 27 | cp -rf . ../build 28 | make clean 29 | 30 | lexifi-opt:$(SRCFST) deadLexiFi.ml $(SRCSND) 31 | $(OCAMLOPT) -o dead_code_analyzer.opt$(EXE) $(LIBS:.cma=.cmxa) $(SRCFST) deadLexiFi.ml $(SRCSND) 32 | cp -rf . ../build 33 | make clean 34 | 35 | debug: $(SRCFST) $(SRCSND) 36 | $(OCAMLC) -g -o dead_code_analyzer.byt$(EXE) $(LIBS) $(SRCFST) $(SRCSND) 37 | cp -rf . ../build 38 | make clean 39 | 40 | prof: $(SRCFST) $(SRCSND) 41 | ocamlcp -P a $(COMPFLAGS) -o dead_code_analyzer.byt$(EXE) $(LIBS) $(SRCFST) $(SRCSND) 42 | cp -rf . ../build 43 | make clean 44 | 45 | prof-opt: $(SRCFST) $(SRCSND) 46 | ocamloptp -P a -p $(COMPFLAGS) -o dead_code_analyzer.opt$(EXE) $(LIBS:.cma=.cmxa) $(SRCFST) $(SRCSND) 47 | cp -rf . ../build 48 | make clean 49 | 50 | clean: 51 | rm -f *~ *.cm* *.a *.lib *.o *.obj dead_code_analyzer.byt$(EXE) dead_code_analyzer.opt$(EXE) 52 | -------------------------------------------------------------------------------- /src/deadArg.ml: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | open Types 11 | open Typedtree 12 | 13 | open DeadCommon 14 | 15 | 16 | let later = ref [] 17 | let last = ref [] 18 | 19 | let met = Hashtbl.create 512 20 | 21 | 22 | let eom () = 23 | List.iter (fun f -> f ()) !later; 24 | later := []; 25 | Hashtbl.reset met 26 | 27 | 28 | let add lab expr loc last_loc nb_occur = 29 | let has_val = match expr.exp_desc with 30 | | Texp_construct (_, {cstr_name = "None"; _}, _) -> false 31 | | _ -> true 32 | in 33 | let occur = 34 | let occur = 35 | if not (Hashtbl.mem nb_occur lab) then Hashtbl.add nb_occur lab 1 36 | else Hashtbl.find nb_occur lab + 1 |> Hashtbl.replace nb_occur lab; 37 | Hashtbl.find nb_occur lab 38 | in ref occur 39 | in 40 | let call_site = 41 | if expr.exp_loc.Location.loc_ghost then last_loc 42 | else expr.exp_loc.Location.loc_start 43 | in 44 | if check_underscore lab then 45 | let loc = VdNode.find loc lab occur in 46 | if not (Hashtbl.mem met (last_loc, loc, lab)) then begin 47 | Hashtbl.add met (last_loc, loc, lab) (); 48 | opt_args := (loc, lab, has_val, call_site) :: !opt_args 49 | end 50 | 51 | 52 | let rec process loc args = 53 | 54 | List.iter (* treat each arg's expression before all (even if ghost) *) 55 | (function 56 | | (_, Some e) -> check e 57 | | _ -> ()) 58 | args; 59 | 60 | if is_ghost loc then () (* Ghostbuster *) 61 | else begin (* else: `begin ... end' for aesthetics *) 62 | let nb_occur = Hashtbl.create 256 in 63 | let last_loc = !last_loc in 64 | (* last_loc fixed to avoid side effects if added to later/last *) 65 | let add lab expr = add lab expr loc last_loc nb_occur in 66 | let add = function 67 | | (Asttypes.Optional lab, Some expr) -> 68 | if VdNode.is_end loc 69 | && (let fn = loc.Lexing.pos_fname in fn.[String.length fn - 1] = 'i') then 70 | last := (fun () -> add lab expr) :: !last 71 | else if VdNode.is_end loc && !depth > 0 then 72 | later := (fun () -> add lab expr) :: !later 73 | else 74 | add lab expr 75 | | _ -> () 76 | in 77 | List.iter add args 78 | end 79 | 80 | 81 | (* Verify the nature of the argument to detect and treat function applications and uses *) 82 | and check e = 83 | (* Optional arguments used to match a signature are considered used *) 84 | let get_sig_args typ = 85 | let rec loop args typ = 86 | match typ.desc with 87 | | Tarrow (Asttypes.Optional _ as arg, _, t, _) -> 88 | loop ((arg, Some {e with exp_desc = Texp_constant (Asttypes.Const_int 0)})::args) t 89 | | Tarrow (_, _, t, _) 90 | | Tlink t -> loop args t 91 | | _ -> args 92 | in loop [] typ 93 | in 94 | 95 | match e.exp_desc with 96 | | Texp_ident (_, _, {val_loc = {Location.loc_start=loc; _}; _}) -> 97 | process loc (get_sig_args e.exp_type) 98 | | Texp_apply (exp, _) -> 99 | begin match exp.exp_desc with 100 | | Texp_ident (_, _, {val_loc = {Location.loc_start = loc; loc_ghost}; _}) 101 | | Texp_field (_, _, {lbl_loc = {Location.loc_start = loc; loc_ghost}; _}) -> 102 | process loc (get_sig_args e.exp_type); 103 | if not loc_ghost then 104 | last_loc := loc 105 | | _ -> () 106 | end 107 | | Texp_let (* Partial application as argument may cut in two parts: 108 | * let _ = partial in implicit opt_args elimination *) 109 | ( _, 110 | [{vb_expr = 111 | { exp_desc = Texp_apply ( 112 | {exp_desc = Texp_ident (_, _, {val_loc = {Location.loc_start = loc; _}; _}); _}, 113 | _) | Texp_ident(_, _, {val_loc = {Location.loc_start = loc; _}; _}); 114 | _}; 115 | _}], 116 | { exp_desc = Texp_function { cases = 117 | [{c_lhs = {pat_desc = Tpat_var (_, _); pat_loc = {loc_ghost = true; _}; _}; 118 | c_rhs = {exp_desc = Texp_apply (_, args); exp_loc = {loc_ghost = true; _}; _}; _}]; 119 | _ }; 120 | exp_loc = {loc_ghost = true; _};_}) -> 121 | process loc args 122 | | _ -> () 123 | 124 | 125 | let node_build loc expr = 126 | let rec loop loc expr = 127 | match expr.exp_desc with 128 | | Texp_function { arg_label = lab; 129 | cases = [{c_lhs = {pat_type; _}; c_rhs = exp; _}]; _ } -> 130 | DeadType.check_style pat_type expr.exp_loc.Location.loc_start; 131 | begin match lab with 132 | | Asttypes.Optional s -> 133 | if !DeadFlag.optn.print || !DeadFlag.opta.print then 134 | let opts, next = VdNode.get loc in 135 | VdNode.update loc (s :: opts, next); 136 | loop loc exp 137 | | _ -> () end 138 | | Texp_apply (exp, _) -> 139 | begin match exp.exp_desc with 140 | | Texp_ident (_, _, {val_loc = {Location.loc_start = loc2; _}; _}) 141 | | Texp_field (_, _, {lbl_loc = {Location.loc_start = loc2; _}; _}) 142 | when (!DeadFlag.optn.print || !DeadFlag.opta.print) 143 | && DeadType.nb_args ~keep:`Opt expr.exp_type > 0 -> 144 | VdNode.merge_locs loc loc2 145 | | _ -> () 146 | end 147 | | Texp_ident (_, _, {val_loc = {Location.loc_start = loc2; _}; _}) 148 | when !DeadFlag.optn.print || !DeadFlag.opta.print 149 | && DeadType.nb_args ~keep:`Opt expr.exp_type > 0 -> 150 | VdNode.merge_locs loc loc2 151 | | _ -> () 152 | in loop loc expr 153 | 154 | 155 | 156 | (******** WRAPPING ********) 157 | 158 | 159 | let wrap f x y = 160 | if DeadFlag.(!optn.print || !opta.print) then f x y else () 161 | 162 | let process val_loc args = 163 | wrap process val_loc args 164 | -------------------------------------------------------------------------------- /src/deadArg.mli: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | 11 | open Typedtree 12 | 13 | 14 | 15 | (* Functions needing a location in the current file to be processed 16 | * before being executed. 17 | * It is known that this location will have been processed at the end of 18 | * the binding. 19 | * Needed because the Tast_mapper run through sequences from the end 20 | * because tuples are built from right to left*) 21 | val later : (unit -> unit) list ref 22 | 23 | (* Functions needing a location out of the current file to be processed 24 | * before being executed. *) 25 | val last : (unit -> unit) list ref 26 | 27 | 28 | (* Self cleaning *) 29 | val eom : 30 | unit -> unit 31 | 32 | 33 | (* Add all optional arguments met if they are used to match a signature or the location 34 | * is not a ghost and they are part of the application (w/ or w/o value) *) 35 | val process : 36 | Lexing.position 37 | -> (Asttypes.arg_label * expression option) list 38 | -> unit 39 | 40 | 41 | (* Constructs the opt_args field of the given node *) 42 | val node_build : 43 | Lexing.position -> Typedtree.expression -> unit 44 | -------------------------------------------------------------------------------- /src/deadCode.mli: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | (** dead_code_analyzer -- Dead code analyzing tool. It only reports unused exported values, 11 | constructors/record fields and methods by default. 12 | Options can enable reporting of optional arguments always/never used as bad style of code. 13 | In addition to selecting which reports are to be displayed, the limit of authorized 14 | occurences needed to be reported can be selected (default is 0). 15 | 16 | It assumes .mli/.mfi are compiled with {e -keep-locs} and .ml/.mf are compiled with {e -bin-annot}. 17 | 18 | 19 | {2 Unused Exported Values} 20 | 21 | This section reports the following when exported: 22 | 23 | - Values never accessed. 24 | e.g. {[ 25 | let x = 0 26 | let () = () 27 | ]} 28 | Here, [x] will be reported. 29 | 30 | As this section focuses on exported values, internal calls are ignored by default. 31 | This will lead the analyzer to focus on values that are uselessly exported. 32 | To keep track of all uses, call the {e internal} option. 33 | 34 | Calling the dead code analyzer with {e -E threshold:1} on 35 | {[ 36 | let x = 0 37 | let () = ignore x 38 | ]} 39 | will lead to reporting [x] in the almost unused subsection because its number of uses <= threshold (1). 40 | 41 | 42 | {2 Unused Constructors/Record Fields} 43 | 44 | - Record fields not read. 45 | e.g. {[ 46 | type t = {foo: int; bar: bool} 47 | let r = {foo = 0; bar = false} 48 | let x = {r with bar = true} 49 | let () = ignore x.foo 50 | ]} 51 | Here, [t.bar] will be reported. 52 | 53 | - Constructors never constructed. 54 | e.g. {[ 55 | type t = Foo | Bar 56 | let x = Foo 57 | let () = match x with 58 | | Bar -> () 59 | | _ -> () 60 | ]} 61 | Here, [t.Bar] will be reported. 62 | 63 | Types are studied as a whole and iff they are explicitly declared as their own types. 64 | Consequently, signatures as [val f: [`A | `B] -> unit] cannot lead to reporting [`A] or [`B]. 65 | 66 | 67 | {2 Unused Methods} 68 | 69 | - Public methods never called. 70 | e.g. {[ 71 | class p = object 72 | method f = () 73 | end 74 | class c = object 75 | inherit p 76 | method g = () 77 | end 78 | let () = c#f 79 | ]} 80 | Here, [c#g] will be reported. 81 | 82 | It has to be noted that calling [c#f] is in fact the same as calling [p#f]. 83 | The owner is considered to be the one who defines the function. 84 | 85 | 86 | {2 Optional Arguments} 87 | 88 | Optional arguments always used (with a value <> [None]) 89 | and never used (or only with [None]) are reported. 90 | 91 | This reporting is done regardless of whether the function an optional argument is 92 | attached to is exported. 93 | 94 | e.g. {[ 95 | let f ?a ?b () = () 96 | let () = f ~a:0 () 97 | ]} 98 | Here [?a] is reported as always used and [?b] never. 99 | 100 | Calling the dead code analyzer with {e -Oa percent:0.6} on 101 | {[ 102 | let f ?a ?b () = () 103 | let () = 104 | f ~a:0 () 105 | |> f ~a:0 ~b:0 106 | |> f ~a:0 ~b:0 107 | ]} 108 | will lead to reporting both [?a] in the always used section 109 | and [?b] in the almost always used subsection. 110 | 111 | Calling the dead code analyzer with 112 | {e -Oa both:1,0.6} on 113 | {[ 114 | let f ?a ?b () = () 115 | let () = 116 | f ~a:0 () 117 | |> f ~a:0 ~b:0 118 | |> f ~a:0 ~b:0 119 | ]} 120 | will lead to reporting [?a] but not [?b] because number of time it is used is > 1 121 | and the percentage of time it is unused is < 60%. 122 | 123 | 124 | {2 Coding Style} 125 | 126 | This section focuses on: 127 | - use of unit patterns as in [let f : unit -> unit = fun x -> ()]. 128 | In this example x is reported as a unit pattern. 129 | Any value of type [unit] different from [()] 130 | like [let _ = ()] or [x] in the previous example is reported as a unit pattern. 131 | 132 | - unit bindings where sequencing should be used: [let () = ... in ...] 133 | 134 | - useless bindings of the form [let x = ... in x] 135 | 136 | - arguments expecting optional argument i.e. [val f: ... -> (... -> ?_:_ -> ...) -> ...] 137 | 138 | 139 | {2 Usage} 140 | {e ./dead_code_analyzer. } 141 | 142 | For more informations use the {e --help} option 143 | 144 | 145 | {2 Options} 146 | 147 | {b --exclude} Exclude given path from research. 148 | 149 | {b --references} Consider given path to collect references. 150 | 151 | {b --underscore} Show names starting with an underscore 152 | 153 | {b --verbose} Verbose mode (ie., show scanned files) 154 | 155 | {b -v} See {b --verbose} 156 | 157 | {b --internal} Keep internal uses as exported values uses when the interface is given. This is the default behaviour when only the implementation is found 158 | 159 | {b --nothing} Disable all warnings 160 | 161 | {b -a} See {b --nothing} 162 | 163 | {b --all} Enable all warnings 164 | 165 | {b -A} See {b --all} 166 | 167 | {b -E} Enable/Disable unused exported values warnings. 168 | can be: 169 | - all 170 | - nothing 171 | - 172 | - "calls:" like + show call sites 173 | 174 | {b -M} Enable/Disable unused methods warnings. 175 | See option {b -E} for the syntax of 176 | 177 | {b -Oa} Enable/Disable optional arguments always used warnings. 178 | 179 | can be: 180 | - "both:,": both the number max of exceptions (given through the integer) and the percent of valid cases (given as a float) must be respected for the element to be reported 181 | - "percent:": percent of valid cases to be reported 182 | 183 | {b -On} Enable/Disable optional arguments never used warnings. 184 | See option {b -Oa} for the syntax of 185 | 186 | {b -S} Enable/Disable coding style warnings. 187 | - Delimiters '+' and '-' determine if the following option is to enable or disable. 188 | - Options (can be used together): 189 | - bind: useless binding 190 | - opt: optional arg in arg 191 | - seq: use sequence 192 | - unit: unit pattern 193 | - all: bind & opt & seq & unit 194 | 195 | {b -T} Enable/Disable unused constructors/records fields warnings. 196 | See option {b -E} for the syntax of 197 | 198 | {b -help} Display this list of options 199 | 200 | {b --help} Display this list of options 201 | 202 | *) 203 | -------------------------------------------------------------------------------- /src/deadFlag.ml: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | type threshold = {exceptions: int; percentage: float; optional: [`Percent | `Both]} 11 | 12 | 13 | type opt = {print: bool; call_sites: bool; threshold: threshold} 14 | let opta = ref 15 | { 16 | print = false; 17 | call_sites = false; 18 | threshold = 19 | { 20 | exceptions = 0; 21 | percentage = 1.; 22 | optional = `Percent 23 | }; 24 | } 25 | let optn = ref 26 | { 27 | print = false; 28 | call_sites = false; 29 | threshold = 30 | { 31 | exceptions = 0; 32 | percentage = 1.; 33 | optional = `Percent 34 | }; 35 | } 36 | 37 | 38 | let update_opt opt s = 39 | let threshold s = 40 | let len = String.length s in 41 | if len > 5 && String.sub s 0 5 = "both:" then begin 42 | let limits = String.sub s 5 (String.length s - 5) in 43 | let thr = 44 | let rec loop s pos len = 45 | if len = String.length s then s 46 | else if s.[pos] = ',' then String.sub s (pos - len) len 47 | else loop s (pos + 1) (len + 1) 48 | in loop limits 0 0 49 | in 50 | let pos = String.length thr + 1 in 51 | let pct = String.sub limits pos (String.length limits - pos) in 52 | opt := {!opt with threshold={!opt.threshold with optional = `Both}}; 53 | let thr = String.trim thr in 54 | let pct = String.trim pct in 55 | try 56 | opt := {!opt with threshold = {!opt.threshold with exceptions = int_of_string thr}}; 57 | opt := {!opt with threshold = {!opt.threshold with percentage = float_of_string pct}} 58 | with Failure _ -> raise (Arg.Bad ("-Ox: wrong arguments: " ^ limits)) 59 | end 60 | else if len > 8 && String.sub s 0 8 = "percent:" then 61 | let pct = String.sub s 8 (String.length s - 8) |> String.trim in 62 | try opt := {!opt with threshold={!opt.threshold with percentage = float_of_string pct}} 63 | with Failure _ -> raise (Arg.Bad ("-Ox: wrong argument: " ^ pct)) 64 | else raise (Arg.Bad ("-Ox: unknown option " ^ s)) 65 | in 66 | match s with 67 | | "all" -> opt := {!opt with print = true} 68 | | "nothing" -> opt := {!opt with print = false} 69 | | s -> 70 | opt := {!opt with print = true}; 71 | let s = 72 | if String.length s > 6 && String.sub s 0 6 = "calls:" then begin 73 | opt := {!opt with call_sites = true}; 74 | String.sub s 6 (String.length s - 6) 75 | end 76 | else s 77 | in 78 | threshold s; 79 | if !opt.threshold.exceptions < 0 then 80 | raise (Arg.Bad ("-Ox: number of exceptions must be >= 0")) 81 | else if !opt.threshold.percentage > 1. || !opt.threshold.percentage < 0. then 82 | raise (Arg.Bad ("-Ox: percentage must be >= 0.0 and <= 1.0")) 83 | 84 | 85 | type style = {opt_arg: bool; unit_pat: bool; seq: bool; binding: bool} 86 | let style = ref 87 | { 88 | opt_arg = false; 89 | unit_pat = false; 90 | seq = false; 91 | binding = false; 92 | } 93 | 94 | let update_style s = 95 | let rec aux = function 96 | | (b, "opt")::l -> style := {!style with opt_arg = b}; 97 | aux l 98 | | (b, "unit")::l -> style := {!style with unit_pat = b}; 99 | aux l 100 | | (b, "seq")::l -> style := {!style with seq = b}; 101 | aux l 102 | | (b, "bind")::l -> style := {!style with binding = b}; 103 | aux l 104 | | (b, "all")::l -> style := {unit_pat = b; opt_arg = b; seq = b; binding = b}; 105 | aux l 106 | | (_, "")::l -> aux l 107 | | (_, s)::_ -> raise (Arg.Bad ("-S: unknown option: " ^ s)) 108 | | [] -> () 109 | in 110 | let list_of_opt str = 111 | try 112 | let rec split acc pos len = 113 | if str.[pos] <> '+' && str.[pos] <> '-' then 114 | split acc (pos - 1) (len + 1) 115 | else let acc = (str.[pos] = '+', String.trim (String.sub str (pos + 1) len)) :: acc in 116 | if pos > 0 then split acc (pos - 1) 0 117 | else acc 118 | in split [] (String.length str - 1) 0 119 | with _ -> raise (Arg.Bad ("options' arguments must start with a delimiter (`+' or `-')")) 120 | in 121 | aux (list_of_opt s) 122 | 123 | 124 | type basic = {print: bool; call_sites: bool; threshold: int} 125 | let exported : basic ref = ref 126 | ({ 127 | print = true; 128 | call_sites = false; 129 | threshold = 0 130 | } : basic) 131 | 132 | 133 | let obj = ref 134 | ({ 135 | print = true; 136 | call_sites = false; 137 | threshold = 0; 138 | } : basic) 139 | 140 | 141 | let typ : basic ref = ref 142 | ({ 143 | print = true; 144 | call_sites = false; 145 | threshold = 0 146 | } : basic) 147 | 148 | 149 | let update_basic opt (flag : basic ref) = function 150 | | "all" -> flag := {!flag with print = true} 151 | | "nothing" -> flag := {!flag with print = false} 152 | | s -> 153 | flag := {!flag with print = true}; 154 | let threshold = 155 | let len = String.length s in 156 | if len > 6 && String.sub s 0 6 = "calls:" then begin 157 | flag := {!flag with call_sites = true}; 158 | String.sub s 6 (String.length s - 6) 159 | end 160 | else if len > 10 && String.sub s 0 10 = "threshold:" then 161 | String.sub s 10 (String.length s - 10) 162 | else raise (Arg.Bad (opt ^ ": unknown option: " ^ s)) 163 | in 164 | let threshold = String.trim threshold |> int_of_string in 165 | if threshold < 0 then 166 | raise (Arg.Bad (opt ^ ": integer should be >= 0; Got " ^ string_of_int threshold)) 167 | else flag := {!flag with threshold} 168 | 169 | 170 | let verbose = ref false 171 | let set_verbose () = verbose := true 172 | 173 | (* Print name starting with '_' *) 174 | let underscore = ref true 175 | let set_underscore () = underscore := false 176 | 177 | let internal = ref false 178 | let set_internal () = internal := true 179 | 180 | 181 | let normalize_path s = 182 | let rec split_path s = 183 | let open Filename in 184 | if s = current_dir_name || s = dirname s then [s] 185 | else (basename s) :: (split_path (dirname s)) 186 | in 187 | let rec norm_path = function 188 | | [] -> [] 189 | | x :: ((y :: _) as yss) when x = y && x = Filename.current_dir_name -> norm_path yss 190 | | x :: xss -> 191 | if x = Filename.current_dir_name then norm_path xss (* strip leading ./ *) 192 | else 193 | let yss = List.filter (fun x -> x <> Filename.current_dir_name) xss in 194 | x :: yss 195 | in 196 | let rec concat_path = function 197 | | [] -> "" 198 | | x :: xs -> Filename.concat x (concat_path xs) 199 | in 200 | concat_path (norm_path (List.rev (split_path s))) 201 | 202 | let exclude, is_excluded = 203 | let tbl = Hashtbl.create 10 in 204 | let exclude s = Hashtbl.replace tbl (normalize_path s) () in 205 | let is_excluded s = Hashtbl.mem tbl (normalize_path s) in 206 | exclude, is_excluded 207 | 208 | 209 | let directories : string list ref = ref [] 210 | -------------------------------------------------------------------------------- /src/deadLexiFi.ml: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | (** Extensions internally used at LexiFi. *) 11 | 12 | 13 | (* .^. - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - .^. *) 14 | (* / ! \ DO NOT DELETE UNLESS YOU CAN COMPILE WITH `make lexifi' AND YOU KNOW WHAT YOU ARE DOING / ! \ *) 15 | (* /_____\ /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ - /!\ /_____\ *) 16 | 17 | 18 | open Parsetree 19 | open Types 20 | open Typedtree 21 | 22 | open DeadCommon 23 | 24 | 25 | (******** ATTRIBUTES ********) 26 | 27 | let dyn_rec = ref [] (* Record names used for dynamic typing and locations of those uses *) 28 | let str = Hashtbl.create 256 29 | let used = ref [] 30 | 31 | let field_link = Hashtbl.create 256 32 | let dyn_used = Hashtbl.create 256 33 | 34 | 35 | 36 | let () = 37 | 38 | DeadLexiFi.sig_value := 39 | (fun value -> 40 | let add strct = match strct.pstr_desc with 41 | | Pstr_eval ({pexp_desc=Pexp_constant (PConst_string (s, _)); _}, _) -> 42 | hashtbl_add_unique_to_list str s value.val_loc.Location.loc_start 43 | | _ -> () 44 | in 45 | let add = function 46 | | ({Asttypes.txt="mlfi.value_approx"; _}, PStr structure) -> 47 | List.iter add structure 48 | | _ -> () 49 | in 50 | List.iter add value.val_attributes 51 | ); 52 | 53 | 54 | DeadLexiFi.type_ext := 55 | (fun ct -> 56 | match ct.ctyp_desc with 57 | | Ttyp_props (props, _) -> 58 | List.iter 59 | (fun (_, strin) -> 60 | used := (strin, ct.ctyp_loc.Location.loc_start) :: !used; 61 | ) 62 | props 63 | | _ -> () 64 | ); 65 | 66 | DeadLexiFi.type_decl := 67 | (fun td -> 68 | List.iter 69 | (fun (_, strin) -> 70 | used := (strin, td.typ_loc.Location.loc_start) :: !used; 71 | ) 72 | (Ast_helper.get_str_props td.typ_type.type_attributes) 73 | ); 74 | 75 | 76 | DeadLexiFi.tstr_type := 77 | (fun typ ctype -> 78 | let path = 79 | String.concat "." @@ List.rev @@ 80 | typ.typ_name.Asttypes.txt :: !mods 81 | @ (String.capitalize_ascii (unit !current_src):: []) 82 | in 83 | let is_user_defined s = 84 | let l = [_variant; "bool"; "float"; "int"; "string"; "unit"] in 85 | let mod_name = 86 | let rec loop s pos len = 87 | if len = String.length s then s 88 | else if s.[pos] = '.' then String.sub s (pos - len) len 89 | else loop s (pos + 1) (len + 1) 90 | in loop s 0 0 91 | in 92 | not (String.contains s ' ') 93 | && (s <> String.capitalize_ascii s && not (List.mem s l) 94 | || String.contains s '.' && mod_name <> "Pervasives") 95 | in 96 | if is_user_defined ctype then 97 | hashtbl_add_to_list field_link path ctype 98 | ); 99 | 100 | 101 | DeadLexiFi.ttype_of := 102 | (fun e -> 103 | let name = String.concat "." @@ List.rev @@ 104 | !mods @ (String.capitalize_ascii (unit !current_src):: []) 105 | in 106 | let call_site = 107 | if e.exp_loc.Location.loc_ghost then !last_loc 108 | else e.exp_loc.Location.loc_start 109 | in 110 | dyn_rec := (name, e.exp_type, call_site) :: !dyn_rec 111 | ); 112 | 113 | 114 | DeadLexiFi.prepare_report := 115 | (fun decs -> 116 | List.iter 117 | (fun (strin, pos) -> 118 | hashtbl_find_list str strin 119 | |> List.iter 120 | (fun loc -> 121 | if exported DeadFlag.exported loc then 122 | LocHash.add_set references loc pos 123 | ) 124 | ) 125 | !used; 126 | let rec process (p, typ, call_site) = 127 | match typ.desc with 128 | | Tarrow (_, t, _, _) | Tlink t -> process (p, t, call_site) 129 | | Ttuple ts -> List.iter (fun t -> process (p, t, call_site)) ts 130 | | Tconstr (path, ts, _) -> 131 | let name = Path.name path in 132 | let name = 133 | if String.contains name '.' then name 134 | else p ^ "." ^ name 135 | in 136 | let met = ref [] in 137 | let rec proc name = 138 | if not (List.mem name !met) then begin 139 | met := name :: !met; 140 | name :: List.fold_left (fun acc name -> acc @ (proc name)) [] (hashtbl_find_list field_link name) 141 | end 142 | else [] 143 | in 144 | List.iter 145 | (fun typ -> 146 | hashtbl_add_to_list dyn_used typ call_site 147 | ) 148 | (proc name); 149 | List.iter (fun t -> process (p, t, call_site)) ts 150 | | _ -> () 151 | in 152 | List.iter process !dyn_rec; 153 | Hashtbl.iter 154 | (fun loc (_, path) -> 155 | let rec get_type s pos = 156 | if pos = 0 then s 157 | else if s.[pos] = '.' then String.sub s 0 pos 158 | else get_type s (pos - 1) 159 | in 160 | List.iter 161 | ( if exported DeadFlag.typ loc then LocHash.add_set references loc 162 | else ignore 163 | ) 164 | (hashtbl_find_list dyn_used (get_type path (String.length path - 1))) 165 | ) 166 | decs 167 | ); 168 | -------------------------------------------------------------------------------- /src/deadMod.ml: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | open Ident 11 | open Types 12 | open Typedtree 13 | 14 | open DeadCommon 15 | 16 | 17 | 18 | let defined : string list ref = ref [] 19 | 20 | 21 | let rec sign ?(isfunc = false) = function 22 | | Mty_signature sg -> sg 23 | | Mty_functor (_, t, _) when isfunc -> begin match t with 24 | | None -> [] 25 | | Some t -> sign t end 26 | | Mty_functor (_, _, t) -> sign t 27 | | _ -> [] 28 | 29 | 30 | let item maker = function 31 | | Sig_value ({name; _}, {val_loc = {Location.loc_start= loc; _}; _}) -> 32 | (name, loc)::[] 33 | | Sig_type ({name=t; _}, {type_kind; _}, _) -> begin match type_kind with 34 | | Type_record (l, _) -> 35 | List.map 36 | (fun {Types.ld_id={name; _}; ld_loc = {Location.loc_start = loc; _}; _} -> 37 | (t ^ "." ^ name, loc) 38 | ) 39 | l 40 | | Type_variant l -> 41 | List.map 42 | (fun {Types.cd_id={name; _}; cd_loc = {Location.loc_start = loc; _}; _} -> 43 | (t ^ "." ^ name, loc) 44 | ) 45 | l 46 | | _ -> [] end 47 | | Sig_module ({name; _}, {md_type; _}, _) 48 | | Sig_modtype ({name; _}, {mtd_type = Some md_type; _}) -> 49 | List.map (fun (n, l) -> (name ^ "." ^ n, l)) (maker md_type) 50 | | Sig_class ({name; _}, {cty_loc = {Location.loc_start = loc; _}; _}, _) -> 51 | (name ^ "#", loc) :: [] 52 | | _ -> [] 53 | 54 | let rec make_content typ = 55 | List.map (item make_content) (sign typ) 56 | |> List.flatten 57 | 58 | 59 | let rec make_arg typ = 60 | List.map (item make_arg) (sign ~isfunc:true typ) 61 | |> List.flatten 62 | 63 | 64 | let expr m = match m.mod_desc with 65 | | Tmod_apply (m1, m2, _) -> 66 | let l1 = make_arg m1.mod_type |> List.map (fun (x, _) -> x) in 67 | let l2 = make_content m2.mod_type in 68 | List.iter 69 | (fun (x, loc) -> 70 | let is_obj = String.contains x '#' in 71 | let is_type = not is_obj && DeadType.is_type x in 72 | if (List.mem x l1 || l1 = []) 73 | && (is_obj && !DeadFlag.obj.DeadFlag.print 74 | || not is_obj && is_type && exported DeadFlag.typ loc 75 | || not is_obj && not is_type && exported DeadFlag.exported loc) then 76 | LocHash.add_set references loc m.mod_loc.Location.loc_start 77 | ) 78 | l2 79 | | _ -> () 80 | 81 | 82 | (******** WRAPPING ********) 83 | 84 | let expr m = 85 | if [@warning "-44"] 86 | DeadFlag.(!exported.print || !typ.print || !obj.print) then 87 | expr m 88 | else () 89 | -------------------------------------------------------------------------------- /src/deadObj.mli: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | 11 | open Typedtree 12 | 13 | 14 | 15 | val last_class : Lexing.position ref 16 | 17 | 18 | val collect_export : 19 | Ident.t list 20 | -> string 21 | -> (Lexing.position, string * string) Hashtbl.t 22 | -> ?obj: Types.type_expr 23 | -> ?cltyp: Types.class_type 24 | -> Location.t 25 | -> unit 26 | 27 | 28 | val collect_references : 29 | meth: string 30 | -> call_site: Lexing.position 31 | -> expression 32 | -> unit 33 | 34 | 35 | val tstr : 36 | class_declaration * string list -> unit 37 | 38 | 39 | val add_var : 40 | Lexing.position -> expression -> unit 41 | 42 | 43 | val class_structure: 44 | class_structure -> unit 45 | 46 | 47 | val class_field : 48 | class_field -> unit 49 | 50 | 51 | val arg : 52 | Types.type_expr -> (Asttypes.arg_label * expression option) list -> unit 53 | 54 | 55 | val coerce: 56 | expression -> Types.type_expr -> unit 57 | 58 | 59 | val eom : 60 | unit -> unit 61 | 62 | 63 | val report : 64 | unit -> unit 65 | -------------------------------------------------------------------------------- /src/deadType.ml: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | open Asttypes 11 | open Types 12 | open Typedtree 13 | 14 | open DeadCommon 15 | 16 | 17 | 18 | (******** ATTRIBUTES ********) 19 | 20 | let decs = Hashtbl.create 256 21 | 22 | let dependencies = ref [] (* like the cmt value_dependencies but for types *) 23 | 24 | 25 | 26 | (******** HELPERS ********) 27 | 28 | let is_unit t = match (Ctype.repr t).desc with 29 | | Tconstr (p, [], _) -> Path.same p Predef.path_unit 30 | | _ -> false 31 | 32 | 33 | let nb_args ~keep typ = 34 | let rec loop n = function 35 | | Tarrow (_, _, typ, _) when keep = `All -> loop (n + 1) typ.desc 36 | | Tarrow (Labelled _, _, typ, _) when keep = `Lbl -> loop (n + 1) typ.desc 37 | | Tarrow (Optional _, _, typ, _) when keep = `Opt -> loop (n + 1) typ.desc 38 | | Tarrow (Nolabel, _, typ, _) when keep = `Reg -> loop (n + 1) typ.desc 39 | | Tarrow (_, _, typ, _) -> loop n typ.desc 40 | | _ -> n 41 | in 42 | loop 0 typ.desc 43 | 44 | 45 | let rec _TO_STRING_ typ = begin [@warning "-11"] match typ.desc with 46 | | Tvar i -> begin match i with Some id -> id | None -> "'a" end 47 | | Tarrow (_, t1, t2, _) -> 48 | begin match t1.desc with 49 | | Tarrow _ -> "(" ^ _TO_STRING_ t1 ^ ")" 50 | | _ -> _TO_STRING_ t1 end 51 | ^ " -> " ^ _TO_STRING_ t2 52 | | Ttuple l -> begin match l with 53 | | e::l -> 54 | List.fold_left (fun prev typ -> prev ^ " * " ^ _TO_STRING_ typ) (_TO_STRING_ e) l 55 | | [] -> "*" end 56 | | Tconstr (path, l, _) -> make_name path l 57 | | Tobject (self, _) -> "< " ^ _TO_STRING_ self ^ " >" 58 | | Tfield (s, k, _, t1) -> 59 | if Btype.field_kind_repr k = Fpresent then 60 | s 61 | ^ begin match t1.desc with 62 | | Tfield _ -> "; " ^ _TO_STRING_ t1 63 | | _ -> "" end 64 | else _TO_STRING_ t1 65 | | Tnil -> "Tnil" 66 | | Tlink t -> _TO_STRING_ t 67 | | Tsubst _ -> "Tsubst _" 68 | | Tvariant {row_more; _} -> _TO_STRING_ row_more 69 | | Tunivar _ -> "Tunivar _" 70 | | Tpoly (t, _) -> _TO_STRING_ t 71 | | Tpackage _ -> "Tpackage _" 72 | | _ -> "Extension _" end 73 | 74 | 75 | and make_name path l = 76 | let t = match l with 77 | | [] -> "" 78 | | _ -> List.fold_left (fun prev typ -> prev ^ _TO_STRING_ typ ^ " ") "" l; 79 | in 80 | let name = Path.name path in 81 | t ^ name 82 | 83 | 84 | let is_type s = 85 | let rec blk s p l acc = 86 | try 87 | if s.[p] = '.' then 88 | let acc = String.sub s (p - l) l :: acc in 89 | blk s (p + 1) 0 acc 90 | else blk s (p + 1) (l + 1) acc 91 | with _ -> String.sub s (p - l) l :: acc 92 | in 93 | if not (String.contains s '.') then false 94 | else 95 | match blk s 0 0 [] with 96 | | hd :: cont :: _ -> 97 | String.capitalize_ascii hd = hd || String.lowercase_ascii cont = cont 98 | | _ -> 99 | assert false 100 | 101 | 102 | 103 | (******** PROCESSING ********) 104 | 105 | let collect_export path u stock t = 106 | 107 | let stock = 108 | if stock == DeadCommon.decs then decs 109 | else stock 110 | in 111 | 112 | let save id loc = 113 | if t.type_manifest = None then 114 | export path u stock id loc; 115 | let path = String.concat "." @@ List.rev_map (fun id -> id.Ident.name) (id::path) in 116 | Hashtbl.replace fields path loc.Location.loc_start 117 | in 118 | 119 | match t.type_kind with 120 | | Type_record (l, _) -> 121 | List.iter 122 | (fun {Types.ld_id; ld_loc; ld_type; _} -> 123 | save ld_id ld_loc; 124 | !DeadLexiFi.export_type ld_loc.Location.loc_start (_TO_STRING_ ld_type) 125 | ) 126 | l 127 | | Type_variant l -> 128 | List.iter (fun {Types.cd_id; cd_loc; _} -> save cd_id cd_loc) l 129 | | _ -> () 130 | 131 | 132 | let collect_references loc exp_loc = 133 | LocHash.add_set references loc exp_loc 134 | 135 | 136 | (* Look for bad style typing *) 137 | let rec check_style t loc = 138 | if !DeadFlag.style.DeadFlag.opt_arg then 139 | match t.desc with 140 | | Tlink t -> check_style t loc 141 | | Tarrow (lab, _, t, _) -> begin 142 | match lab with 143 | | Optional lab when check_underscore lab -> 144 | style := 145 | (!current_src, loc, 146 | "val f: ... -> (... -> ?_:_ -> ...) -> ...") 147 | :: !style 148 | | _ -> check_style t loc end 149 | | _ -> () 150 | 151 | 152 | let tstr typ = 153 | 154 | let assoc name loc = 155 | let path = String.concat "." @@ List.rev @@ 156 | name.Asttypes.txt 157 | :: typ.typ_name.Asttypes.txt :: !mods 158 | @ (String.capitalize_ascii (unit !current_src):: []) 159 | in 160 | begin try match typ.typ_manifest with 161 | | Some {ctyp_desc=Ttyp_constr (_, {txt; _}, _); _} -> 162 | let loc1 = Hashtbl.find fields 163 | (String.concat "." @@ 164 | String.capitalize_ascii (unit !current_src) 165 | :: Longident.flatten txt 166 | @ (name.Asttypes.txt :: [])) 167 | in 168 | let loc2 = Hashtbl.find fields path in 169 | dependencies := 170 | (loc2, loc1) :: (loc1, loc) :: !dependencies; 171 | | _ -> () 172 | with _ -> () end; 173 | try 174 | let loc1 = Hashtbl.find fields path in 175 | dependencies := (loc1, loc) :: !dependencies 176 | with Not_found -> Hashtbl.add fields path loc 177 | in 178 | 179 | let assoc name loc ctyp = 180 | assoc name loc; 181 | !DeadLexiFi.tstr_type typ ctyp 182 | in 183 | 184 | match typ.typ_kind with 185 | | Ttype_record l -> 186 | List.iter 187 | (fun {Typedtree.ld_name; ld_loc; ld_type; _} -> 188 | assoc ld_name ld_loc.Location.loc_start (_TO_STRING_ ld_type.ctyp_type) 189 | ) 190 | l 191 | | Ttype_variant l -> 192 | List.iter 193 | (fun {Typedtree.cd_name; cd_loc; _} -> assoc cd_name cd_loc.Location.loc_start _variant) 194 | l 195 | | _ -> () 196 | 197 | 198 | let report () = report_basic decs "UNUSED CONSTRUCTORS/RECORD FIELDS" !DeadFlag.typ 199 | 200 | 201 | (******** WRAPPING ********) 202 | 203 | let wrap f x = 204 | if DeadFlag.(!typ.print) then f x else () 205 | 206 | let collect_export path u stock t = wrap (collect_export path u stock) t 207 | let tstr typ = wrap tstr typ 208 | let report () = wrap report () 209 | -------------------------------------------------------------------------------- /src/deadType.mli: -------------------------------------------------------------------------------- 1 | (***************************************************************************) 2 | (* *) 3 | (* Copyright (c) 2014-2016 LexiFi SAS. All rights reserved. *) 4 | (* *) 5 | (* This source code is licensed under the MIT License *) 6 | (* found in the LICENSE file at the root of this source tree *) 7 | (* *) 8 | (***************************************************************************) 9 | 10 | val decs : (Lexing.position, string * string) Hashtbl.t 11 | 12 | val dependencies : (Lexing.position * Lexing.position) list ref 13 | 14 | val _TO_STRING_ : Types.type_expr -> string 15 | (** [_TO_STRING_ typ] converts [typ] to its string representation in the toplevel *) 16 | 17 | val check_style : Types.type_expr -> Lexing.position -> unit 18 | (** Look for bad style typing. (i.e. Argument expecting an optional argument) *) 19 | 20 | val tstr : Typedtree.type_declaration -> unit 21 | 22 | val is_unit : Types.type_expr -> bool 23 | 24 | val nb_args : keep:[> `All | `Lbl | `Opt | `Reg ] -> Types.type_expr -> int 25 | 26 | val is_type : string -> bool 27 | 28 | val collect_export : 29 | Ident.t list 30 | -> string 31 | -> (Lexing.position, string * string) Hashtbl.t 32 | -> Types.type_declaration 33 | -> unit 34 | 35 | val collect_references : 36 | Lexing.position -> Lexing.position -> unit 37 | 38 | val report: unit -> unit 39 | --------------------------------------------------------------------------------