ascot diagnostics

A8892

Error: Variable ‘{name}’ is {ty1} in one branch but {ty2} in another

Two branches that join here each #Dim the variable, as different types, so it has no one declared type past the join. IRIS compiles and runs the code regardless: a #Dim type binds nothing at run time. Declare the variable once, before the branches, with a type both fit.

IRIS compiles the example.

Class Demo.InconsistentDeclaration
{

ClassMethod Describe(asNumber As %Boolean) As %String
{
    If asNumber { //! A8892
        #Dim value As %Integer
        Set value = 42
    } Else {
        #Dim value As %String
        Set value = "forty-two"
    }
    Quit value
}

}

All diagnostics