The previous semantic analysis does not consider when the last part-ref
is scalar or complex part. Refactor the previous code and bring all the
checks into one place. The check starts from the designator by
extracting the dataref wrapped including the substring and complex part
and recursively check the base objects.
Co-authored-by: Peter Klausler <pklausler@nvidia.com>
I think this message is not clear enough. For example, users fixing one problem for call sub(t(:)%t3(:)%t2(:)%t1(:)%s(1,:)(1:2)) by changing from s(1,:)(1:2) into s(1,1)(1:2) will get another error.