Opened 14 years ago
Last modified 14 years ago
#1189 closed defect (fixed)
Illegal nested when-statements and when-equations are not detected.
Reported by: | petar | Owned by: | petar |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | Instantiation | Version: | |
Keywords: | Cc: | petar, perost |
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 Changed 14 years ago by perost
comment:2 Changed 14 years ago by dhedberg
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 Changed 14 years ago by perost
Fixed in revision 6285, see test case mofiles/WhenNestedEquation.
Fixed in revision 5334.