Opened 16 years ago

Last modified 14 years ago

#1071 closed defect (fixed)

Detect and prevent multiple declarations with the same identifier. (from MathCore)

Reported by: krsta Owned by: krsta
Priority: high Milestone: Red October
Component: Version:
Keywords: Cc: krsta, Adrian Pop

Description

In OpenModelica it possible to have multiple declarations with the same identifier in the same scope without the kernel complaining. For example the model below is accepted by the kernel, and not even when checking the model the error is detected.

model A
 Real x;
 Integer x;
end B;

Change History (5)

comment:2 by AlexeyLebedev, 15 years ago

One could also have a component in a class and an inherited component with the same name but different type:

model A
  Real x;
end A;
model B
  extends A;
  Integer x;
end B}}}
Both forms of the bug fixed in revision 5196.

comment:3 by Peter Aronsson, 14 years ago

Reopen. There are at least two testcases that could be added here. The original in the description, and the one in the comment above. But no testcase is added! What is not tested is not implemented!

comment:4 by Peter Aronsson, 14 years ago

There is still a problem with the Rotational.Examples.Friction model:

Failed

Libraries2.2.1.Modelica.Mechanics.Rotational.Examples.Friction (from Mechanics)
Har fallerat i de senaste 107 byggen (Sedan 'Unstable#736 )
Tog 0.53 sec.
lägg till beskrivning
Felmeddelande

failed

Standard Output

Error: Duplicate elements (due to inherited elements) not identical, first element is: parameter SI.Torque unitTorque = 1;
, second element is: parameter Modelica.SIunits.Torque unitTorque = 1;

Error: Error occured while flattening model Modelica.Mechanics.Rotational.Examples.Friction

"Check of Modelica.Mechanics.Rotational.Examples.Friction failed
"

comment:5 by Adrian Pop, 14 years ago

Fixed in revision 6299. See SCM Commits.

Note: See TracTickets for help on using tickets.