Opened 3 years ago

# Range expression problems

Reported by: Owned by: Jonathan Kämpe Jonathan Kämpe major Modelica/FrontEnd trunk

### Description

There seems to be some issues with range expressions for unknown size and non-numeric type

```function f
input Boolean b;
output Boolean y[:] = false:b;
algorithm
end f;

Boolean[:] b = f(true);
```
```function f
input Boolean b;
output Boolean y[:] = b:b;
algorithm
end f;

Boolean[:] b = f(true);
```

### comment:1 Changed 2 years ago by Jonathan Kämpe

Flattened:

``` function Test.Test1.f
input Boolean b;
output Boolean[:] y;
algorithm
init y as Boolean[max(integer((if b then 2 else 1) - 1) + 1, 0)];
y := false:b;
return;
end Test.Test1.f;
```

Scalarized

``` function Test.Test1.f
input Boolean b;
output Boolean[:] y;
algorithm
init y as Boolean[max(integer((if b then 2 else 1) - 1) + 1, 0)];
for i1 in 1:max(integer((if b then 2 else 1) - (if false then 2 else 1)) + 1, 0) loop
y[i1] := false + (i1 - 1);
end for;
return;
end Test.Test1.f;
```
Note: See TracTickets for help on using tickets.