Error: {source} is incompatible with {target}
A Quit or Return value’s class is neither the method’s declared return class nor a
subclass of it; a variable or a parameter given such a value is A9180, which names it.
IRIS compiles the method all the same, and the caller, trusting the declaration, fails on
using the value as that class, here with <METHOD DOES NOT EXIST>. Return an instance of
the declared class, or declare the class the method returns.
IRIS compiles the example, and do ##class(Demo.TypeIncompatible).Call() raises <METHOD DOES NOT EXIST> when it runs.
Class Demo.TypeIncompatible
{
ClassMethod Names() As %ListOfDataTypes
{
Quit ##class(%ArrayOfDataTypes).%New() //! A5967
}
ClassMethod Call() As %Status
{
Set names = ..Names()
Quit names.Insert("Ann")
}
}