#2348 closed defect (fixed)
Duplicate modification error treated as warning
Reported by: | Henrik Tidefelt | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.4 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: |
Description
The model below is inspired by problems with the MSL example Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMS_Start
:
package DuplicateModification record A "Compare Modelica.Electrical.Machines.Losses.CoreParameters" parameter Integer x "m"; end A; class B1 "Compare Modelica.Electrical.Machines.Utilities.ParameterRecords.AIM_SlipRingData" parameter A a(x = 1) "rotorCoreParameters"; end B1; class B2 "Compare Modelica.Electrical.Machines.BasicMachines.AsynchronousInductionMachines.AIM_SlipRing" parameter A a(final x = 1) "rotorCoreParameters"; end B2; class C "Compare Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMS_Start" B2 b(a = b0.a) "aims"; parameter B1 b0 "aimsData"; end C; end DuplicateModification;
Checking the class C
both gives an error and succeeds at the same time:
Check of DuplicateModification.C completed successfully.
[C:/Documents and Settings/henrikt/My Documents/Models/Bugs/DuplicateModification.mo:9:5-9:53:writable] Error: Variable b.a: Flera modifikationer av element final = (typed)1 DAE.PROP(Integer, C_CONST), value: 1 and = (typed)1 DAE.PROP(Integer, C_CONST), value: 1 i komponent x.
Class DuplicateModification.C has 0 equation(s) and 0 variable(s).
0 of these are trivial equation(s).
It is even possible to simulate the model, so the presence of the error message is very confusing.
Some additional details:
- Changing the class restriction of
A
tomodel
removes the error message. - As far as I can see, the error message is correct according to the language specification (3.3), page 71, 7.2.3 'Merging of Modifications':
Merging of modifiers means that outer modifiers override inner modifiers. The merging is hierarchical, and a value for an entire non-simple overrides value modifiers for all components, and it is an error if this overrides a final prefix for a component.
Change History (11)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
This is a problem with mostly with record bindings.
Inst.makeRecordBinding is a bit wrong and tries to use modifications from all sources which generates this error (that is ignored). Should not be hard to be fix.
comment:3 by , 11 years ago
It would also be nice with a pretty printed error message for modifiers, without things like DAE.PROP(...). Something like, x = <value> of type <type>
comment:5 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
I looked a bit into this but will take some time to fix it.
comment:6 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:7 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
See also: #2349