LineageShape.Cell
Cells correspond to variable fields for which no subfield will be considered by the analysis, either because they semantically have none, or because the abstract domain decides that considering them would lead to too deep or too wide field structures.
A field path of a cell:
IBase.Config.lineage_field_depth
. For instance, if that limit is 2
, the only cell under both X#foo#bar#baz
and X#foo#bar#ham
will be X#foo#bar
.IBase.Config.lineage_field_width
. For instance, of the variable X
has a huge number of fields, the only cell under X#field1
will be X
itself.IBase.Config.lineage_prevent_cycles
is set. For instance, if X
has fields X#head
and X#tail
, and X#tail
has the same shape as X
, then the cells under X
will be X#head
and X#tail
.If one of these conditions happens, then the cell field path will be truncated before reaching a "scalar" field and the cell will be "abstract".
To make sure that the aforementioned properties hold, one cannot construct cells directly, but should access them through the Summary.fold_cells
and Summary.fold_cell_pairs
functions.
The lineage graph is built on cells.
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t Base__Ppx_compare_lib.compare
include Ppx_compare_lib.Equal.S with type t := t
val equal : t Base__Ppx_compare_lib.equal
val yojson_of_t : t -> Ppx_yojson_conv_lib.Yojson.Safe.t
val pp : t Fmt.t
val field_path : t -> FieldPath.t
val is_abstract : t -> bool
val var_appears_in_source_code : t -> bool
val path_from_origin : origin:VarPath.t -> t -> FieldPath.t
Assuming the cell represents a component of the origin variable path, returns the sub-path subscriptable from this origin path to reach the cell component.
Raises if the cell and the origin path are incompatible (eg. their variables are different or the cell path and the origin path are incomatible).
If the cell is larger than the origin path (eg. because the origin path is longer than the limit and the cells groups it with other paths), returns an empty path. The rationale is that the result of this function can be seen as the subpath which, when extracted from the origin, will cover all the components of that origin stored in the cell. If the cell is larger than the origin then all the components of the origin are in the cell.
Raises if the cell and the origin path are incompatible (eg. their variables are different).
Examples assuming a depth limit of 3: