Opened 15 years ago

Closed 4 years ago

Last modified 4 years ago

#1126 closed defect (fixed)

Dangling modifier in extends clauses not detected if name exists locally.

Reported by: Jan Brugård Owned by: Jan Brugård
Priority: high Milestone: 1.16.0
Component: Frontend Version: trunk
Keywords: Cc:

Description

Example:

model A
end A;

model B
  extends A(p = 2);
  parameter Real p;
end B;

Example above gives NO warning when checking the class, even though there is no variable p declared in class A. This seems to be because the name p is also used in class B and the check is done after flattening the inheritance hierarchy. If we change the local name to q in class B we will get a warning. See below:

model A
end A;

model B
  extends A(p = 2);
  parameter Real q;
end B;
Check of B failed
Error: In modifier (p = 2), class or component p not found in <B>
Error: Error occured while flattening model B

Here we can see that the error message is also very misleading due to the check being done after flattening. The error message refers to class B and not the inherited class A.

Change History (4)

comment:2 by Per Östlund, 10 years ago

Cc: Jan Brugård removed
Component: Frontend
Milestone: Future
Version: trunk

Still an issue, since we handle extends incorrectly.

comment:3 by Per Östlund, 4 years ago

Resolution: fixed
Status: newclosed

This is handled correctly by the new frontend, and the old frontend will not be fixed since it's too broken in this regard.

comment:4 by Francesco Casella, 4 years ago

Milestone: Future1.16.0
Note: See TracTickets for help on using tickets.