@@ -328,12 +328,15 @@ protected
328328 Real r1, r2, r3;
329329 Boolean b1, b2;
330330 list< Expression > exps;
331+ list< String > literals;
332+ Type enumType;
331333algorithm
332334 step := match (optStep, ty)
333335 case (SOME (step),_) then step;
334336 case (_,Type . ARRAY (elementType= Type . INTEGER ())) then Expression . INTEGER (1 );
335337 case (_,Type . ARRAY (elementType= Type . REAL ())) then Expression . REAL (1 . 0 );
336338 case (_,Type . ARRAY (elementType= Type . BOOLEAN ())) then Expression . INTEGER (1 ); // dummy
339+ case (_,Type . ARRAY (elementType= Type . ENUMERATION ())) then Expression . INTEGER (1 ); // dummy
337340 else
338341 algorithm
339342 Error . assertion(false , getInstanceName() + " failed to type: " + Type . toString(ty), sourceInfo());
@@ -352,6 +355,10 @@ algorithm
352355 algorithm
353356 exps := list(Expression . BOOLEAN (b) for b in ExpressionSimplify . simplifyRangeBool(b1, b2));
354357 then Expression . ARRAY (Type . ARRAY (Type . BOOLEAN (), {Dimension . fromInteger(listLength(exps))}), exps);
358+ case (Expression . ENUM_LITERAL (ty= enumType as Type . ENUMERATION (literals= literals), index= i1),_,Expression . ENUM_LITERAL (index= i2))
359+ algorithm
360+ exps := list(Expression . ENUM_LITERAL (enumType, listGet(literals, i), i) for i in i1:i2);
361+ then Expression . ARRAY (Type . ARRAY (enumType, {Dimension . fromInteger(listLength(exps))}), exps);
355362 else
356363 algorithm
357364 Error . assertion(false , getInstanceName() + " failed to type: " + Type . toString(ty), sourceInfo());
0 commit comments