Skip to content

Commit

Permalink
- Added error message when a TCOMPLEX type has the wrong number of types
Browse files Browse the repository at this point in the history
- Fixed one such error in Patternm.mo


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7019 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 14, 2010
1 parent 10a482d commit 705caf2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Compiler/Error.mo
Expand Up @@ -652,7 +652,7 @@ protected constant list<tuple<Integer, MessageType, Severity, String>> errorTabl
(META_NONE_CREF,TRANSLATION(),ERROR(),"NONE is not acceptable syntax. Use NONE() instead."),
(META_INVALID_PATTERN_NAMED_FIELD,TRANSLATION(),ERROR(),"Invalid named fields: %s"),
(META_INVALID_LOCAL_ELEMENT,TRANSLATION(),ERROR(),"Only components are allowed in local declarations, got: %s"),
(META_INVALID_COMPLEX_TYPE,TRANSLATION(),ERROR(),"Invalid complex type name: %s<...>"),
(META_INVALID_COMPLEX_TYPE,TRANSLATION(),ERROR(),"Invalid complex type name: %s"),
(META_DECONSTRUCTOR_NOT_PART_OF_UNIONTYPE,TRANSLATION(),ERROR(),"%s is not part of uniontype %s"),
(META_TYPE_MISMATCH_PATTERN,TRANSLATION(),ERROR(),"Type mismatch in pattern\nactual type:\n %s\nexpected type:\n %s"),
(META_DECONSTRUCTOR_NOT_RECORD,TRANSLATION(),ERROR(),"Call pattern is not a record deconstructor %s"),
Expand Down
7 changes: 4 additions & 3 deletions Compiler/Inst.mo
Expand Up @@ -3435,6 +3435,7 @@ algorithm
Absyn.ElementAttributes DA;
Absyn.Path fq_class;
DAE.Type ty;
Absyn.TypeSpec tSpec;

// This rule describes how to instantiate a class definition
// that extends a basic type. (No equations or algorithms allowed)
Expand Down Expand Up @@ -3788,12 +3789,12 @@ algorithm
then fail();

case (cache,env,ih,store,mods,pre,csets,ci_state,className,
SCode.DERIVED(typeSpec=Absyn.TCOMPLEX(path=cn),modifications=mod),
SCode.DERIVED(typeSpec=tSpec as Absyn.TCOMPLEX(path=cn,typeSpecs=tSpecs),modifications=mod),
re,prot,inst_dims,impl,_,graph,instSingleCref,info,stopInst)
equation
true = RTOpts.acceptMetaModelicaGrammar();
false = listMember(Absyn.pathString(cn), {"tuple","array","Option","list"});
cns = Absyn.pathString(cn);
false = listMember((Absyn.pathString(cn),listLength(tSpecs)==1), {("tuple",false),("array",true),("Option",true),("list",true)});
cns = Dump.unparseTypeSpec(tSpec);
Error.addSourceMessage(Error.META_INVALID_COMPLEX_TYPE, {cns}, info);
then fail();

Expand Down
2 changes: 1 addition & 1 deletion Compiler/Patternm.mo
Expand Up @@ -774,7 +774,7 @@ protected function addLocalDecls
input Boolean impl;
input Absyn.Info info;
output Env.Cache outCache;
output Option<Env.Env,DAE.DAElist> tpl;
output Option<tuple<Env.Env,DAE.DAElist>> tpl;
algorithm
(outCache,tpl) := matchcontinue (cache,env,els,scopeName,impl,info)
local
Expand Down

0 comments on commit 705caf2

Please sign in to comment.