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

Commit 16e800b

Browse files
perostOpenModelica-Hudson
authored andcommitted
NFInst improvements.
- Fixed type of array cast expressions. - Added internal error when Scalarize fails to expand equation. Belonging to [master]: - #2029 - OpenModelica/OpenModelica-testsuite#785
1 parent 2fe6fb8 commit 16e800b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Compiler/NFFrontEnd/NFExpression.mo

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,13 @@ public
529529
case (UNARY(), _)
530530
then UNARY(exp.operator, typeCastElements(exp.exp, ty));
531531

532-
else CAST(ty, exp);
532+
else
533+
algorithm
534+
t := typeOf(exp);
535+
t := Type.setArrayElementType(t, ty);
536+
then
537+
CAST(t, exp);
538+
533539
end match;
534540
end typeCastElements;
535541

Compiler/NFFrontEnd/NFScalarize.mo

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ algorithm
137137
ty := Type.arrayElementType(ty);
138138

139139
while ExpressionIterator.hasNext(lhs_iter) loop
140+
if not ExpressionIterator.hasNext(rhs_iter) then
141+
Error.addInternalError(getInstanceName() + " could not expand rhs " +
142+
Expression.toString(eq.rhs), eq.info);
143+
end if;
144+
140145
(lhs_iter, lhs) := ExpressionIterator.next(lhs_iter);
141146
(rhs_iter, rhs) := ExpressionIterator.next(rhs_iter);
142147
equations := Equation.EQUALITY(lhs, rhs, ty, info) :: equations;

0 commit comments

Comments
 (0)