Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3698 closed defect (fixed)

Comment preserving parsing/unparsing creates hidden duplicate declarations

Reported by: Francesco Casella Owned by: Adeel Asghar
Priority: blocker Milestone: 1.9.4
Component: OMEdit Version: v1.9.4-dev-nightly
Keywords: Cc:

Description

Instructions to replicate the problem:

  • Start OMEdit and create a new model Test.
  • Add the following lines of code:
    model Test
      Integer N = 2;
      Real x[N](each fixed = true);
    equation
      for i in 1:N loop
        der(x[i]) = -x[i];
      end for;
      annotation(Icon(coordinateSystem(initialScale = 1)), Diagram);
    end Test; 
    
  • Save the model
  • Simulate the model: the compiler correctly complains that dimensions must be parameter or constant expression (in N)
  • add the parameter keyword before Integer
  • Simulate the model: the following message appears:
    Duplicate elements (due to inherited elements) not identical:
    first element is:  Integer N = 2
    second element is: parameter Integer N = 2
    

Note that if you hit Save, the .mo file does not contain any duplicate lines - they only exist in the library loaded in memory. If I unload and reload the model, it compiles correctly.

Change History (4)

comment:1 by Adeel Asghar, 9 years ago

Component: *unknown*OMEdit
Owner: changed from somebody to Adeel Asghar
Status: newaccepted

comment:2 by Adeel Asghar, 9 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in 53f6bfc/OMEdit.

comment:3 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

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

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.