Assigning optional type to base types
During the code generation it may occur that an optional type (usually an optional field of a complex type) have to be assigned to its base type variant, e.g.
Optional<TitanInteger> a = new Optional<TitanInteger>(TitanInteger.class); TitanInteger b = new TitanInteger(); b.operator_assign(a); // This is the currently generated code b.operator_assign(a.constGet()); // This is a possible solution
constGet() function of the
Optional class performs a check to not to return an unbound or omit value. If this happens than it will result in a dynamic test case error.
A possible solution is presented above, which requires the improvement of the code generation. After investigation this solution seems a quite complex to implement in the current code structure.
An alternative way is completing the runtime lib by allowing to assign optional types to their base types. By this way the code generation doesn't need to be changed.