Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Produce a good error-message when a pattern variable is not found in the local scope


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9891 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 21, 2011
1 parent 05d8fa7 commit 2b1497f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Compiler/FrontEnd/Patternm.mo
Expand Up @@ -287,6 +287,18 @@ algorithm
pattern = Util.if_(Types.isFunctionType(ty2), DAE.PAT_AS_FUNC_PTR(id,DAE.PAT_WILD()), DAE.PAT_AS(id,et,DAE.PAT_WILD()));
then (cache,pattern);

case (cache,env,Absyn.AS(id,exp),ty2,info)
equation
failure((_,_,_,_) = Lookup.lookupIdent(cache,env,id));
Error.addSourceMessage(Error.LOOKUP_VARIABLE_ERROR,{id,""},info);
then fail();

case (cache,env,Absyn.CREF(Absyn.CREF_IDENT(id,{})),ty2,info)
equation
failure((_,_,_,_) = Lookup.lookupIdent(cache,env,id));
Error.addSourceMessage(Error.LOOKUP_VARIABLE_ERROR,{id,""},info);
then fail();

case (cache,env,Absyn.CREF(Absyn.WILD()),_,info) then (cache,DAE.PAT_WILD());

case (cache,env,lhs,ty,info)
Expand Down

0 comments on commit 2b1497f

Please sign in to comment.