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

Commit c655395

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
Robustify elabBuiltinDynamicSelect, ticket:3675
The determination of dynamic values currently fails for crefs with indices. Always return at least the static value.
1 parent 76cba8f commit c655395

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Compiler/FrontEnd/Static.mo

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3862,7 +3862,8 @@ algorithm
38623862
{astatic, adynamic} := inPosArgs;
38633863
(outCache, dstatic, outProperties as DAE.PROP(ty, _), _) :=
38643864
elabExpInExpression(inCache, inEnv, astatic, inImplicit, NONE(), true, inPrefix, inInfo);
3865-
outExp := match (astatic, adynamic)
3865+
try
3866+
outExp := match (astatic, adynamic)
38663867
local
38673868
Absyn.ComponentRef acref;
38683869
Integer digits;
@@ -3887,10 +3888,11 @@ algorithm
38873888
// keep DynamicSelect for Boolean with cref arg (visible, primitivesVisible)
38883889
case (Absyn.BOOL(value = bconst), Absyn.CREF(componentRef = acref))
38893890
then Expression.makeArray({dstatic, Expression.crefToExp(absynCrefToComponentReference(acref))}, ty, true);
3890-
// return first argument of DynamicSelect for model editing per default
3891-
else algorithm
3892-
then dstatic;
3893-
end match;
3891+
end match;
3892+
// return first argument of DynamicSelect for model editing per default
3893+
else
3894+
outExp := dstatic;
3895+
end try;
38943896
end elabBuiltinDynamicSelect;
38953897

38963898
protected function elabBuiltinTranspose

0 commit comments

Comments
 (0)