Skip to content

Commit

Permalink
Fix simplify for cat-expressions
Browse files Browse the repository at this point in the history
The dimensions stored in the arrays were sometimes wrong.

Belonging to [master]:
  - OpenModelica/OMCompiler#2352
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Apr 11, 2018
1 parent 65d57a5 commit 38d78f5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -3623,7 +3623,7 @@ protected
DAE.Type ty;
algorithm
ty := typeof(listHead(inElements));
outArray := DAE.ARRAY(ty, not Types.isArray(ty), inElements);
outArray := DAE.ARRAY(DAE.T_ARRAY(ty,{DAE.DIM_INTEGER(listLength(inElements))}), not Types.isArray(ty), inElements);
end makeArrayFromList;

public function makeScalarArray
Expand Down Expand Up @@ -4696,8 +4696,7 @@ algorithm
equation
i = dimensionSize(d);
true = i == listLength(inList);
then
DAE.ARRAY(DAE.T_ARRAY(inType,{DAE.DIM_INTEGER(i)}),false,inList);
then makeArrayFromList(inList);

case(_, {d}, _)
equation
Expand Down Expand Up @@ -4743,7 +4742,7 @@ algorithm
fail();
else
(explst, restexps) = List.split(inList,i);
arrexp = DAE.ARRAY(DAE.T_ARRAY(inType,{DAE.DIM_INTEGER(i)}),false,explst);
arrexp = makeArrayFromList(explst);
restarr = listToArray3(restexps,d,inType);
end if;
then
Expand Down

0 comments on commit 38d78f5

Please sign in to comment.