ascot diagnostics

A9180

Error: Cannot assign {source} to ‘{name}’ declared as {target}

Set gives a #Dim‘d variable, or a call gives a typed parameter, a value whose class is neither the declared class nor a subclass of it (a datatype takes any value, and "" is the null OREF). IRIS compiles the assignment all the same, and the code that trusts the declaration fails on using the value as that class, here with <METHOD DOES NOT EXIST>. Pass or assign an instance of the declared class, or declare the class the value has.

IRIS compiles the example, and do ##class(Demo.AssignIncompatible).Call() raises <METHOD DOES NOT EXIST> when it runs.

Class Demo.AssignIncompatible
{

ClassMethod Fill(list As %ListOfDataTypes) As %Status
{
    Quit list.Insert("one")
}

ClassMethod Call() As %Status
{
    Set array = ##class(%ArrayOfDataTypes).%New()
    Quit ..Fill(array) //! A9180
}

}

All diagnostics