[flang] Accept structure constructor value for polymorphic component
authorPeter Klausler <pklausler@nvidia.com>
Tue, 8 Feb 2022 19:56:22 +0000 (11:56 -0800)
committerPeter Klausler <pklausler@nvidia.com>
Tue, 15 Feb 2022 00:00:34 +0000 (16:00 -0800)
commitbca13174bc77e7a986bfaba6c384073b4e9fa8cf
tree479fcb24a0c95a2daf12564cfadb6b05d25bc855
parent793924dd5f2ad0663f77a09f09d11adaa4ce2b91
[flang] Accept structure constructor value for polymorphic component

Semantic analysis was emitting a bogus error message when a structure
constructor contains a monomorphic value for a (limited) polymorphic
component of a derived type.  The type compatibility test was too
strict; this patch relaxes it a little to allow values that could
be assigned or passed to a variable or dummy argument with that type.
Also add some quotes to an error message that was sometimes confusing
without them, and remove a repeated space character from another.

Differential Revision: https://reviews.llvm.org/D119744
flang/lib/Evaluate/tools.cpp
flang/lib/Semantics/expression.cpp
flang/test/Semantics/data02.f90
flang/test/Semantics/structconst01.f90
flang/test/Semantics/structconst02.f90