Opened 9 years ago

Closed 2 years ago

#1287 closed defect (fixed)

Redeclaration of non-existant component

Reported by: jakesson Owned by: Jesper Mattsson
Priority: major Milestone: Pending
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description (last modified by Tove Bergdahl)

The model

model M
     model A
         type T1 = Real;
         replaceable T1 x;
     end A;

     type T2 = Real(min=0);

     extends A;
     redeclare T2 x;
     redeclare T2 y;
end M;

is flattened into:

fclass M
 Real x(min = 0);
 Real y(min = 0);
 Real x;
end M;

Which is incorrect. The problem is that y does not exist in the base class but no compiler error is given.

Change History (5)

comment:1 Changed 9 years ago by hubertus

Is this correct Modelica at all? In my opinion it should be

model M
     model A
         type T1 = Real;
         replaceable T1 x;
     end A;

     type T2 = Real(min=0);

     extends A(
       redeclare T2 x,
       redeclare T2 y);
end M;

If you want to redeclare the types. I have never seen the form above, but I don't read the spec every day either.

comment:2 Changed 9 years ago by jakesson

I think that this is correct, apart from the redeclaration of y that does not correspond to a replaceable component. This construct is used a lot for functions in Media-like libraries.

comment:3 Changed 8 years ago by Jesper Mattsson

Milestone: 1.6.x
Owner: set to Jesper Mattsson
Status: newassigned

comment:4 Changed 6 years ago by Tove Bergdahl

Description: modified (diff)
Milestone: Pending
Summary: Error in redeclaration when extending classesRedeclaration of non-existant component

comment:5 Changed 2 years ago by Jesper Mattsson

Resolution: fixed
Status: assignedclosed

This is fixed in other ticket.

Note: See TracTickets for help on using tickets.