ascot diagnostics

A6781

Error: Returns nothing where ‘{wanted}’ is declared

This Quit or Return carries no value in a method that declares a return type. In a label, the same is reported when an earlier Quit carries a value and this one does not. IRIS compiles the code. A call that takes the value raises <COMMAND> when it runs, while a Do call runs fine. Return a value of the declared type, or drop the As clause if the method has nothing to return. In a label, give every Quit a value or none.

IRIS compiles the example, and write ##class(Demo.ReturnNothingForX).Half(3) raises <COMMAND> when it runs.

Class Demo.ReturnNothingForX
{

ClassMethod Half(n As %Integer) As %Integer
{
    If n # 2 Quit //! A6781
    Quit n / 2
}

}

All diagnostics