Opened 5 years ago

Closed 5 years ago

#5666 closed defect (fixed)

OMEdit propose invalid identifier for Constant block

Reported by: sergniko@… Owned by: Adeel Asghar
Priority: blocker Milestone: 1.14.0
Component: OMEdit Version: v1.14.0-dev-nightly
Keywords: Cc:

Description

I have noticed that OMEdit (OpenModelica v1.14.0-dev-26754-g0218247f06 (64-bit) on Windows 7) is now proposing invalid identifier for Constant block now.
Before there are no such thing. (Checked in v1.13 on Ubuntu).

Way to reproduce:

  1. Create new class
  2. Drag a constant block an accept proposed name - const
  3. Drag another constant block - OMEdit proposing constant instead of const2 as it was before.

Same result if you create any block and name it const. Afterward a new Constant block - constant is proposed again.

Change History (5)

comment:1 by Adrian Pop, 5 years ago

This is a recent change:
https://github.com/OpenModelica/OpenModelica/commit/66641cb7051c20446b710f2cb5ac2219de7a9753
@adeas31: we need to filter out keywords.

comment:2 by Adeel Asghar, 5 years ago

Milestone: Future1.14.0
Priority: normalblocker
Status: newaccepted

comment:3 by Francesco Casella, 5 years ago

Of course we need to filter out keywords, but we also need to consider the annotation defaultComponentName.

In this case defaultComponentName="const", so when dragging one should obtain const, then const2, const3, etc.

in reply to:  3 comment:4 by Adeel Asghar, 5 years ago

Replying to casella:

Of course we need to filter out keywords, but we also need to consider the annotation defaultComponentName.

In this case defaultComponentName="const", so when dragging one should obtain const, then const2, const3, etc.

This is exactly what I changed. I thought if we already have a component with default name then we should use the model name for the next component instead of the defaultComponentName annotation.

comment:5 by Adeel Asghar, 5 years ago

Resolution: fixed
Status: acceptedclosed

Fixed in 820af85/OpenModelica.

I have updated according to Francesco's suggestion i.e., use default component name is its present for new name suggestions otherwise use the component name.

It now also checks for Modelica keywords.

Note: See TracTickets for help on using tickets.