Skip to content

Commit bf8cb72

Browse files
author
Peter Aronsson
committed
-Fixed so MISSING_INNER_MESSAGE error is not produced if option "checkModel" is true. This option should preferably be set when instantiating class for checkModel.
git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/MathCoreOSMC@4091 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 76545d0 commit bf8cb72

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

Compiler/Error.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ protected constant list<tuple<Integer, MessageType, Severity, String>> errorTabl
468468
(UNUSED_MODIFIER,TRANSLATION(),WARNING(),
469469
"Modifer declared but never used: %s %s"),
470470
(MISSING_INNER_PREFIX,TRANSLATION(),ERROR(),
471-
"No corresponding 'INNER' declaration found for component %s declared as '%s'."),
471+
"No corresponding 'inner' declaration found for component %s declared as '%s'."),
472472
(DERIVATIVE_NON_REAL,TRANSLATION(),ERROR(),
473473
"Illegal derivative. der(%s) where %s is of type %s, which is not a subtype of Real"),
474474
(IMPLICIT_ITERATOR_NOT_FOUND_IN_LOOP_BODY,TRANSLATION(),ERROR(),

Compiler/Inst.mo

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12798,16 +12798,32 @@ algorithm
1279812798
case(DAE.VAR(componentRef=cr, innerOuter = io),innerVars)
1279912799
local Absyn.InnerOuter io;
1280012800
equation
12801-
str2 = SCode.innerouterString(io);
12801+
str2 = Dump.unparseInnerouterStr(io);
1280212802
crs = Util.listMap(innerVars,DAE.varCref);
1280312803
{} = Util.listSelect1(crs, cr,isInnerOuterMatch);
1280412804
str = Exp.printComponentRefStr(cr);
1280512805
Error.addMessage(Error.MISSING_INNER_PREFIX,{str,str2});
12806-
print(" error: " +& str +& "\n");
12807-
then fail();
12806+
failExceptForCheck();
12807+
then ();
1280812808
end matchcontinue;
1280912809
end checkMissingInnerDecl2;
1281012810

12811+
public function failExceptForCheck "function that fails if checkModel option is not set, otherwise it succeeds
12812+
12813+
It should be used for the cases when normal instantiation should fail but a instantiation for performing
12814+
checkModel call should not fail
12815+
"
12816+
algorithm
12817+
_ := matchcontinue()
12818+
case() equation
12819+
true = OptManager.getOption("checkModel");
12820+
then ();
12821+
case() equation
12822+
//false = OptManager.getOption("checkModel");
12823+
then fail();
12824+
end matchcontinue;
12825+
end failExceptForCheck;
12826+
1281112827
protected function extractCurrentName "Function: extractCurrentName
1281212828
Extract SCode.Element name.
1281312829
"

Compiler/runtime/optmanager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ extern "C"
6969
options.insert(std::pair<std::string,bool>("analyticJacobian",false));
7070
options.insert(std::pair<std::string,bool>("dummyOption",false));
7171
options.insert(std::pair<std::string,bool>("logSelectedStates",false));
72+
options.insert(std::pair<std::string,bool>("checkModel",false));
7273

7374
//options.insert(std::pair<std::string,bool>("dummy",false));
7475

0 commit comments

Comments
 (0)