Skip to content

Commit

Permalink
Don't ignore unknown equations/statements in ConvertDAE (#10905)
Browse files Browse the repository at this point in the history
- Fail on unknown equations/statements in ConvertDAE, they indicate that
  something has gone wrong in earlier phases and shouldn't just be
  silently ignored.
  • Loading branch information
perost committed Jun 29, 2023
1 parent 56e4b4c commit f51fd25
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions OMCompiler/Compiler/NFFrontEnd/NFConvertDAE.mo
Expand Up @@ -633,7 +633,11 @@ algorithm
case Equation.NORETCALL()
then DAE.Element.NORETCALL(Expression.toDAE(eq.exp), eq.source) :: elements;

else elements;
else
algorithm
Error.assertion(false, getInstanceName() + " got unknown equation " + Equation.toString(eq), sourceInfo());
then
fail();
end match;
end convertEquation;

Expand Down Expand Up @@ -793,7 +797,11 @@ algorithm
case Equation.NORETCALL()
then DAE.Element.INITIAL_NORETCALL(Expression.toDAE(eq.exp), eq.source) :: elements;

else elements;
else
algorithm
Error.assertion(false, getInstanceName() + " got unknown equation " + Equation.toString(eq), sourceInfo());
then
fail();
end match;
end convertInitialEquation;

Expand Down Expand Up @@ -878,6 +886,11 @@ algorithm
case Statement.FAILURE()
then DAE.Statement.STMT_FAILURE(convertStatements(stmt.body), stmt.source);

else
algorithm
Error.assertion(false, getInstanceName() + " got unknown statement " + Statement.toString(stmt), sourceInfo());
then
fail();
end match;
end convertStatement;

Expand Down

0 comments on commit f51fd25

Please sign in to comment.