Opened 8 years ago

Closed 7 years ago

#4368 closed defect (fixed)

Failed to merge Modelica text @ comment and newline before equation

Reported by: Jan Kokert Owned by: Martin Sjölund
Priority: high Milestone: maint/1.12
Component: Interactive Environment Version:
Keywords: Internal error After merging the strings comment newline Cc:

Description (last modified by Jan Kokert)

Dear developers,

I noticed, that from time to time OMEdit will shrink my source code together when I manipulate my model graphically. At the beginning, it seemed random, but I narrowed it down to a single issue (took me a while).

The Issue: When a model contains a comment sitting in the very front of the line AND followed by one (or) more newlines (can have white spaces) AND followed by equation (algorithm is fine actually), so this:

  Modelica.Electrical....
// comment at the very beginning and followed by a new line

equation
  connect ...

then the error message will pop up, as soon as you move components in the DiagramView:

[C:/dev/OpenModelica64bit/OMCompiler/Compiler/Script/CevalScriptBackend.mo: 1054:13-1054:204]: Internal error After merging the strings, the semantics changed for some reason (will simply return s2):
s1:
model test 
  Modelica.Electrical.Analog.Basic.Ground ground1 annotation( ... ) 

...

Please find attached the example.

Finally, your code is screwed up (all comment are cluttered and new lines are removed).

Attachments (1)

test.mo (622 bytes ) - added by Jan Kokert 8 years ago.

Download all attachments as: .zip

Change History (7)

by Jan Kokert, 8 years ago

Attachment: test.mo added

comment:1 by Jan Kokert, 8 years ago

Component: FrontendInteractive Environment
Priority: normalhigh

comment:2 by Jan Kokert, 8 years ago

Description: modified (diff)

comment:3 by Adeel Asghar, 8 years ago

Owner: changed from somebody to Martin Sjölund
Status: newassigned

comment:4 by Martin Sjölund, 7 years ago

Smaller example triggering the bug:

diffModelicaFileListings("model test
  M x;
// comment

equation
  connect(a, b);
end test;","model test
  M y;
  // comment
equation
  connect(a, c);
end test;", OpenModelica.Scripting.DiffFormat.color);getErrorString();

Note for myself: triggers in 2 places; fixMoveOperations causes the comment to be duplicated while disabling it causes the comment to be removed...

comment:5 by Martin Sjölund, 7 years ago

https://github.com/OpenModelica/OMCompiler/pull/2099 should fix this issue. Hopefully some of the other tickets as well.

comment:6 by Martin Sjölund, 7 years ago

Milestone: Futuremaint/1.12
Resolution: fixed
Status: assignedclosed
Summary: Internal error After merging the strings... @ comment and newline before equationFailed to merge Modelica text @ comment and newline before equation

Fixed in maint/1.12 and master

Note: See TracTickets for help on using tickets.