Skip to content

Commit

Permalink
- Improved the error messages for bootstrapping slightly
Browse files Browse the repository at this point in the history
- Also fixed some RML/Modelica syntax clashes


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6986 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 12, 2010
1 parent 47eac27 commit c6ee5c0
Show file tree
Hide file tree
Showing 21 changed files with 126 additions and 334 deletions.
2 changes: 1 addition & 1 deletion Compiler/Error.mo
Expand Up @@ -635,7 +635,7 @@ protected constant list<tuple<Integer, MessageType, Severity, String>> errorTabl
(META_CEVAL_FUNCTION_REFERENCE,TRANSLATION(),ERROR(),"Cannot evaluate function pointers (got %s)."),
(NON_INSTANTIATED_FUNCTION,SYMBOLIC(),ERROR(),"Tried to use function %s, but it was not instantiated."),
(GENERIC_INST_FUNCTION,TRANSLATION(),ERROR(),"Failed to instantiate function %s in scope %s"),
(META_UNSOLVED_POLYMORPHIC_BINDINGS,TRANSLATION(),ERROR(),"Could not solve the polymorphism in the function call\n Input bindings:\n%s\n Solved bindings:\n%s\n Unsolved bindings:\n%s"),
(META_UNSOLVED_POLYMORPHIC_BINDINGS,TRANSLATION(),ERROR(),"Could not solve the polymorphism in the function call to %s\n Input bindings:\n%s\n Solved bindings:\n%s\n Unsolved bindings:\n%s"),
(META_RECORD_FOUND_FAILURE,TRANSLATION(),ERROR(),"In metarecord call %s: %s"),
(META_INVALID_PATTERN,TRANSLATION(),ERROR(),"Invalid pattern: %s"),
(META_MATCH_INPUT_OUTPUT_NON_CREF,TRANSLATION(),ERROR(),"Only component references are valid as %s of a match expression. Got %s."),
Expand Down
2 changes: 1 addition & 1 deletion Compiler/HashTable.mo
Expand Up @@ -75,7 +75,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(HashTable2.hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,intString));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(HashTable2.hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,intString));
end emptyHashTableSized;

end HashTable;
2 changes: 1 addition & 1 deletion Compiler/HashTable2.mo
Expand Up @@ -85,7 +85,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,ExpressionDump.printExpStr));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,ExpressionDump.printExpStr));
end emptyHashTableSized;

end HashTable2;
2 changes: 1 addition & 1 deletion Compiler/HashTable3.mo
Expand Up @@ -75,7 +75,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(HashTable2.hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,ComponentReference.printComponentRefListStr));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(HashTable2.hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,ComponentReference.printComponentRefListStr));
end emptyHashTableSized;

end HashTable3;
2 changes: 1 addition & 1 deletion Compiler/HashTable4.mo
Expand Up @@ -86,7 +86,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(hashFunc,Expression.expEqual,ExpressionDump.printExpStr,ComponentReference.printComponentRefStr));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(hashFunc,Expression.expEqual,ExpressionDump.printExpStr,ComponentReference.printComponentRefStr));
end emptyHashTableSized;

end HashTable4;
2 changes: 1 addition & 1 deletion Compiler/HashTable5.mo
Expand Up @@ -84,7 +84,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(hashFunc,Absyn.crefEqual,Dump.printComponentRefStr,intString));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(hashFunc,Absyn.crefEqual,Dump.printComponentRefStr,intString));
end emptyHashTableSized;

end HashTable5;
2 changes: 1 addition & 1 deletion Compiler/HashTable6.mo
Expand Up @@ -106,7 +106,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(hashFunc,keyEqual,printKey,ExpressionDump.printExpStr));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(hashFunc,keyEqual,printKey,ExpressionDump.printExpStr));
end emptyHashTableSized;

end HashTable6;
2 changes: 1 addition & 1 deletion Compiler/HashTableCG.mo
Expand Up @@ -75,7 +75,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(HashTable2.hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,ComponentReference.printComponentRefStr));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(HashTable2.hashFunc,ComponentReference.crefEqual,ComponentReference.printComponentRefStr,ComponentReference.printComponentRefStr));
end emptyHashTableSized;

end HashTableCG;
2 changes: 1 addition & 1 deletion Compiler/HashTableStringToPath.mo
Expand Up @@ -74,7 +74,7 @@ public function emptyHashTableSized
input Integer size;
output HashTable hashTable;
algorithm
hashTable := BaseHashTable.emptyHashTableWork(size,size/10,(stringHashDjb2,stringEq,Util.id,Absyn.pathString));
hashTable := BaseHashTable.emptyHashTableWork(size,intDiv(size,10),(stringHashDjb2,stringEq,Util.id,Absyn.pathString));
end emptyHashTableSized;

end HashTableStringToPath;
28 changes: 14 additions & 14 deletions Compiler/Inst.mo
Expand Up @@ -1373,7 +1373,7 @@ protected function updateDeducedUnits "updates the deduced units in each DAE.VAR
algorithm
outDae := matchcontinue(callScope,store,dae)
local UnitAbsyn.Store st; HashTable.HashTable ht; Integer indx;
Option<UnitAbsyn.Unit>[:] vec;
array<Option<UnitAbsyn.Unit>> vec;
String unitStr;
UnitAbsyn.Unit unit;
Option<DAE.VariableAttributes> varOpt;
Expand Down Expand Up @@ -2178,7 +2178,7 @@ algorithm
instElementList(cache,env_1,ih,store, /* DAE.NOMOD() */ mods, pre, csets, ci_state_1, comp, inst_dims, impl,callscope,graph);

(cache,fq_class) = makeFullyQualified(cache,env_2, Absyn.IDENT(n));
eqConstraint = equalityConstraint(env_2, els);
eqConstraint = equalityConstraint(env_2, els, info);
dae1_1 = DAEUtil.addComponentType(dae1, fq_class);
names = SCode.componentNames(c);
ty2 = (DAE.T_ENUMERATION(NONE(), fq_class, names, tys1, tys),NONE());
Expand Down Expand Up @@ -2961,9 +2961,10 @@ protected function equalityConstraint
corresponding DAE.EqualityConstraint."
input Env.Env inEnv;
input list<SCode.Element> inCdefelts;
input Absyn.Info info;
output DAE.EqualityConstraint outResult;
algorithm
outResult := matchcontinue(inEnv,inCdefelts)
outResult := matchcontinue(inEnv,inCdefelts,info)
local
list<SCode.Element> tail, els;
String name;
Expand All @@ -2976,15 +2977,14 @@ algorithm
DAE.InlineType inlineType;
SCode.Class classDef;

case(env, {})
then NONE();
case(env,{},_) then NONE();
case(env, SCode.CLASSDEF(classDef = classDef as SCode.CLASS(name = "equalityConstraint", restriction = SCode.R_FUNCTION(),
classDef = SCode.PARTS(elementLst = els))) :: _)
classDef = SCode.PARTS(elementLst = els))) :: _, info)
equation
SOME(path) = Env.getEnvPath(env);
path = Absyn.joinPaths(path, Absyn.IDENT("equalityConstraint"));
/*(cache, env,_) = implicitFunctionTypeInstantiation(cache, env, classDef);
(cache, types,_) = Lookup.lookupFunctionsInEnv(cache, env, path);
(cache, types,_) = Lookup.lookupFunctionsInEnv(cache, env, path, info);
length = listLength(types);
print("type count: ");
print(intString(length));
Expand All @@ -2996,8 +2996,8 @@ algorithm
// adrpo: get the inline type of the function
inlineType = isInlineFunc2(classDef);
then SOME((path, dimension, inlineType));
case(env, _ :: tail)
then equalityConstraint(env, tail);
case(env, _ :: tail, info)
then equalityConstraint(env, tail, info);
end matchcontinue;
end equalityConstraint;

Expand Down Expand Up @@ -3319,7 +3319,7 @@ algorithm
// oh, the horror of backtracking! we need this to make sure that this case failed BEFORE or AFTER it went into instBasictypeBaseclass
(cache,ih,store,dae2,bc,tys)= instBasictypeBaseclass(cache, env3, ih, store, extendselts, compelts, mods, inst_dims, info, stopInst);
// Search for equalityConstraint
eqConstraint = equalityConstraint(env, els);
eqConstraint = equalityConstraint(env, els, info);
dae = DAEUtil.joinDaes(dae1,dae2);
then
(cache,env,ih,store,dae,csets1,ci_state,tys,bc,NONE(),eqConstraint,graph);
Expand Down Expand Up @@ -3624,7 +3624,7 @@ algorithm
UnitParserExt.rollback(); // print("rollback for "+&className+&"\n");

// Search for equalityConstraint
eqConstraint = equalityConstraint(env5, els);
eqConstraint = equalityConstraint(env5, els, info);
then
(cache,env5,ih,store,dae,csets5,ci_state6,vars,MetaUtil.fixUniontype(ci_state6,NONE()/* no basictype bc*/,inClassDef6),NONE(),eqConstraint,graph);

Expand Down Expand Up @@ -10437,7 +10437,7 @@ algorithm
outconds = getDeriveCondition(subs,elemDecl,inCache,inEnv,inIH,inPrefix,info);
varPos = setFunctionInputIndex(elemDecl,name,1);
then
(varPos,DAE.ZERO_DERIVATIVE)::outconds;
(varPos,DAE.ZERO_DERIVATIVE())::outconds;

case(SCode.NAMEMOD("noDerivative",(m as SCode.MOD(absynExpOption=_)))::subs,elemDecl,inCache,inEnv,inIH,inPrefix,info)
equation
Expand Down Expand Up @@ -10506,9 +10506,9 @@ algorithm
equation
then (inputVar,DAE.NO_DERIVATIVE(DAE.ICONST(1)));
case(DAE.NAMEMOD(inputVar,mod = DAE.MOD(eqModOption = NONE()))) // zeroderivative
then (inputVar,DAE.ZERO_DERIVATIVE);
then (inputVar,DAE.ZERO_DERIVATIVE());

case(_) then ("",DAE.ZERO_DERIVATIVE);
case(_) then ("",DAE.ZERO_DERIVATIVE());
end matchcontinue;
end extractNameAndExp;

Expand Down
14 changes: 1 addition & 13 deletions Compiler/Interactive.mo
Expand Up @@ -370,19 +370,7 @@ protected function getEcho
if result should be printed or not."
output Boolean outBoolean;
algorithm
outBoolean:=
matchcontinue ()
local
list<Env.Frame> env;
Boolean res;
InteractiveSymbolTable st;
case ()
equation
0 = Settings.getEcho();
then
false;
case () then true;
end matchcontinue;
outBoolean := 0 <> Settings.getEcho();
end getEcho;

public function typeCheckFunction
Expand Down

0 comments on commit c6ee5c0

Please sign in to comment.