[PSyIR] Call to type-bound procedure causes failure.
NEMOVAR makes a lot of use of types and type-bound procedures. A call such as:
CALL psim%init( piom_ctl )
Results in a PSyIR routine symbol with name "psim%init" and the backend then complains that there's no symbol with that name. I think what should really happen at the moment is that such a call should end up being a CodeBlock.
This issue may have some bearing on the LFRic API because there are a lot of type-bound procedure calls in the generated PSy layer.
I think we need to introduce type-bound procedures in the PSyIR and then the fparser frontend. The reservations I had in the past of not knowing how this call affects the other components of the structure in a data-dependency analysis or if it has side effects that depend on the ordering are also problems that any other call have (we don't understand 'pure'). So I see it would be good to have them properly recognised and then we just have to be more restrictive in applying transformations that have Calls or assigning dependencies that cross Calls nodes.
I initially thought this was too restrictive but in a second thought it may not be because in a domain we can raise a Call to a KenrelCall (or create KernelCalls directly) and then we guarantee that this Kernel Call in a loop is independent and has no side effects. So we can still include KernelCalls in all our transformations.
I found this issue (the backend part of this) when trying to generate LFRic API calls with the PSyIR backend. The typebound method can be any combination of type-accesses and array accesses, so it seems sensible to re-use the Reference hierarchy and update call to be:
Call.children = Reference, [DataNode]*
where the first is a mandatory children (which its .datatype should evaluate to a RoutineSymbol, or Unresolved).