Opened 5 years ago

Closed 5 years ago

#5666 closed defect (fixed)

OMEdit propose invalid identifier for Constant block

Reported by: sergniko@… Owned by: adeas31
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 Changed 5 years ago by adrpo

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

comment:2 Changed 5 years ago by adeas31

  • Milestone changed from Future to 1.14.0
  • Priority changed from normal to blocker
  • Status changed from new to accepted

comment:3 follow-up: Changed 5 years ago by 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.

comment:4 in reply to: ↑ 3 Changed 5 years ago by adeas31

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 Changed 5 years ago by adeas31

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

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.