Feature/create new i dot targets for enumerations #1827#1846
Conversation
…w-IDotTargets-for-enumerations-#1827
arimer
left a comment
There was a problem hiding this comment.
Please also update the changelog.
…ts-for-enumerations-#1827
|
@arimer changelog updated |
There was a problem hiding this comment.
I will do the review in several ammended comments.
Metamodel, constraints and behaviour
- Any reasons why AbstractEnumInTarget and AbstractEnumSingleInTarget are not implementing the IDotTarget themselves? I think it would make the API cleaner, especially the behaviour of AbstractEnumInTarget could be simplified
- AbstractEnumSingleInTarget should be abstract
- Constraints from EnumIsTarget and EnumIsNotTarget can be moved to the abstract concept. To be able to do so, you need to move/migrate the Literals link to the super concept. Please use the MPS build in refactorings for that.
- The selectors linkfrom EnumIsInTarget and EnumIsNotInTarget should be moved to AbstractEnumInTarget to reduce duplication. You can use the MPS refactorings to do that and let it generate a migration script
- In case it is still needed (after the proposed changes above), please add comments to singleOp(), compose(), reduce() in the behaviour of AbstractEnumInTarget
- When all links are moved to the super concepts, we can even move all editors to the abtract conecpts to reduce duplictation
Generators
- This is kind of fishyAlthough target is supposed to be an IDotTarget, the AbstractEnumSingleInTarget itself is not implementing that interface. Will be fixed with Metamodel (1) (first commment)

- After moving the links to their abstract super concepts, we do no longer need that behaviour method call
General Remarks
- What did you migrate in migrate commit a2a282e?
- Please squash all your commits to have a clean history
Findings // Bugs (OPTIONAL)
I was trying to update some of the tests and was supprised that I cant refrence any EnumLiterals

It looks like the scoping rule is not good enough, because it can't deal with opts of enumTypes. Either we can try to fix it here, or create an issue for later. This bug appears also for EnumIsInTarget (old concept). This is why that fix is optional
|
Review done. All findings documented in comment above. |
|
Idea: how about we also add a test like to the set of tests |
…w-IDotTargets-for-enumerations-#1827
|
@arimer the migration dialog popped up, then I migrated.The scoping thing can go to another ticket in my opinion. All the common stuff has been moved to the super concepts |
There was a problem hiding this comment.
- We have still some not needed constraints in EnumIsNotTarget
- I dont think we need enumSelectors() any longer
- we should also delete all empty constraint roots for EnumIsInTarget, EnumIsNotInTarget, EnumIsNotTarget, EnumIsTarget
otherwise the changes look good.
|
@arimer rest of issue have been addressed |
Closes #1827
Motivation
org.iets3.core.expr.toplevelalready provides twoIDotTargets for enumerations —is()(EnumIsTarget) andisIn()(EnumIsInTarget) — to check the presence of an enumeration element. Users frequently need the negated checks too, which previously had to be written by hand (e.g.not(x.is(...))). This PR adds first-class negated variants.Changes
org.iets3.core.expr.toplevel): IntroducedisNot()andisNotIn(), the negated versions ofis()andisIn().isNot()— checks that an enumeration element is not equal to another.isNotIn()— checks that an enumeration element is not contained in a list.genjavageneration support forisNot()/isNotIn().test.ts.expr.os) and interpretation (test.in.expr.os.enums) test models to cover the new operators.Testing
Generation and interpreter tests for the enumeration operators were extended and pass.