Skip to content

Commit 2366380

Browse files
committed
[NF] Partially revert 497427d.
- Relax the record check in Inst.instComplexType to only apply to models, since it currently causes issues for some connectors.
1 parent e0502ef commit 2366380

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

OMCompiler/Compiler/NFFrontEnd/NFInst.mo

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,9 @@ algorithm
22252225

22262226
case Type.COMPLEX(complexTy = ComplexType.RECORD(node))
22272227
// Make sure it's really a record, and not e.g. a record inherited by a model.
2228-
guard InstNode.isRecord(node)
2228+
// TODO: This check should really be InstNode.isRecord(node), but that
2229+
// causes issues with e.g. ComplexInput/ComplexOutput.
2230+
guard not InstNode.isModel(node)
22292231
algorithm
22302232
instRecordConstructor(node);
22312233
then

OMCompiler/Compiler/NFFrontEnd/NFInstNode.mo

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,17 @@ uniontype InstNode
16111611
case COMPONENT_NODE() then isRecord(Component.classInstance(Pointer.access(node.component)));
16121612
end match;
16131613
end isRecord;
1614+
1615+
function isModel
1616+
input InstNode node;
1617+
output Boolean isModel;
1618+
algorithm
1619+
isModel := match node
1620+
case CLASS_NODE() then Restriction.isModel(Class.restriction(Pointer.access(node.cls)));
1621+
case COMPONENT_NODE() then isModel(Component.classInstance(Pointer.access(node.component)));
1622+
else false;
1623+
end match;
1624+
end isModel;
16141625
end InstNode;
16151626

16161627
annotation(__OpenModelica_Interface="frontend");

OMCompiler/Compiler/NFFrontEnd/NFRestriction.mo

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,16 @@ public
196196
end match;
197197
end isClock;
198198

199+
function isModel
200+
input Restriction res;
201+
output Boolean isModel;
202+
algorithm
203+
isModel := match res
204+
case MODEL() then true;
205+
else false;
206+
end match;
207+
end isModel;
208+
199209
function toString
200210
input Restriction res;
201211
output String str;

0 commit comments

Comments
 (0)