Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
[NF] Fix simplification of sum/product.
Browse files Browse the repository at this point in the history
- Use the array element type of the argument when creating default
  expressions, since the result should be a scalar.

Belonging to [master]:
  - #2556
  • Loading branch information
perost authored and OpenModelica-Hudson committed Jul 3, 2018
1 parent 412a023 commit fd178e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Compiler/NFFrontEnd/NFSimplifyExp.mo
Expand Up @@ -201,14 +201,14 @@ algorithm

if expanded then
args := Expression.arrayScalarElements(exp);
ty := Expression.typeOf(arg);
ty := Type.arrayElementType(Expression.typeOf(arg));

if listEmpty(args) then
exp := if isSum then Expression.makeZero(ty) else Expression.makeOne(ty);
else
exp :: args := args;
op := if isSum then Operator.makeAdd(Type.arrayElementType(ty)) else
Operator.makeMul(Type.arrayElementType(ty));
op := if isSum then Operator.makeAdd(ty) else
Operator.makeMul(ty);

for e in args loop
exp := Expression.BINARY(exp, op, e);
Expand Down

0 comments on commit fd178e1

Please sign in to comment.