LDC-W2150 — Conditional branches of different kinds in a typed slot
What it means
Section titled “What it means”A conditional expression stands where the destination declares a type: a relation argument, a typed local, a constant, a function result or a function argument. Its two branches have different known kinds, for example a whole number in one branch and text in the other.
A value has exactly one kind, and the compiler does not unify branches of different kinds. The conditional therefore gets no kind of its own, and the destination type is not checked against it: a branch the slot would reject on its own passes silently. The warning names both branches.
Branches that the slot already accepts stay silent: a whole number and a decimal in a decimal slot is fine. If either branch kind is unknown to the compiler, nothing is reported. The warning never fails the check.
Example
Section titled “Example”language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
relation score(n: Integer) kind institutional;
rule R strict { then score(if true then 1 else "one");}language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
relation score(n: Integer) kind institutional;
rule R strict { then score(if true then 1 else 2);}Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.