My question is: can I somehow use generics for the behavior methods return type? Or maybe can I have any workaround for this? I am trying to have a common method that traverses a model tree and searches for a node of a defined type without a lot of redundant casting. But currently, I can't find a solution.
For example, I have two concepts: Event and ImportantEvent. All events are chained (just to provide a simple example for this task):
Then I add some action that traverses the model tree and tries to find some node by type:
Currently, I need to define the "ImportantEvent" concept twice (the second one is a casting) because behavior method works only with concrete concepts:
I see something about "Inference rules" (https://www.jetbrains.com/help/mps/typesystem.html#inferencerules) but it seems to me that this is about something different (at least I don't get how to use it).
So, can anyone suggest a way to avoid additional cast?