Opened 6 years ago

Closed 3 years ago

#3597 closed defect (fixed)

For indices non-integer types

Reported by: Jonathan Kämpe Owned by: Jonathan Kämpe
Priority: major Milestone: 2.0.x
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description (last modified by Jonathan Kämpe)

For indices of non-integer types should be supported.

model Test
    type ShirtSizes = enumeration(small, medium, large, xlarge);
    ShirtSizes[ShirtSizes] w;
equation
    for i in ShirtSizes loop
        w[i] = i;
    end for;
end Test;

Change History (7)

comment:1 Changed 6 years ago by Jonathan Kämpe

Description: modified (diff)

comment:2 Changed 3 years ago by Jesper Mattsson

Description: modified (diff)

While doing this, also handle this case (see #5146):

model Test
    type ShirtSizes = enumeration(small, medium, large, xlarge);
    ShirtSizes[ShirtSizes] w;
equation
    for i loop
        w[i] = i;
    end for;
end Test;

comment:3 Changed 3 years ago by Jonathan Kämpe

Apparently, we don't handle reals either. It just happens to work in most cases.

    function f
        input Real[:] xs1;
        input Real[:] xs2;
        output Real y;
    algorithm
        y := 0;
        for x1 in xs1, x2 in xs2 loop
            y := x1 + x2;
        end for;
    end f;
    
    constant Real y = f({0.5},{0.5});

comment:4 Changed 3 years ago by Jonathan Kämpe

Milestone: Future1.18.x
Summary: For indices of boolean and enumeration types.For indices non-integer types

comment:5 Changed 3 years ago by Jonathan Kämpe

Description: modified (diff)

comment:6 Changed 3 years ago by Jonathan Kämpe

changeset:9596

Fixed type calculation for real for indices

comment:7 Changed 3 years ago by Jonathan Kämpe

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.