Skip to content

Commit

Permalink
Fix bug #2139
Browse files Browse the repository at this point in the history
- better handling of if equations counting 
  if false then eq; end if;
- add test for it:
  testsuite/flattening/libraries/msl32/testquasi.mo
  testsuite/flattening/libraries/msl32/testquasi.mos



git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15843 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Apr 17, 2013
1 parent 4503757 commit a903b44
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Compiler/FrontEnd/CheckModel.mo
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ algorithm
then
(varSize,eqnSize,eqns,hs);

// if equation with condition false and no else
case (DAE.IF_EQUATION(condition1 = {DAE.BCONST(false)}, equations3 = {})::rest,_,_,_,_)
equation
(varSize,eqnSize,eqns,hs) = countVarEqnSize(rest,ivarSize,ieqnSize,ieqnslst,ihs);
then
(varSize,eqnSize,eqns,hs);

// if equation that cannot be translated to if expression but have initial() as condition
case (DAE.IF_EQUATION(condition1 = {DAE.CALL(path=Absyn.IDENT("initial"))})::rest,_,_,_,_)
equation
Expand All @@ -257,6 +264,14 @@ algorithm
(varSize,eqnSize,eqns,hs) = countVarEqnSize(rest,ivarSize,ieqnSize+size,ieqnslst,ihs);
then
(varSize,eqnSize,eqns,hs);

// initial if equation with condition false and no else
case (DAE.INITIAL_IF_EQUATION(condition1 = {DAE.BCONST(false)}, equations3 = {})::rest,_,_,_,_)
equation
(varSize,eqnSize,eqns,hs) = countVarEqnSize(rest,ivarSize,ieqnSize,ieqnslst,ihs);
then
(varSize,eqnSize,eqns,hs);

// initial if equation
case (DAE.INITIAL_IF_EQUATION(condition1 = _)::rest,_,_,_,_)
equation
Expand Down

0 comments on commit a903b44

Please sign in to comment.