This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.
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>InheritanceRule (infer.Nullsafe.InheritanceRule)</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>» InheritanceRule</nav><h1>Module <code>Nullsafe.InheritanceRule</code></h1></header><aside><p>Inheritance rule:</p><ol><li>Return type for an overridden method is covariant: overridden method is allowed to narrow down the return value to a subtype of the one from the base method; this means it is OK to make the return value non-null when it was nullable in the base)</li><li>Parameter type for an overridden method is contravariant. It is OK for a derived method to accept nullable in the params even if the base does not accept nullable.</li></ol><p>NOTE: Rule 1) is based on Java covariance rule for the return type. In contrast, rule 2) is nullsafe specific as Java does not support type contravariance for method params.</p></aside><dl><dtclass="spec type"id="type-violation"><ahref="#type-violation"class="anchor"></a><code><spanclass="keyword">type</span> violation</code></dt></dl><div><divclass="spec include"><divclass="doc"><dl><dtclass="spec value"id="val-compare_violation"><ahref="#val-compare_violation"class="anchor"></a><code><spanclass="keyword">val</span> compare_violation : <ahref="index.html#type-violation">violation</a><span>-></span><ahref="index.html#type-violation">violation</a><span>-></span> int</code></dt></dl></div></div></div><dl><dtclass="spec type"id="type-type_role"><ahref="#type-type_role"class="anchor"></a><code><spanclass="keyword">type</span> type_role</code><code> = </code><tableclass="variant"><trid="type-type_role.Param"class="anchored"><tdclass="def constructor"><ahref="#type-type_role.Param"class="anchor"></a><code>| </code><code><spanclass="constructor">Param</span></code></td></tr><trid="type-type_role.Ret"class="anchored"><tdclass="def constructor"><ahref="#type-type_role.Ret"class="anchor"></a><code>| </code><code><spanclass="constructor">Ret</span></code></td></tr></table></dt></dl><dl><dtclass="spec value"id="val-check"><ahref="#val-check"class="anchor"></a><code><spanclass="keyword">val</span> check : <ahref="index.html#type-type_role">type_role</a><span>-></span><span>base:<ahref="../Nullability/index.html#type-t">Nullability.t</a></span><span>-></span><span>overridden:<ahref="../Nullability/index.html#type-t">Nullability.t</a></span><span>-></span><span><span>(unit,<ahref="index.html#type-violation">violation</a>)</span><ahref="../../IStdlib/index.html#module-IStd">IStdlib.IStd</a>.result</span></code></dt><dd><p>See description of the rule in the header of the file. Note that formal fact of violation might or might not be reported to the user, depending on the mode. See <code>to_reportable_violation</code></p></dd></dl><dl><dtclass="spec module"id="module-ReportableViolation"><ahref="#module-ReportableViolation"class="anchor"></a><code><spanclass="keyword">module</span><ahref="ReportableViolation/index.html">ReportableViolation</a> : <spanclass="keyword">sig</span> ... <spanclass="keyword">end</span></code></dt><dd><p>Violation that needs to be reported to the user.</p></dd></dl></div></body></html>