Skip to content

Feature/create new i dot targets for enumerations #1827#1846

Open
dbinkele wants to merge 41 commits into
maintenance/mps20241from
feature/Create-new-IDotTargets-for-enumerations-#1827
Open

Feature/create new i dot targets for enumerations #1827#1846
dbinkele wants to merge 41 commits into
maintenance/mps20241from
feature/Create-new-IDotTargets-for-enumerations-#1827

Conversation

@dbinkele

@dbinkele dbinkele commented Jun 23, 2026

Copy link
Copy Markdown
Member

Closes #1827

Motivation

org.iets3.core.expr.toplevel already provides two IDotTargets for enumerations — is() (EnumIsTarget) and isIn() (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

  • New concepts (org.iets3.core.expr.toplevel): Introduced isNot() and isNotIn(), the negated versions of is() and isIn().
    • isNot() — checks that an enumeration element is not equal to another.
    • isNotIn() — checks that an enumeration element is not contained in a list.
    • They look and behave exactly like their non-negated counterparts (editor, constraints, type system).
  • Common super concept: Behavior, constraints and type system shared by the negated and non-negated targets were consolidated into a common super concept to remove duplication and simplify the generator.
  • Generator: Added genjava generation support for isNot() / isNotIn().
  • Interpreter: Added interpreter support for both new operators.
  • Tests: Extended the generation (test.ts.expr.os) and interpretation (test.in.expr.os.enums) test models to cover the new operators.
  • CHANGELOG updated.

Testing

Generation and interpreter tests for the enumeration operators were extended and pass.

@arimer arimer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update the changelog.

@dbinkele

Copy link
Copy Markdown
Member Author

@arimer changelog updated

@arimer arimer self-requested a review June 30, 2026 07:51

@arimer arimer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do the review in several ammended comments.

Metamodel, constraints and behaviour

  1. 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
  2. AbstractEnumSingleInTarget should be abstract
  3. 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.
  4. 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
  5. In case it is still needed (after the proposed changes above), please add comments to singleOp(), compose(), reduce() in the behaviour of AbstractEnumInTarget
  6. When all links are moved to the super concepts, we can even move all editors to the abtract conecpts to reduce duplictation

Generators

  1. 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) grafik
  2. After moving the links to their abstract super concepts, we do no longer need that behaviour method call
grafik

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
grafik
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

@arimer

arimer commented Jun 30, 2026

Copy link
Copy Markdown
Member

Review done. All findings documented in comment above.

@arimer

arimer commented Jun 30, 2026

Copy link
Copy Markdown
Member

Idea: how about we also add a test like to the set of tests
grafik

@dbinkele dbinkele requested a review from arimer June 30, 2026 14:31
@dbinkele

Copy link
Copy Markdown
Member Author

@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

@arimer arimer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 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.

@dbinkele

Copy link
Copy Markdown
Member Author

@arimer rest of issue have been addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants