Skip to content

Commit

Permalink
Fix connector balance check (#12146)
Browse files Browse the repository at this point in the history
- Don't check connector balance of potentially present variables unless
  they're actually connectors.
  • Loading branch information
perost committed Mar 26, 2024
1 parent 3c8d879 commit a8423dd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/NFFrontEnd/NFTyping.mo
Expand Up @@ -356,7 +356,7 @@ protected
algorithm
comp := InstNode.component(component);

if not Component.isConnector(comp) or Component.isExpandableConnector(comp) then
if not ConnectorType.isConnector(Component.connectorType(comp)) then
return;
end if;

Expand Down
17 changes: 17 additions & 0 deletions testsuite/flattening/modelica/scodeinst/ExpandableConnector12.mo
@@ -0,0 +1,17 @@
// name: ExpandableConnector12
// keywords: expandable connector
// status: correct
// cflags: -d=newInst
//
// Checks that potentially present non-connector variables in an expandable
// connector doesn't generate warnings about unbalanced connectors.
//

expandable connector ExpandableConnector12
Real x;
end ExpandableConnector12;

// Result:
// class ExpandableConnector12
// end ExpandableConnector12;
// endResult
1 change: 1 addition & 0 deletions testsuite/flattening/modelica/scodeinst/Makefile
Expand Up @@ -448,6 +448,7 @@ ExpandableConnector8.mo \
ExpandableConnector9.mo \
ExpandableConnector10.mo \
ExpandableConnector11.mo \
ExpandableConnector12.mo \
ExpandableConnectorComplex1.mo \
ExpandableConnectorFlow1.mo \
ExpandableConnectorFlow2.mo \
Expand Down

0 comments on commit a8423dd

Please sign in to comment.