Skip to content

Commit 68cc076

Browse files
committed
Fix for #1352
- Add error messages for invalid complex types git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6925 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 249ff87 commit 68cc076

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Compiler/Error.mo

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ public constant ErrorID META_STRICT_RML_MATCH_IN_OUT=5016;
284284
public constant ErrorID META_NONE_CREF=5017;
285285
public constant ErrorID META_INVALID_PATTERN_NAMED_FIELD=5018;
286286
public constant ErrorID META_INVALID_LOCAL_ELEMENT=5019;
287+
public constant ErrorID META_INVALID_COMPLEX_TYPE=5020;
287288

288289
protected constant list<tuple<Integer, MessageType, Severity, String>> errorTable=
289290
{(SYNTAX_ERROR,SYNTAX(),ERROR(),"Syntax error near: %s"),
@@ -641,7 +642,8 @@ protected constant list<tuple<Integer, MessageType, Severity, String>> errorTabl
641642
(META_STRICT_RML_MATCH_IN_OUT,TRANSLATION(),ERROR(),"%s. Strict RML enforces match expression input and output to be the same as the function's."),
642643
(META_NONE_CREF,TRANSLATION(),ERROR(),"NONE is not acceptable syntax. Use NONE() instead."),
643644
(META_INVALID_PATTERN_NAMED_FIELD,TRANSLATION(),ERROR(),"Invalid named fields: %s"),
644-
(META_INVALID_LOCAL_ELEMENT,TRANSLATION(),ERROR(),"Only components are allowed in local declarations, got: %s")
645+
(META_INVALID_LOCAL_ELEMENT,TRANSLATION(),ERROR(),"Only components are allowed in local declarations, got: %s"),
646+
(META_INVALID_COMPLEX_TYPE,TRANSLATION(),ERROR(),"Invalid complex type name: %s<...>")
645647

646648
};
647649

Compiler/Inst.mo

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3779,6 +3779,16 @@ algorithm
37793779
true = Mod.emptyModOrEquality(mods) and SCode.emptyModOrEquality(mod);
37803780
Error.addSourceMessage(Error.META_POLYMORPHIC, {className}, info);
37813781
then fail();
3782+
3783+
case (cache,env,ih,store,mods,pre,csets,ci_state,className,
3784+
SCode.DERIVED(typeSpec=Absyn.TCOMPLEX(path=cn),modifications=mod),
3785+
re,prot,inst_dims,impl,_,graph,instSingleCref,info,stopInst)
3786+
equation
3787+
true = RTOpts.acceptMetaModelicaGrammar();
3788+
cns = Absyn.pathString(cn);
3789+
Error.addSourceMessage(Error.META_INVALID_COMPLEX_TYPE, {cns}, info);
3790+
then fail();
3791+
37823792
/* ----------------------- */
37833793

37843794
/* If the class is derived from a class that can not be found in the environment, this rule prints an error message. */
@@ -14842,7 +14852,7 @@ algorithm
1484214852
local
1484314853
Key k;
1484414854
Value v;
14845-
Integer n,pos,len;
14855+
Integer n,len;
1484614856
array<Option<tuple<Key,Value>>> arr;
1484714857
String ps,lens,ns;
1484814858

0 commit comments

Comments
 (0)