Skip to content

Commit

Permalink
Add check for using reserved identifiers as components
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23266 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 7, 2014
1 parent 4e9730e commit 6aeb900
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Compiler/FrontEnd/InstVar.mo
Expand Up @@ -129,6 +129,15 @@ the backend. The current implementation doesn't handle cases in which the
output DAE.Type outType;
output ConnectionGraph.ConnectionGraph outGraph;
algorithm
if match inIdent
case "Integer" then true;
case "Real" then true;
case "Boolean" then true;
case "String" then true;
else false; end match then
Error.addSourceMessage(Error.RESERVED_IDENTIFIER, {inIdent}, info);
fail();
end if;
(outCache,outEnv,outIH,outStore,outDae,outSets,outType,outGraph):=
matchcontinue (inCache, inEnv, inIH, inStore, inState, inMod, inPrefix,
inIdent, inClass, inAttributes, inPrefixes, inDimensionLst,
Expand Down
2 changes: 2 additions & 0 deletions Compiler/Util/Error.mo
Expand Up @@ -671,6 +671,8 @@ public constant Message TCOMPLEX_TUPLE_ONE_NAME = MESSAGE(252, TRANSLATION(), NO
Util.gettext("Tuple complex type specifiers need to have more than one type name: %s."));
public constant Message ENUM_DUPLICATES = MESSAGE(253, TRANSLATION(), ERROR(),
Util.gettext("Enumeration has duplicate names: %s in list of names %s."));
public constant Message RESERVED_IDENTIFIER = MESSAGE(254, TRANSLATION(), ERROR(),
Util.gettext("Identifier %s is reserved for the built-in type with the same name."));

public constant Message UNBOUND_PARAMETER_WITH_START_VALUE_WARNING = MESSAGE(499, TRANSLATION(), WARNING(),
Util.gettext("Parameter %s has no value, and is fixed during initialization (fixed=true), using available start value (start=%s) as default value."));
Expand Down

0 comments on commit 6aeb900

Please sign in to comment.