Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression issues with final modifiers in replaceable class definitions #11964

Closed
abuntrock opened this issue Feb 8, 2024 · 6 comments
Closed
Assignees
Labels
COMP/GUI/OMEdit Issue and pull request related to OMEdit regression
Milestone

Comments

@abuntrock
Copy link

abuntrock commented Feb 8, 2024

Description

I discovered some problems with the handling of final modifications in replaceable class defintions in OMEdit 1.22.1 (and in todays nightly v1.23.0-dev-297-g308aba5ec2), which were already fixed (or not yet present) in OMEdit 1.22.0.

Steps to Reproduce

  1. Take the following modelica package:
package FinalModifierReplaceable
    model ClassWithInstance
     TopLevelClass topLevelClass
     annotation(Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  end ClassWithInstance;

  model TopLevelClass
    parameter Real realParam = 5;
    parameter Boolean boolParam1 = false;
    parameter Boolean boolParam2 = false annotation (choices(checkBox=true));
     replaceable FinalModifierReplaceable.SubLevel1 replModel(
     final realParam = realParam,
     final boolParam1 = boolParam1,
     final boolParam2 = boolParam2)
    annotation(choices(choice( redeclare FinalModifierReplaceable.SubLevel1 replModel "Some description")));
  end TopLevelClass;

  model SubLevel1
    parameter Real realParam = 5;
    parameter Boolean boolParam1 = false;
    parameter Boolean boolParam2 = false annotation (choices(checkBox=true));
    parameter Real sublevelParameter = 5;
  end SubLevel1;
end FinalModifierReplaceable;
  1. Open the class ClassWithInstance and open the parameter dialog of topLevelClass.
  2. Open the replaceable subdialog topLevelClass.replModel via the edit button. Here the first problem appears. All the parameters which are set to final in the replaceable defintion of replModel in TopLevelClass. This is the same problem as reported here Final modifier for parameter dialog of redeclared classes #10394, which was fixed for version 1.22.0.
  3. Close the replaceable subdialog via the "OK" button again. The following error appears:
    [FinalModifierReplaceable: 12:128-12:151]: [Trying to override final element boolParam2 with modifier '= false'.](omeditmessagesbrowser:///FinalModifierReplaceable?lineNumber=12)
    The text layer of of ClassWithInstance now looks like this:
model ClassWithInstance
 TopLevelClass topLevelClass(replModel(final boolParam2 = false))
 annotation(Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
end ClassWithInstance;
  1. Somehow the value of boolParam2 is overwritten. It seems to depend on the existence of the choices(checkBox=true) annotation because the value of boolParam1 is not overwritten.

Expected Behavior

  1. Final parameters are not shown in the replaceable sub-dialog as already fixed for 1.22.0 in Final modifier for parameter dialog of redeclared classes #10394.
  2. Boolean parameters with a checkbox annotation are not overwritten by opening the replaceable class sub-dialog.

Version and OS

  • OpenModelica Version: 1.22.1 and v1.23.0-dev-297-g308aba5ec2 (nightly from 8.2.2024)
  • OS: Windows 10, 64 bit

This is really important for us because it makes a lot of out parameterized models unusable in OMEdit 1.22.1.
Thanks for looking into this
Aaron Buntrock - Bosch Rexroth

@adeas31 adeas31 self-assigned this Feb 8, 2024
@adeas31 adeas31 added this to the 1.22.2 milestone Feb 8, 2024
@casella
Copy link
Contributor

casella commented Feb 13, 2024

@abuntrock we are going to release 1.22.2 because it has some critical fixes. We'll make a 1.22.3 release in 2-3 weeks addressing this issue.

@casella casella modified the milestones: 1.22.2, 1.22.3 Feb 13, 2024
@abuntrock
Copy link
Author

Sounds good. Thanks for keeping us updated @casella

@adeas31
Copy link
Member

adeas31 commented Feb 22, 2024

@abuntrock PR #12022 fixes this issue. Test this with tomorrow's nightly build.

@casella casella added this to In progress in Improvements for BR Feb 22, 2024
@abuntrock
Copy link
Author

I tested this with todays nightly and it looks like expected and as it was in 1.22.0. Thank you very much. We would be very happy to see this in a possible 1.22.3 version to combine the performance advantages made for 1.22.2 with the correct look of the subdialog.

Improvements for BR automation moved this from In progress to Done Feb 23, 2024
@casella
Copy link
Contributor

casella commented Feb 23, 2024

I tested this with todays nightly and it looks like expected and as it was in 1.22.0. Thank you very much. We would be very happy to see this in a possible 1.22.3 version to combine the performance advantages made for 1.22.2 with the correct look of the subdialog.

No problem, @adeas31 can you please port #12022 to maintenance/v1.22?

@adeas31
Copy link
Member

adeas31 commented Feb 23, 2024

Fixed with #12022 and ported to maintenance/v1.22 with #12026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/GUI/OMEdit Issue and pull request related to OMEdit regression
Projects
Development

No branches or pull requests

3 participants