ascot diagnostics

A6826

Warning: This ‘{ty}’ value may be undefined{expr}

The variable has a value on some branches that reach this use and none on others. This happens when it is assigned under a condition or killed on one branch. A $Data, $Order or $ListNext call that found nothing to fetch also leaves its value argument undefined. IRIS compiles the code and raises <UNDEFINED> when a branch without the value runs. Assign the variable on every branch, or read it through $Get.

IRIS compiles the example, and do ##class(Demo.MaybeUndefined).Label(1) raises <UNDEFINED> when it runs.

Class Demo.MaybeUndefined
{

ClassMethod Label(count As %Integer) As %String
{
    If count > 1 Set suffix = "s"
    Quit "item" _ suffix //! A6826
}

}

All diagnostics