Warning: {source} is abstract, so this value may not be the {target} it is taken for
A Quit or Return value typed as an abstract class leaves a method whose declared return
class is a subclass of it; a variable or a parameter given such a value is A6274, which
names it. No instance is of the abstract class itself, so the value is some subclass’s,
which may be the declared one: IRIS compiles and runs the code, and the caller fails only
when another subclass’s instance arrives. Test %IsA first where one can.
IRIS compiles the example.
Class Demo.TypeDowncast Extends %RegisteredObject [ Abstract ]
{
Property Name As %String;
}
IRIS compiles the example.
Class Demo.TypeDowncastCircle Extends Demo.TypeDowncast
{
Property Radius As %Numeric;
ClassMethod AsCircle(shape As Demo.TypeDowncast) As Demo.TypeDowncastCircle
{
Quit shape //! A8139
}
}