predicate-result-type

Available in: KerML, SysML

This checks that predicate return parameters and results are boolean valued.

Predicates implicitly inherit boolean return parameters so they are ignored.

Specification

Per KerML 7.4.8.4:

Since a predicate must always return a Boolean result, it is not necessary to explicitly declare a result parameter for it. However, if a result parameter is declared, then it must have type Boolean from the ScalarValues library model (see 9.3.2 ) and multiplicity 1..1 (see 7.4.12 ).

And:

If a result expression is included, then it must have a Boolean result.

Example

predicate {
    "string" // error: Predicate result must be boolean evaluable
}

Predicates must return boolean values:

predicate {
    true // ok
}

All validation rules