Module LineageShape.Summary

type t
val pp : Stdlib.Format.formatter -> t -> unit
val fold_field_labels : t option -> (IR.Var.t * FieldPath.t) -> init:'accum -> f:('accum -> FieldLabel.t -> 'accum) -> fallback:('accum -> 'accum) -> 'accum

If a variable path has a shape that corresponds to a statically known set of field labels, folds over those field labels.

Otherwise, calls the fallback function on init.

If the summary is None, will always fallback.

val fold_cells : t option -> (IR.Var.t * FieldPath.t) -> init:'accum -> f:('accum -> Cell.t -> 'accum) -> 'accum

Folds over all cells under a variable and field path. A field path is "terminal" if its length (that includes the prefixed fields given as parameters) is equal to IBase.Config.lineage_field_depth, or no more field can be subscripted from its corresponding type, or it has strictly more than IBase.Config.lineage_field_width immediate subfields.

The result will not cross any shape whose field table is wider than IBase.Config.lineage_field_width, even if one of the parameter does. For instance, if some variable X has a huge number of fields, the only terminal field of X#field1 will be X itself.

If the summary is None, f will be called once with a var-only abstract cell.

val fold_cell_pairs : t option -> (IR.Var.t * FieldPath.t) -> (IR.Var.t * FieldPath.t) -> init:'accum -> f:('accum -> Cell.t -> Cell.t -> 'accum) -> 'accum

Folds over all corresponding cell pairs of two same-shape variable and field paths. See fold_cells.

Dies if the parameters do not have the same shape.

Note that, since the parameters field paths may not have the same length, f may be called on field paths of different lengths. For instance, if the parameters var#field1 and var'#field2#field3 don't have any subfield, then f will be called with #field1 and #field2#field3.

Also, since the parameters lengths are taken into account for determining the depth of the result, the arguments of f may not have the same suffix when extracting these parameters: for instance, if Config.lineage_field_depth = 1 and var and var'#field have a subfield foo, then f will be called on #foo and #field.

The same width limitation as the function fold_cells is ensured for both parameters (even if these parameters cross wide shapes, the result will not).

If the summary is None, f will be called once with a var-only abstract cells pair.