Skip to content

Commit

Permalink
[NF] Fix moving of parameter binding to equation.
Browse files Browse the repository at this point in the history
- Set 'fixed' to false when moving a complex parameter binding to an
  initial equation, not true.

Belonging to [master]:
  - OpenModelica/OMCompiler#2528
  • Loading branch information
perost authored and OpenModelica-Hudson committed Jun 25, 2018
1 parent 6fe40c2 commit 0fb948c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Compiler/NFFrontEnd/NFFlatten.mo
Expand Up @@ -302,18 +302,18 @@ protected
Equation eq;
list<tuple<String, Binding>> ty_attrs;
Variability var;
Boolean is_fixed;
Boolean unfix;
algorithm
Component.TYPED_COMPONENT(ty = ty, binding = binding, attributes = comp_attr,
comment = cmt, info = info) := comp;
var := comp_attr.variability;

if isSome(outerBinding) then
SOME(binding) := outerBinding;
is_fixed := Binding.isUnbound(binding) and var == Variability.PARAMETER;
unfix := Binding.isUnbound(binding) and var == Variability.PARAMETER;
else
binding := flattenBinding(binding, prefix);
is_fixed := false;
unfix := false;
end if;

// If the component is an array component with a binding and at least discrete variability,
Expand All @@ -331,9 +331,9 @@ algorithm

// Set fixed = true for parameters that are part of a record instance whose
// binding couldn't be split and was moved to an initial equation.
if is_fixed then
if unfix then
ty_attrs := List.removeOnTrue("fixed", isTypeAttributeNamed, ty_attrs);
ty_attrs := ("fixed", Binding.FLAT_BINDING(Expression.BOOLEAN(true), Variability.CONSTANT)) :: ty_attrs;
ty_attrs := ("fixed", Binding.FLAT_BINDING(Expression.BOOLEAN(false), Variability.CONSTANT)) :: ty_attrs;
end if;

vars := Variable.VARIABLE(name, ty, binding, visibility, comp_attr, ty_attrs, cmt, info) :: vars;
Expand Down

0 comments on commit 0fb948c

Please sign in to comment.