LDC-W2152 — Function result type does not fit the destination
What it means
Section titled “What it means”A call to a function declared in the same package stands where the destination declares a type, and the function’s declared result type is known not to fit it: a whole number where text is expected, an entity where a number is expected, or money in one named currency where another named currency is expected.
The compiler keeps the kind of a call result unknown, so the destination type is not checked against the call and the mismatch passes silently. The warning reads only the function’s declared signature, never its body, and names both the declared result and the destination type.
Nothing is reported when the evidence is incomplete: a function from another package, two functions with the same name, plain money without a named currency, or a subtype chain the compiler cannot see in full. A whole number in a decimal destination is accepted. 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 named(t: Text) kind institutional;
pure function three() -> Integer = 3;
rule R strict { then named(three());}language "law.core" version "0.2";package demo.diagnostics version "0.1.0";namespace "urn:law:demo:diagnostics";
relation named(t: Text) kind institutional;
pure function three() -> Text = "three";
rule R strict { then named(three());}Documentation for Arxo. Writings — blog.arxo.io.
Anonymous visit counts on stats.arxo.io, no cookies.