Skip to content

Methods uses are not tracked through object aliases #66

@fantazio

Description

@fantazio

Context

If two names refer to the same object, then methods are only considered used when they are manipulated via the original binding.

Example and reproduction

(* /tmp/alias/alias.ml *)
let original =
  object
    method used = ()
    method used_by_alias = ()
  end

let alias = original

let () =
  original#used;
  alias#used_by_alias
$ ocamlopt -bin-annot alias.ml
$ dead_code_analyzer --nothing -M all alias.cmi alias.cmt
Scanning files...
 [DONE]

.> UNUSED METHODS:
=================
/tmp/alias/alias.ml:2: original#used_by_alias

Nothing else to report in this section
--------------------------------------------------------------------------------

We can see that original#used_by_alias is reported as unused although it is used in alias#used_by_alias.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions