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.
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Nullsafe__OverAnnotatedRule (infer.Nullsafe__OverAnnotatedRule)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><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> » Nullsafe__OverAnnotatedRule</nav><h1>Module <code>Nullsafe__OverAnnotatedRule</code></h1></header><aside><p>Checks if a type in signature (e.g. return value) can be made more specific. NOTE: This rule is complementatary to assignment rule. While assignment rule checks a single assignment `lhs = rhs`, this rule checks checks ALL assignments to `lhs` in the program. NOTE: Violation of this rule is not a type violation, hence it should never be surfaced as error: `lhs`'s type can be intentionally made broad by code author (e.g. to anticipate future changes in the implementation). Heuristits are required to correctly surface overannotated rule to the user. This rule is useful for some scenarios, especially for nullability code conversions when it is expected that some signatures were annotated with <code>@Nullable</code> defensively, so surfacing such cases can improve API and make migration smooth.</p></aside><dl><dt class="spec type" id="type-violation"><a href="#type-violation" class="anchor"></a><code><span class="keyword">type</span> violation</code></dt></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_violation"><a href="#val-compare_violation" class="anchor"></a><code><span class="keyword">val</span> compare_violation : <a href="index.html#type-violation">violation</a> <span>-></span> <a href="index.html#type-violation">violation</a> <span>-></span> int</code></dt></dl></div></div></div><dl><dt class="spec value" id="val-check"><a href="#val-check" class="anchor"></a><code><span class="keyword">val</span> check : <span>what:<a href="../Nullsafe/Nullability/index.html#type-t">Nullsafe.Nullability.t</a></span> <span>-></span> <span>by_rhs_upper_bound:<a href="../Nullsafe/Nullability/index.html#type-t">Nullsafe.Nullability.t</a></span> <span>-></span> <span><span>(unit, <a href="index.html#type-violation">violation</a>)</span> <a href="../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.result</span></code></dt><dd><p>Checks if the declared type for `what` can be narrowed, based on the information about all assignments `what = rhs_i`. If an upper bound of `rhs_i` over ALL assignents `what = rhs_i` that exist in the program is a _strict_ subtype of lhs, `lhs`'s type can be narrowed to be that upper bound.</p></dd></dl><dl><dt class="spec type" id="type-violation_type"><a href="#type-violation_type" class="anchor"></a><code><span class="keyword">type</span> violation_type</code><code> = </code><table class="variant"><tr id="type-violation_type.FieldOverAnnoted" class="anchored"><td class="def constructor"><a href="#type-violation_type.FieldOverAnnoted" class="anchor"></a><code>| </code><code><span class="constructor">FieldOverAnnoted</span> <span class="keyword">of</span> <a href="../IR/Fieldname/index.html#type-t">IR.Fieldname.t</a></code></td></tr><tr id="type-violation_type.ReturnOverAnnotated" class="anchored"><td class="def constructor"><a href="#type-violation_type.ReturnOverAnnotated" class="anchor"></a><code>| </code><code><span class="constructor">ReturnOverAnnotated</span> <span class="keyword">of</span> <a href="../IR/Procname/Java/index.html#type-t">IR.Procname.Java.t</a></code></td><td class="doc"><p>Return value of a method can be made non-nullable</p></td></tr></table></dt></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_violation_type"><a href="#val-compare_violation_type" class="anchor"></a><code><span class="keyword">val</span> compare_violation_type : <a href="in
|