Skip to content

Commit

Permalink
[NF] Relax restriction on input/output prefixes.
Browse files Browse the repository at this point in the history
- Allow an input/output prefix on a component with a short class type
  that also has an input/output prefix, as long as they are the same.

Belonging to [master]:
  - OpenModelica/OMCompiler#2822
  - OpenModelica/OpenModelica-testsuite#1088
  • Loading branch information
perost authored and OpenModelica-Hudson committed Dec 10, 2018
1 parent e1d80fc commit a1f95a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Compiler/NFFrontEnd/NFInst.mo
Expand Up @@ -1571,7 +1571,7 @@ algorithm
Component.Attributes.ATTRIBUTES(cty, par, var, dir, io, fin, redecl, repl) := outerAttr;
cty := Prefixes.mergeConnectorType(cty, innerAttr.connectorType, node);
var := Prefixes.variabilityMin(var, innerAttr.variability);
dir := Prefixes.mergeDirection(dir, innerAttr.direction, node);
dir := Prefixes.mergeDirection(dir, innerAttr.direction, node, allowSame = true);
attr := Component.Attributes.ATTRIBUTES(cty, par, var, dir, io, fin, redecl, repl);
end if;
end mergeDerivedAttributes;
Expand Down
3 changes: 3 additions & 0 deletions Compiler/NFFrontEnd/NFPrefixes.mo
Expand Up @@ -375,12 +375,15 @@ function mergeDirection
input Direction outerDir;
input Direction innerDir;
input InstNode node;
input Boolean allowSame = false;
output Direction dir;
algorithm
if outerDir == Direction.NONE then
dir := innerDir;
elseif innerDir == Direction.NONE then
dir := outerDir;
elseif allowSame and outerDir == innerDir then
dir := innerDir;
else
printPrefixError(directionString(outerDir), directionString(innerDir), node);
end if;
Expand Down

0 comments on commit a1f95a6

Please sign in to comment.