This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<!DOCTYPE html>
<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>Struct (infer.IR.Struct)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.1"/><metaname="viewport"content="width=device-width,initial-scale=1.0"/><scriptsrc="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><divclass="content"><header><nav><ahref="../index.html">Up</a>–<ahref="../../index.html">infer</a>»<ahref="../index.html">IR</a>» Struct</nav><h1>Module <code>IR.Struct</code></h1></header><divclass="spec module"id="module-F"><ahref="#module-F"class="anchor"></a><code><spanclass="keyword">module</span> F = Stdlib.Format</code></div><dl><dtclass="spec type"id="type-field"><ahref="#type-field"class="anchor"></a><code><spanclass="keyword">type</span> field</code><code> = <ahref="../Fieldname/index.html#type-t">Fieldname.t</a> * <ahref="../Typ/index.html#type-t">Typ.t</a> * <ahref="../Annot/Item/index.html#type-t">Annot.Item.t</a></code></dt></dl><div><divclass="spec include"><divclass="doc"><dl><dtclass="spec value"id="val-compare_field"><ahref="#val-compare_field"class="anchor"></a><code><spanclass="keyword">val</span> compare_field : <ahref="index.html#type-field">field</a><span>-></span><ahref="index.html#type-field">field</a><span>-></span> int</code></dt></dl></div></div></div><dl><dtclass="spec type"id="type-fields"><ahref="#type-fields"class="anchor"></a><code><spanclass="keyword">type</span> fields</code><code> = <span><ahref="index.html#type-field">field</a> list</span></code></dt><dtclass="spec type"id="type-java_class_kind"><ahref="#type-java_class_kind"class="anchor"></a><code><spanclass="keyword">type</span> java_class_kind</code><code> = </code><tableclass="variant"><trid="type-java_class_kind.Interface"class="anchored"><tdclass="def constructor"><ahref="#type-java_class_kind.Interface"class="anchor"></a><code>| </code><code><spanclass="constructor">Interface</span></code></td></tr><trid="type-java_class_kind.AbstractClass"class="anchored"><tdclass="def constructor"><ahref="#type-java_class_kind.AbstractClass"class="anchor"></a><code>| </code><code><spanclass="constructor">AbstractClass</span></code></td></tr><trid="type-java_class_kind.NormalClass"class="anchored"><tdclass="def constructor"><ahref="#type-java_class_kind.NormalClass"class="anchor"></a><code>| </code><code><spanclass="constructor">NormalClass</span></code></td></tr></table></dt></dl><div><divclass="spec include"><divclass="doc"><dl><dtclass="spec value"id="val-equal_java_class_kind"><ahref="#val-equal_java_class_kind"class="anchor"></a><code><spanclass="keyword">val</span> equal_java_class_kind : <ahref="index.html#type-java_class_kind">java_class_kind</a><span>-></span><ahref="index.html#type-java_class_kind">java_class_kind</a><span>-></span> bool</code></dt></dl></div></div></div><dl><dtclass="spec type"id="type-java_class_info"><ahref="#type-java_class_info"class="anchor"></a><code><spanclass="keyword">type</span> java_class_info</code><code> = </code><code>{</code><tableclass="record"><trid="type-java_class_info.kind"class="anchored"><tdclass="def field"><ahref="#type-java_class_info.kind"class="anchor"></a><code>kind : <ahref="index.html#type-java_class_kind">java_class_kind</a>;</code></td><tdclass="doc"><p>class kind in Java</p></td></tr><trid="type-java_class_info.loc"class="anchored"><tdclass="def field"><ahref="#type-java_class_info.loc"class="anchor"></a><code>loc : <span><ahref="../../IBase/Location/index.html#type-t">IBase.Location.t</a> option</span>;</code></td><tdclass="doc"><p>None should correspond to rare cases when it was impossible to fetch the location in source file</p></td></tr></table><code>}</code></dt><dtclass="spec type"id="type-t"><ahref="#type-t"class="anchor"></a><code><spanclass="keyword">type</span> t</code><code> = </code><code>{</code><tableclass="record"><trid="type-t.fields"class="anchored"><tdclass="def field"><ahref="#type-t.fields"class="anchor"></a><code>fields : <ahref="index.html#type-fields">fields</a>;</code></td><tdclass="doc"><p>non-static fields</p></td></tr><trid="type-t.statics"class="anchored"><tdclass="def field"><ahref="#type-t.statics"class="anchor"></a><code>statics : <ahref="index.html#type-fields">fields</a>;</code></td><tdclass="doc"><p>static fields</p></td></tr><trid="type-t.supers"class="anchored"><tdclass="def field"><ahref="#type-t.supers"class="anchor"></a><code>supers : <span><ahref="../Typ/Name/index.html#type-t">Typ.Name.t</a> list</span>;</code></td><tdclass="doc"><p>superclasses</p></td></tr><trid="type-t.methods"class="anchored"><tdclass="def field"><ahref="#type-t.methods"class="anchor"></a><code>methods : <span><ahref="../Procname/index.html#type-t">Procname.t</a> list</span>;</code></td><tdclass="doc"><p>methods defined</p></td></tr><trid="type-t.exported_objc_methods"class="anchored"><tdclass="def field"><ahref="#type-t.exported_objc_methods"class="anchor"></a><code>exported_objc_methods : <span><ahref="../Procname/index.html#type-t">Procname.t</a> list</span>;</code></td><tdclass="doc"><p>methods in ObjC interface, subset of <code>methods</code></p></td></tr><trid="type-t.annots"class="anchored"><tdclass="def field"><ahref="#type-t.annots"class="anchor"></a><code>annots : <ahref="../Annot/Item/index.html#type-t">Annot.Item.t</a>;</code></td><tdclass="doc"><p>annotations</p></td></tr><trid="type-t.java_class_info"class="anchored"><tdclass="def field"><ahref="#type-t.java_class_info"class="anchor"></a><code>java_class_info : <span><ahref="index.html#type-java_class_info">java_class_info</a> option</span>;</code></td><tdclass="doc"><p>present if and only if the class is Java</p></td></tr><trid="type-t.dummy"class="anchored"><tdclass="def field"><ahref="#type-t.dummy"class="anchor"></a><code>dummy : bool;</code></td><tdclass="doc"><p>dummy struct for class including static method</p></td></tr></table><code>}</code></dt><dd><p>Type for a structured value.</p></dd></dl><dl><dtclass="spec type"id="type-lookup"><ahref="#type-lookup"class="anchor"></a><code><spanclass="keyword">type</span> lookup</code><code> = <ahref="../Typ/Name/index.html#type-t">Typ.Name.t</a><span>-></span><span><ahref="index.html#type-t">t</a> option</span></code></dt></dl><dl><dtclass="spec value"id="val-pp_field"><ahref="#val-pp_field"class="anchor"></a><code><spanclass="keyword">val</span> pp_field : <ahref="../../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a><span>-></span><ahref="index.html#module-F">F</a>.formatter <span>-></span><ahref="index.html#type-field">field</a><span>-></span> unit</code></dt><dtclass="spec value"id="val-pp"><ahref="#val-pp"class="anchor"></a><code><spanclass="keyword">val</span> pp : <ahref="../../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a><span>-></span><ahref="../Typ/Name/index.html#type-t">Typ.Name.t</a><span>-></span><ahref="index.html#module-F">F</a>.formatter <span>-></span><ahref="index.html#type-t">t</a><span>-></span> unit</code></dt><dd><p>Pretty print a struct type.</p></dd></dl><dl><dtclass="spec value"id="val-internal_mk_struct"><ahref="#val-internal_mk_struct"class="anchor"></a><code><spanclass="keyword">val</span> internal_mk_struct : <span>?⁠default:<ahref="index.html#type-t">t</a></span><span>-></span><span>?⁠fields:<ahref="index.html#type-fields">fields</a></span><span>-></span><span>?⁠statics:<ahref="index.html#type-fields">fields</a></span><span>-></span><span>?⁠methods:<span><ahref="../Procname/index.html#type-t">Procname.t</a> list</span></span><span>-></span><span>?⁠exported_objc_methods:<span><ahref="../Procname/index.html#type-t">Procname.t</a> list</span></span><span>-></span><span>?⁠supers:<span><ahref="../Typ/Name/index.html#type-t">Typ.Name.t</a> list</span></span><span>-></span><span>?⁠annots:<ahref="../Annot/Item/index.html#type-t">Annot.Item.t</a></span><span>-></span><span>?⁠java_class_info:<ahref="index.html#type-java_class_info">java_class_info</a></span><span>-></span><span>?⁠dummy:bool</span><span>-></span> unit <span>-></span><ahref="index.html#type-t">t</a></code></dt><dd><p>Construct a struct_typ, normalizing field types</p></dd></dl><dl><dtclass="spec value"id="val-get_extensible_array_element_typ"><ahref="#val-get_extensible_array_element_typ"class="anchor"></a><code><spanclass="keyword">val</span> get_extensible_array_element_typ : <span>lookup:<ahref="index.html#type-lookup">lookup</a></span><span>-></span><ahref="../Typ/index.html#type-t">Typ.t</a><span>-></span><span><ahref="../Typ/index.html#type-t">Typ.t</a> option</span></code></dt><dd><p>the element typ of the final extensible array in the given typ, if any</p></dd></dl><dl><dtclass="spec type"id="type-field_info"><ahref="#type-field_info"class="anchor"></a><code><spanclass="keyword">type</span> field_info</code><code> = </code><code>{</code><tableclass="record"><trid="type-field_info.typ"class="anchored"><tdclass="def field"><ahref="#type-field_info.typ"class="anchor"></a><code>typ : <ahref="../Typ/index.html#type-t">Typ.t</a>;</code></td></tr><trid="type-field_info.annotations"class="anchored"><tdclass="def field"><ahref="#type-field_info.annotations"class="anchor"></a><code>annotations : <ahref="../Annot/Item/index.html#type-t">Annot.Item.t</a>;</code></td></tr><trid="type-field_info.is_static"class="anchored"><tdclass="def field"><ahref="#type-field_info.is_static"class="anchor"></a><code>is_static : bool;</code></td></tr></table><code>}</code></dt></dl><dl><dtclass="spec value"id="val-get_field_info"><ahref="#val-get_field_info"class="anchor"></a><code><spanclass="keyword">val</span> get_field_info : <span>lookup:<ahref="index.html#type-lookup">lookup</a></span><span>-></span><ahref="../Fieldname/index.html#type-t">Fieldname.t</a><span>-></span><ahref="../Typ/index.html#type-t">Typ.t</a><span>-></span><span><ahref="index.html#type-field_info">field_info</a> option</span></code></dt><dd><p>Lookup for info associated with the field <code>fn</code>. None if <code>typ</code> has no field named <code>fn</code></p></dd></dl><dl><dtclass="spec value"id="val-fld_typ"><ahref="#val-fld_typ"class="anchor"></a><code><spanclass="keyword">val</span> fld_typ : <span>lookup:<ahref="index.html#type-lookup">lookup</a></span><span>-></span><span>default:<ahref="../Typ/index.html#type-t">Typ.t</a></span><span>-></span><ahref="../Fieldname/index.html#type-t">Fieldname.t</a><span>-></span><ahref="../Typ/index.html#type-t">Typ.t</a><span>-></span><ahref="../Typ/index.html#type-t">Typ.t</a></code></dt><dd><p>If a struct type with field f, return the type of f. If not, return the default type if given, otherwise raise an exception</p></dd></dl><dl><dtclass="spec value"id="val-get_field_type_and_annotation"><ahref="#val-get_field_type_and_annotation"class="anchor"></a><code><spanclass="keyword">val</span> get_field_type_and_annotation : <span>lookup:<ahref="index.html#type-lookup">lookup</a></span><span>-></span><ahref="../Fieldname/index.html#type-t">Fieldname.t</a><span>-></span><ahref="../Typ/index.html#type-t">Typ.t</a><span>-></span><span><span>(<ahref="../Typ/index.html#type-t">Typ.t</a> * <ahref="../Annot/Item/index.html#type-t">Annot.Item.t</a>)</span> option</span></code></dt><dd><p>Return the type of the field <code>fn</code> and its annotation, None if <code>typ</code> has no field named <code>fn</code></p></dd></dl><dl><dtclass="spec value"id="val-merge"><ahref="#val-merge"class="anchor"></a><code><spanclass="keyword">val</span> merge : <ahref="../Typ/Name/index.html#type-t">Typ.Name.t</a><span>-></span><span>newer:<ahref="index.html#type-t">t</a></span><span>-></span><span>current:<ahref="index.html#type-t">t</a></span><span>-></span><ahref="index.html#type-t">t</a></code></dt><dd><p>best effort directed merge of two structs for the same typename</p></dd></dl><dl><dtclass="spec value"id="val-is_not_java_interface"><ahref="#val-is_not_java_interface"class="anchor"></a><code><spanclass="keyword">val</span> is_not_java_interface : <ahref="index.html#type-t">t</a><span>-></span> bool</code></dt><dd><p>check that a struct either defines a non-java type, or a non-java-interface type (abstract or normal class)</p></dd></dl></div></body></html>