File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
OMCompiler/Compiler/NFFrontEnd
testsuite/flattening/modelica/scodeinst Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1355,7 +1355,7 @@ algorithm
13551355 subscriptedExp := simplify(e);
13561356 subs := Subscript . simplifyList(subs, Type . arrayDims(Expression . typeOf(e)));
13571357
1358- if not split and not List . all(subs, Subscript . isLiteral) then
1358+ if not split and not List . all(subs, Subscript . isLiteral) and Type . isScalar(ty) then
13591359 // Select the first element as long as the subscripted expression is an
13601360 // array where all elements are equal, unless all the subscripts are literal
13611361 // in which case it's cheaper to just apply them.
Original file line number Diff line number Diff line change 1+ // name: CevalArrayConstructor3
2+ // keywords:
3+ // status: correct
4+ //
5+ //
6+
7+ model CevalArrayConstructor3
8+ parameter Real x[3 ] = {2 , 2 , 2 };
9+ parameter Real y[:] = {sum (x[1 :i]) for i in 1 :2 } annotation(Evaluate=true);
10+ end CevalArrayConstructor3;
11+
12+ // Result:
13+ // class CevalArrayConstructor3
14+ // final parameter Real x[1] = 2.0;
15+ // final parameter Real x[2] = 2.0;
16+ // final parameter Real x[3] = 2.0;
17+ // final parameter Real y[1] = 2.0;
18+ // final parameter Real y[2] = 4.0;
19+ // end CevalArrayConstructor3;
20+ // endResult
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ CevalArrayConstant2.mo \
119119CevalArrayConstant3.mo \
120120CevalArrayConstructor1.mo \
121121CevalArrayConstructor2.mo \
122+ CevalArrayConstructor3.mo \
122123CevalAsin1.mo \
123124CevalAtan1.mo \
124125CevalAtan21.mo \
You can’t perform that action at this time.
0 commit comments