#2348 closed defect (fixed)
Duplicate modification error treated as warning
Reported by: | henrikt | Owned by: | adrpo |
---|---|---|---|
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 to model 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 Changed 11 years ago by henrikt
comment:2 Changed 11 years ago by adrpo
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 Changed 11 years ago by petar
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:4 Changed 11 years ago by sjoelund.se
- Milestone changed from 1.9.0 to 1.9.1
Postponed until 1.9.1
comment:5 Changed 11 years ago by adrpo
- Owner changed from somebody to adrpo
- Status changed from new to accepted
I looked a bit into this but will take some time to fix it.
comment:6 Changed 10 years ago by sjoelund.se
- Milestone changed from 1.9.1 to 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 Changed 10 years ago by sjoelund.se
- Milestone changed from 1.9.2 to 1.9.3
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:8 Changed 9 years ago by sjoelund.se
- Milestone changed from 1.9.3 to 1.9.4
Moved to new milestone 1.9.4
comment:9 Changed 9 years ago by perost
- Resolution set to fixed
- Status changed from accepted to closed
Fixed in 96a1c78.
comment:10 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.9.4 to 1.9.4-1.9.x
Milestone renamed
comment:11 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.9.4-1.9.x to 1.9.4
Milestone renamed
See also: #2349