Skip to content

Commit

Permalink
SCodeAnalyseRedeclare.mo
Browse files Browse the repository at this point in the history
- do not crash omc on types containing functions referring to the type 
  the testsuite now works without issues with +d=scodeInstShortcut and has 309 failures.

Dump.mo
- dump all the existing restrictions

Inline.mo
- more useful output for failtrace.



git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13978 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 20, 2012
1 parent c5aec81 commit 8b72b30
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions Compiler/FrontEnd/Dump.mo
Original file line number Diff line number Diff line change
Expand Up @@ -882,19 +882,21 @@ algorithm
case Absyn.R_CONNECTOR() equation Print.printBuf("Absyn.R_CONNECTOR"); then ();
case Absyn.R_EXP_CONNECTOR() equation Print.printBuf("Absyn.R_EXP_CONNECTOR"); then ();
case Absyn.R_TYPE() equation Print.printBuf("Absyn.R_TYPE"); then ();
case Absyn.R_UNIONTYPE() equation Print.printBuf("Absyn.R_UNIONTYPE"); then ();
case Absyn.R_PACKAGE() equation Print.printBuf("Absyn.R_PACKAGE"); then ();
case Absyn.R_FUNCTION(Absyn.FR_NORMAL_FUNCTION()) equation Print.printBuf("Absyn.R_FUNCTION(Absyn.FR_NORMAL_FUNCTION)"); then ();
case Absyn.R_FUNCTION(Absyn.FR_OPERATOR_FUNCTION()) equation Print.printBuf("Absyn.R_FUNCTION(Absyn.FR_OPERATOR_FUNCTION)"); then ();
case Absyn.R_FUNCTION(Absyn.FR_PARALLEL_FUNCTION()) equation Print.printBuf("Absyn.R_FUNCTION(Absyn.FR_PARALLEL_FUNCTION)"); then ();
case Absyn.R_FUNCTION(Absyn.FR_KERNEL_FUNCTION()) equation Print.printBuf("Absyn.R_FUNCTION(Absyn.FR_KERNEL_FUNCTION)"); then ();
case Absyn.R_OPERATOR() equation Print.printBuf("Absyn.R_OPERATOR"); then ();
case Absyn.R_OPERATOR_RECORD() equation Print.printBuf("Absyn.R_OPERATOR_RECORD"); then ();
case Absyn.R_ENUMERATION() equation Print.printBuf("Absyn.R_ENUMERATION"); then ();
case Absyn.R_PREDEFINED_INTEGER() equation Print.printBuf("Absyn.R_PREDEFINED_INTEGER"); then ();
case Absyn.R_PREDEFINED_REAL() equation Print.printBuf("Absyn.R_PREDEFINED_REAL"); then ();
case Absyn.R_PREDEFINED_STRING() equation Print.printBuf("Absyn.R_PREDEFINED_STRING"); then ();
case Absyn.R_PREDEFINED_BOOLEAN() equation Print.printBuf("Absyn.R_PREDEFINED_BOOLEAN"); then ();
case Absyn.R_PREDEFINED_ENUMERATION() equation Print.printBuf("Absyn.R_PREDEFINED_ENUMERATION"); then ();
case _ then ();
case Absyn.R_UNIONTYPE() equation Print.printBuf("Absyn.R_UNIONTYPE"); then ();
case _ equation Print.printBuf("/* UNKNOWN RESTRICTION! FIXME! */"); then ();
end matchcontinue;
end printClassRestriction;

Expand Down
3 changes: 2 additions & 1 deletion Compiler/FrontEnd/Inline.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,8 @@ algorithm
then body;
case(_,_)
equation
Debug.fprintln(Flags.FAILTRACE, "Inline.getFunctionBody failed");
true = Flags.isSet(Flags.FAILTRACE);
Debug.traceln("Inline.getFunctionBody failed for function: " +& Absyn.pathString(p));
// Error.addMessage(Error.INTERNAL_ERROR, {"Inline.getFunctionBody failed"});
then
fail();
Expand Down
19 changes: 14 additions & 5 deletions Compiler/FrontEnd/SCodeAnalyseRedeclare.mo
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,15 @@ algorithm
modifications = smod,
info = info), _, _, _, _, _, _)
equation
// Look up the class of the component.
// Look up the class of the component.
// print("Looking up: " +& Absyn.pathString(tpath) +& " for component: " +& name +& "\n");
(item, tpath, env) = SCodeLookup.lookupClassName(tpath, inEnv, info);
tpath = SCodeEnv.mergePathWithEnvPath(tpath, env);
false = listMember(tpath, inInstStack);
false = List.applyAndFold1(inInstStack, boolOr, Absyn.pathEqual, tpath, false);

// add it
ii = tpath::inInstStack;

(item, env, previousItem) = SCodeEnv.resolveRedeclaredItem(item, env);

prefix = InstUtil.addPrefix(name, {}, inPrefix);
Expand All @@ -614,7 +619,10 @@ algorithm
redecls = SCodeFlattenRedeclare.extractRedeclaresFromModifier(smod);
(item, env, replacements) = SCodeFlattenRedeclare.replaceRedeclaredElementsInEnv(redecls, item, env, inEnv, inPrefix);

(islist, ii) = analyseItem(item, env, mod, prefix, emptyIScopes, inInstStack);
(islist, ii) = analyseItem(item, env, mod, prefix, emptyIScopes, ii);

// remove it
ii = inInstStack;

comp = inElement;
comp = SCode.setComponentTypeSpec(comp, Absyn.TPATH(tpath, ad));
Expand Down Expand Up @@ -643,7 +651,8 @@ algorithm
prefixes = SCode.PREFIXES(replaceablePrefix = _ /*SCode.REPLACEABLE(_)*/)), _, _, _, _, _, _)
equation
fullName = SCodeEnv.mergePathWithEnvPath(Absyn.IDENT(name), inEnv);
false = listMember(fullName, inInstStack);
// print("Looking up CLASS: " +& Absyn.pathString(fullName) +& "\n");
false = List.applyAndFold1(inInstStack, boolOr, Absyn.pathEqual, fullName, false);
// add it
ii = fullName::inInstStack;

Expand All @@ -653,7 +662,7 @@ algorithm
(islist, ii) = analyseItem(item, env, inClassMod, inPrefix, {}, ii);

// remove it
ii = inInstStack;
ii = inInstStack;

infos = mkInfos(listAppend(previousItem,inPreviousItem), {EI(inElement, env)});

Expand Down

0 comments on commit 8b72b30

Please sign in to comment.