<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>Nullability (infer.Nullsafe.Nullability)</title><linkrel="stylesheet"href="../../../odoc.css"/><metacharset="utf-8"/><metaname="generator"content="odoc 1.5.2"/><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">Nullsafe</a>» Nullability</nav><h1>Module <code>Nullsafe.Nullability</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><aside><p>Nullability is a central concept for Nullsafe type-checker. Informally, nullability is a "type" \- set of values together with some additional context. All nullsafe is interested about if whether a value can be null, and if it can, what are potential causes of leaking the null inside it. Formally, nullability values form a lattice with partial order and upper bound operations. Practically, most of nullsafe core should remain agnostic over exact values of nullability (e.g. pattern-mathching over them should be a rare case. Core of typechecker should deal with subtyping and joins instead.)</p></aside><dl><dtclass="spec type"id="type-t"><ahref="#type-t"class="anchor"></a><code><spanclass="keyword">type</span> t</code><code> = </code><tableclass="variant"><trid="type-t.Null"class="anchored"><tdclass="def constructor"><ahref="#type-t.Null"class="anchor"></a><code>| </code><code><spanclass="constructor">Null</span></code></td><tdclass="doc"><p>The only possible value for that type is null</p></td></tr><trid="type-t.Nullable"class="anchored"><tdclass="def constructor"><ahref="#type-t.Nullable"class="anchor"></a><code>| </code><code><spanclass="constructor">Nullable</span></code></td><tdclass="doc"><p>No guarantees on the nullability</p></td></tr><trid="type-t.ThirdPartyNonnull"class="anchored"><tdclass="def constructor"><ahref="#type-t.ThirdPartyNonnull"class="anchor"></a><code>| </code><code><spanclass="constructor">ThirdPartyNonnull</span></code></td><tdclass="doc"><p>Values coming from third-party methods and fields not explictly annotated neither as <code>@Nullable</code>, nor as <code>@Nonnull</code>. We still consider those as non-nullable but with the least level of confidence.</p></td></tr><trid="type-t.UncheckedNonnull"class="anchored"><tdclass="def constructor"><ahref="#type-t.UncheckedNonnull"class="anchor"></a><code>| </code><code><spanclass="constructor">UncheckedNonnull</span></code></td><tdclass="doc"><p>The type comes from a signature that is annotated (explicitly or implicitly according to conventions) as non-nullable. Hovewer, the class is not checked under <code>@Nullsafe</code>, so its actual nullability is not truthworhy, as the class might contain arbitrary number of nullability issues</p></td></tr><trid="type-t.LocallyTrustedNonnull"class="anchored"><tdclass="def constructor"><ahref="#type-t.LocallyTrustedNonnull"class="anchor"></a><code>| </code><code><spanclass="constructor">LocallyTrustedNonnull</span></code></td><tdclass="doc"><p>The same as <code>UncheckedNonnull</code>, but the value comes from a class explicitly listed as trusted in the class under analysis. It is less truthworthy than <code>LocallyCheckedNonnull</code> as no actual verification were performed.</p></td></tr><trid="type-t.LocallyCheckedNonnull"class="anchored"><tdclass="def constructor"><ahref="#type-t.LocallyCheckedNonnull"class="anchor"></a><code>| </code><code><spanclass="constructor">LocallyCheckedNonnull</span></code></td><tdclass="doc"><p>Non-nullable value that comes from a class checked under <code>@NullsafeLocal</code> mode. Local mode type-checks files against its dependencies but does not require the dependencies to be transitively checked. Therefore this type of non-nullable value