Opened 15 years ago

Last modified 14 years ago

#1189 closed defect (fixed)

Illegal nested when-statements and when-equations are not detected.

Reported by: Peter Aronsson Owned by: Peter Aronsson
Priority: critical Milestone:
Component: Instantiation Version:
Keywords: Cc: Peter Aronsson, Per Östlund

Description

Both nested when-statements and when-equations are illegal in Modelica. But the compiler does not complain when it encounters them.

Example
{{{ model Model1

Integer x;
Integer y;
algorithm
when sample(0, 1) then

if time > 1 then

x:=1;

end if;

when x > 0 then
y:=3;
end when;

end when;
end Model1;

}}}

Example provided by Wladimir Schamai (EADS)

Change History (3)

comment:1 by Per Östlund, 15 years ago

Fixed in revision 5334.

comment:2 by dhedberg, 14 years ago

The checks seem not be exhaustive as the model below results in no warnings (instantiation succeeds). Opening issue again.

model ErrorNestedWhen
  Real x,y1,y2;
equation 
  when x > 2 then
    when y1 > 3 then
      y2=sin(x);
    end when;
  end when;
end ErrorNestedWhen;

comment:3 by Per Östlund, 14 years ago

Fixed in revision 6285, see test case mofiles/WhenNestedEquation.

Note: See TracTickets for help on using tickets.