Skip to content

Commit

Permalink
[NF] Add redeclare test.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 7, 2019
1 parent b11b5d5 commit a10b195
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -709,6 +709,7 @@ RedeclareMod2.mo \
RedeclareMod3.mo \
RedeclareMod4.mo \
RedeclareMod5.mo \
RedeclareMod6.mo \
redeclare10.mo \
redeclare11.mo \
redeclare12.mo \
Expand Down
46 changes: 46 additions & 0 deletions flattening/modelica/scodeinst/RedeclareMod6.mo
@@ -0,0 +1,46 @@
// name: RedeclareMod6
// keywords:
// status: correct
// cflags: -d=newInst
//

record BaseCable
end BaseCable;

record Generic
extends BaseCable;
end Generic;

partial model PartialBaseLine
replaceable parameter Generic commercialCable;
end PartialBaseLine;

partial model PartialNetwork
replaceable parameter PartialGrid grid;
replaceable PartialBaseLine[grid.nLinks] lines;
end PartialNetwork;

model Line
extends PartialBaseLine;
end Line;

record PartialGrid
parameter Integer nLinks;
replaceable BaseCable[nLinks] cables;
end PartialGrid;

record TestGrid2Nodes
extends PartialGrid(nLinks = 1);
end TestGrid2Nodes;

model RedeclareMod6
extends PartialNetwork(
redeclare replaceable TestGrid2Nodes grid,
redeclare Line lines(commercialCable = grid.cables));
end RedeclareMod6;

// Result:
// class RedeclareMod6
// parameter Integer grid.nLinks = 1;
// end RedeclareMod6;
// endResult

0 comments on commit a10b195

Please sign in to comment.