ascot diagnostics

A6274

Warning: Assigning a {source} to ‘{name}’ declared as {target}

A #Dim‘d variable, property or formal argument declared as a subclass of an abstract class is given a 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 and runs the code, which fails only when the value is another subclass’s instance, here on reading Radius with <PROPERTY DOES NOT EXIST>. Check the value with %IsA first.

IRIS compiles the example.

Class Demo.DowncastFromAbstract Extends %RegisteredObject [ Abstract ]
{

Property Name As %String;

}
Class Demo.DowncastFromAbstractCircle Extends Demo.DowncastFromAbstract
{

Property Radius As %Numeric;

ClassMethod Diameter(circle As Demo.DowncastFromAbstractCircle) As %Numeric
{
    Quit circle.Radius * 2
}

ClassMethod Call(shape As Demo.DowncastFromAbstract) As %Numeric
{
    Quit ..Diameter(shape) //! A6274
}

}

All diagnostics