Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3698 closed defect (fixed)

Comment preserving parsing/unparsing creates hidden duplicate declarations

Reported by: casella Owned by: adeas31
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 Changed 9 years ago by adeas31

  • Component changed from *unknown* to OMEdit
  • Owner changed from somebody to adeas31
  • Status changed from new to accepted

comment:2 Changed 9 years ago by adeas31

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in 53f6bfc/OMEdit.

comment:3 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.4-1.9.x

Milestone renamed

comment:4 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4-1.9.x to 1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.