Skip to content
docs
Arxo ↗

LDC-W2150 — Conditional branches of different kinds in a typed slot

For LLMs5 sections

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.

Arxo Law
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");
}
Arxo Law
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);
}

The engine reports this in its own wording:

Output
example.law:8:16: warning LDC-W2150: if branches have different known kinds Integer and Text in a slot of type Integer; the branch kinds are not unified, so the slot type is not checked (§56, §48)

Documentation for Arxo. Writings — blog.arxo.io.

Anonymous visit counts on stats.arxo.io, no cookies.