Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 453e1c7

Browse files
perostOpenModelica-Hudson
authored andcommitted
Fix for OperatorOverloading.makeEnumOperator.
- Change makeEnumOperator so it doesn't return both types when only the second is an enumeration, so that type checking of operations doesn't always succeed as long as the second operand has an enumeration type.
1 parent 9670ad9 commit 453e1c7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Compiler/FrontEnd/OperatorOverloading.mo

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,33 +1183,33 @@ function makeEnumOperator
11831183
input DAE.Type inType2;
11841184
output tuple<DAE.Operator, list<DAE.Type>, DAE.Type> outOp;
11851185
algorithm
1186-
outOp := matchcontinue(inOp, inType1, inType2)
1186+
outOp := matchcontinue(inType1, inType2)
11871187
local
11881188
DAE.Type op_ty;
11891189
DAE.Operator op;
11901190

1191-
case (_, DAE.T_ENUMERATION(), DAE.T_ENUMERATION())
1191+
case (DAE.T_ENUMERATION(), DAE.T_ENUMERATION())
11921192
equation
11931193
op_ty = Types.simplifyType(inType1);
11941194
op = Expression.setOpType(inOp, op_ty);
1195-
then ((op, {inType1, inType2}, DAE.T_BOOL_DEFAULT));
1195+
then
1196+
((op, {inType1, inType2}, DAE.T_BOOL_DEFAULT));
11961197

1197-
case (_, DAE.T_ENUMERATION(), _)
1198+
case (DAE.T_ENUMERATION(), _)
11981199
equation
11991200
op_ty = Types.simplifyType(inType1);
12001201
op = Expression.setOpType(inOp, op_ty);
12011202
then
12021203
((op, {inType1, inType1}, DAE.T_BOOL_DEFAULT));
12031204

1204-
case (_, _, DAE.T_ENUMERATION())
1205+
case (_, DAE.T_ENUMERATION())
12051206
equation
1206-
op_ty = Types.simplifyType(inType1);
1207+
op_ty = Types.simplifyType(inType2);
12071208
op = Expression.setOpType(inOp, op_ty);
12081209
then
1209-
((op, {inType1, inType2}, DAE.T_BOOL_DEFAULT));
1210+
((op, {inType2, inType2}, DAE.T_BOOL_DEFAULT));
12101211

1211-
else
1212-
then ((inOp, {DAE.T_ENUMERATION_DEFAULT, DAE.T_ENUMERATION_DEFAULT}, DAE.T_BOOL_DEFAULT));
1212+
else ((inOp, {DAE.T_ENUMERATION_DEFAULT, DAE.T_ENUMERATION_DEFAULT}, DAE.T_BOOL_DEFAULT));
12131213
end matchcontinue;
12141214
end makeEnumOperator;
12151215

0 commit comments

Comments
 (0)