Warning: {source} is abstract, so this value may not be the {target} it is taken for
A method whose return type is a subclass of an abstract class has a Quit or Return value
typed as the abstract class. An abstract class has no instances of its own, so the value is
an instance of some subclass, which may be the declared one. IRIS compiles the method and
does not check the returned object’s class. The caller fails only when the value is another
subclass’s instance and it uses a member that instance lacks (<PROPERTY DOES NOT EXIST>).
Check the value with %IsA first.
IRIS compiles the example.
Class Demo.TypeDowncast Extends %RegisteredObject [ Abstract ]
{
Property Name As %String;
}
Class Demo.TypeDowncastCircle Extends Demo.TypeDowncast
{
Property Radius As %Numeric;
ClassMethod AsCircle(shape As Demo.TypeDowncast) As Demo.TypeDowncastCircle
{
Quit shape //! A8139
}
}