Skip to content

Commit

Permalink
- Removed support for sum(scalar) as it is not valid Modelica
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9707 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Aug 29, 2011
1 parent 36e007d commit bcd8948
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -735,7 +735,7 @@ algorithm
tp1 = Debug.bcallret1(sc,Expression.unliftArray,tp1,tp1);
tp1 = Debug.bcallret2(sc,Expression.liftArrayLeft,tp1,DAE.DIM_UNKNOWN(),tp1);
dim = listLength(es);
tp1 = Expression.liftArrayLeft(tp1,DAE.DIM_EXP(DAE.ICONST(dim)));
tp1 = Expression.liftArrayLeft(tp1,DAE.DIM_INTEGER(dim));
e = DAE.ARRAY(tp1,sc,es);
e = Expression.makeBuiltinCall("sum",{e},tp2);
// print("Matrix sum: " +& boolString(sc) +& ExpressionDump.typeString(tp1) +& " " +& ExpressionDump.printExpStr(e) +& "\n");
Expand All @@ -749,7 +749,7 @@ algorithm
tp1 = Debug.bcallret1(sc,Expression.unliftArray,tp1,tp1);
tp1 = Debug.bcallret2(sc,Expression.liftArrayLeft,tp1,DAE.DIM_UNKNOWN(),tp1);
dim = listLength(es);
tp1 = Expression.liftArrayLeft(tp1,DAE.DIM_EXP(DAE.ICONST(dim)));
tp1 = Expression.liftArrayLeft(tp1,DAE.DIM_INTEGER(dim));
e = DAE.ARRAY(tp1,sc,es);
e = Expression.makeBuiltinCall("sum",{e},tp2);
// print("Array sum: " +& boolString(sc) +& ExpressionDump.typeString(tp1) +& " " +& ExpressionDump.printExpStr(e) +& "\n");
Expand Down
18 changes: 0 additions & 18 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -3631,24 +3631,6 @@ algorithm
DAE.ExpType etp;
list<Absyn.Exp> aexps;

case (cache,env,{arrexp},_,impl,pre,info) /* impl */
equation
(cache,exp_1,DAE.PROP(ty,c),_) = elabExp(cache,env, arrexp, impl,NONE(),true,pre,info);
(exp_1,ty2) = Types.matchType(exp_1, ty, DAE.T_INTEGER_DEFAULT, true);
str_exp = "sum(" +& Dump.printExpStr(arrexp) +& ")";
str_pre = PrefixUtil.printPrefixStr3(pre);
Error.addSourceMessage(Error.BUILTIN_FUNCTION_SUM_HAS_SCALAR_PARAMETER, {str_exp, str_pre}, info);
then
(cache,exp_1,DAE.PROP(DAE.T_INTEGER_DEFAULT,c));
case (cache,env,{arrexp},_,impl,pre,info) /* impl */
equation
(cache,exp_1,DAE.PROP(ty,c),_) = elabExp(cache,env, arrexp, impl,NONE(),true,pre,info);
(exp_1,ty2) = Types.matchType(exp_1, ty, DAE.T_REAL_DEFAULT, true);
str_exp = "sum(" +& Dump.printExpStr(arrexp) +& ")";
str_pre = PrefixUtil.printPrefixStr3(pre);
Error.addSourceMessage(Error.BUILTIN_FUNCTION_SUM_HAS_SCALAR_PARAMETER, {str_exp, str_pre}, info);
then
(cache,exp_1,DAE.PROP(DAE.T_REAL_DEFAULT,c));
case (cache,env,aexps,_,impl,pre,info)
equation
arrexp = Util.listFirst(aexps);
Expand Down

0 comments on commit bcd8948

Please sign in to comment.