Opened 14 years ago

Closed 3 years ago

Last modified 3 years ago

#1126 closed defect (fixed)

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

Reported by: brugard Owned by: brugard
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 Changed 9 years ago by perost

  • Cc brugard removed
  • Component set to Frontend
  • Milestone set to Future
  • Version set to trunk

Still an issue, since we handle extends incorrectly.

comment:3 Changed 3 years ago by perost

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 3 years ago by casella

  • Milestone changed from Future to 1.16.0
Note: See TracTickets for help on using tickets.