Opened 8 years ago
Closed 7 years ago
#4153 closed defect (fixed)
Diff algorithm failure
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | critical | Milestone: | 1.12.0 |
Component: | Parser | Version: | |
Keywords: | Cc: | Adeel Asghar |
Description
Diff algorithm fails for the following example (should just be changing a text annotation in OMEdit)
diffModelicaFileListings("within Modelica_DeviceDrivers.EmbeddedTargets.AVR.Blocks;\nblock Microcontroller \"Use as an inner block, defining the characteristics of the AVR microcontroller\"\n import Modelica.SIunits;\n import Modelica_DeviceDrivers;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Types;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Constants;\n extends Modelica_DeviceDrivers.Utilities.Icons.GenericIC;\n parameter Types.Platform platform annotation(Evaluate=true);\n parameter SIunits.Frequency cpuFrequency = Constants.frequencyLookup[platform] \"Default frequency is the platform default (can be modified)\" annotation(Evaluate=true);\nannotation(defaultComponentName = \"mcu\", missingInnerMessage = \"Missing inner block for AVR microcontroller (this cannot have default values since the microcontrollers are all different).\");\n annotation(Icon(graphics = {Text(origin = {32, -3}, lineColor = {255, 255, 255}, extent = {{-44, 19}, {-20, -13}}, textString = \"AVR\", fontSize = 70, fontName = \"Arial\", textStyle = {TextStyle.Bold})}, coordinateSystem(initialScale = 0.1)));\nend Microcontroller;", "within Modelica_DeviceDrivers.EmbeddedTargets.AVR.Blocks;\n\nblock Microcontroller \"Use as an inner block, defining the characteristics of the AVR microcontroller\"\n import Modelica.SIunits;\n import Modelica_DeviceDrivers;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Types;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Constants;\n extends Modelica_DeviceDrivers.Utilities.Icons.GenericIC;\n parameter Types.Platform platform annotation(Evaluate = true);\n parameter SIunits.Frequency cpuFrequency = Constants.frequencyLookup[platform] \"Default frequency is the platform default (can be modified)\" annotation(Evaluate = true);\n import Modelica.SIunits;\n import Modelica_DeviceDrivers;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Types;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Constants;\n extends Modelica_DeviceDrivers.Utilities.Icons.GenericIC;\n parameter Types.Platform platform annotation(Evaluate = true);\n parameter SIunits.Frequency cpuFrequency = Constants.frequencyLookup[platform] \"Default frequency is the platform default (can be modified)\" annotation(Evaluate = true);\n import Modelica.SIunits;\n import Modelica_DeviceDrivers;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Types;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Constants;\n extends Modelica_DeviceDrivers.Utilities.Icons.GenericIC;\n parameter Types.Platform platform annotation(Evaluate = true);\n parameter SIunits.Frequency cpuFrequency = Constants.frequencyLookup[platform] \"Default frequency is the platform default (can be modified)\" annotation(Evaluate = true);\n import Modelica.SIunits;\n import Modelica_DeviceDrivers;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Types;\n import Modelica_DeviceDrivers.EmbeddedTargets.AVR.Constants;\n extends Modelica_DeviceDrivers.Utilities.Icons.GenericIC;\n parameter Types.Platform platform annotation(Evaluate = true);\n parameter SIunits.Frequency cpuFrequency = Constants.frequencyLookup[platform] \"Default frequency is the platform default (can be modified)\" annotation(Evaluate = true);\n annotation(Icon(graphics = {Text(origin = {32, -3}, lineColor = {255, 255, 255}, extent = {{-44, 19}, {-20, -13}}, textString = \"AVR\\n%platform\", fontSize = 70, fontName = \"Arial\", textStyle = {TextStyle.Bold})}, coordinateSystem(initialScale = 0.1)), defaultComponentName = \"mcu\", missingInnerMessage = \"Missing inner block for AVR microcontroller (this cannot have default values since the microcontrollers are all different).\");\nend Microcontroller;", OpenModelica.Scripting.DiffFormat.plain)
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Cc: | added |
---|---|
Status: | new → accepted |
The result will be a merged class annotation in this case (which is good), but with lost formatting on the annotation (which I guess is acceptable).
comment:3 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:4 by , 7 years ago
Milestone: | 1.12.0 → 1.13.0 |
---|
Milestone moved to 1.13.0 due to 1.12.0 already being released.
comment:5 by , 7 years ago
Milestone: | 1.13.0 → 1.12.0 |
---|---|
Resolution: | → fixed |
Status: | accepted → closed |
This was fixed before (note that if you run the code above it looks like the same import statement is being added multiple times; this is note a problem with the API but is a problem with the input in the ticket).
This error occurs because OMEdit makes the file illegal according to Modelica 3 (inserted an extra annotation section somewhere, and I don't have the sequence of calls that caused this; I'll make the diff algorithm handle this case, but it might not always work since the code in some places assumes there is only one annotation for a class).