You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
9.0 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Nullability (infer.Nullsafe.Nullability)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">infer</a> &#x00BB; <a href="../index.html">Nullsafe</a> &#x00BB; Nullability</nav><h1>Module <code>Nullsafe.Nullability</code></h1></header><div class="spec module" id="module-F"><a href="#module-F" class="anchor"></a><code><span class="keyword">module</span> F = Stdlib.Format</code></div><aside><p>Nullability is a central concept for Nullsafe type-checker. Informally, nullability is a &quot;type&quot; \- 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><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code><code> = </code><table class="variant"><tr id="type-t.Null" class="anchored"><td class="def constructor"><a href="#type-t.Null" class="anchor"></a><code>| </code><code><span class="constructor">Null</span></code></td><td class="doc"><p>The only possible value for that type is null</p></td></tr><tr id="type-t.Nullable" class="anchored"><td class="def constructor"><a href="#type-t.Nullable" class="anchor"></a><code>| </code><code><span class="constructor">Nullable</span></code></td><td class="doc"><p>No guarantees on the nullability</p></td></tr><tr id="type-t.ThirdPartyNonnull" class="anchored"><td class="def constructor"><a href="#type-t.ThirdPartyNonnull" class="anchor"></a><code>| </code><code><span class="constructor">ThirdPartyNonnull</span></code></td><td class="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><tr id="type-t.UncheckedNonnull" class="anchored"><td class="def constructor"><a href="#type-t.UncheckedNonnull" class="anchor"></a><code>| </code><code><span class="constructor">UncheckedNonnull</span></code></td><td class="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><tr id="type-t.LocallyTrustedNonnull" class="anchored"><td class="def constructor"><a href="#type-t.LocallyTrustedNonnull" class="anchor"></a><code>| </code><code><span class="constructor">LocallyTrustedNonnull</span></code></td><td class="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><tr id="type-t.LocallyCheckedNonnull" class="anchored"><td class="def constructor"><a href="#type-t.LocallyCheckedNonnull" class="anchor"></a><code>| </code><code><span class="constructor">LocallyCheckedNonnull</span></code></td><td class="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