Skip to content

Commit 5f94fea

Browse files
committed
Restrict polymorphic upcast to INPUT ports only during type resolution
1 parent cad9a05 commit 5f94fea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/xml_parsing.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,9 +830,10 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
830830
prev_info->type() != port_info.type());
831831

832832
// allow mismatch if the previous type appears in the base_chain
833-
// of the current port (i.e., valid polymorphic upcast)
834-
if(port_type_mismatch && !prev_info->baseChain().empty() &&
835-
!port_info.baseChain().empty() &&
833+
// of the current port (i.e., valid polymorphic upcast) and the
834+
// port direction is an INPUT.
835+
if(port_type_mismatch && port_info.direction() == PortDirection::INPUT &&
836+
!prev_info->baseChain().empty() && !port_info.baseChain().empty() &&
836837
prev_info->isConvertibleFrom(port_info.baseChain()[0]))
837838
{
838839
port_type_mismatch = false;

0 commit comments

Comments
 (0)