Opened 15 years ago

Last modified 15 years ago

#1179 closed defect (fixed)

Incomplete propagation of modifications when using type alias

Reported by: Adrian Pop Owned by: Adrian Pop
Priority: high Milestone:
Component: Version:
Keywords: Cc: Adrian Pop, Per Östlund

Description

This model:

model AliasType
  type B = Real[4](each start=2);
  B b(each unit="K");
  parameter Real[4] a = zeros(4);
equation
  b = a;
end AliasType;

is flattened to:

fclass AliasType
Real b[1](unit = "K");
Real b[2](unit = "K");
Real b[3](unit = "K");
Real b[4](unit = "K");
parameter Real a[1] = 0.0;
parameter Real a[2] = 0.0;
parameter Real a[3] = 0.0;
parameter Real a[4] = 0.0;
equation
  b[1] = a[1];
  b[2] = a[2];
  b[3] = a[3];
  b[4] = a[4];
end AliasType;

which is missing the start attribute for elements of b.

The problem appears also when extending from a type alias:

model ExtendedFromAliasType
  type B = Real[4](each start=2);
  type Extra
    extends B(each unit="K");
  end Extra;
  Extra b;
  parameter Real[4] a = zeros(4);
equation
  b = a;
end ExtendedFromAliasType;

flattens to:

fclass ExtendedFromAliasType
Real b[1];
Real b[2];
Real b[3];
Real b[4];
parameter Real a[1] = 0.0;
parameter Real a[2] = 0.0;
parameter Real a[3] = 0.0;
parameter Real a[4] = 0.0;
equation
  b[1] = a[1];
  b[2] = a[2];
  b[3] = a[3];
  b[4] = a[4];
end ExtendedFromAliasType;

which is missing ALL the modifications for elements of b.

Change History (1)

comment:1 by Per Östlund, 15 years ago

Fixed in revision 5210

Note: See TracTickets for help on using tickets.