Enhancement
Description
Analog #27530: Currently you can only execute instanceof() on a type literal. In some situations, however, you would still like to check (filter) whether an object is an instance of a type variable (e.g. a selected type).
$object.instanceOf($selectedType)
Workaround
You can determine the type of the object instance and check whether this type corresponds to the type variable or is contained in its subclasses:
{ instanceof = obj -> type -> $obj.type().recursion(t -> $t.get(`tl.model:TLClass#generalizations`)).containsElement($type); $instanceof(new(`DemoTypes:P`, transient:true), `DemoTypes:DemoTypes.All`) }
Test
- com.top_logic.model.search/src/test/java/test/com/top_logic/model/search/expr/TestSearchExpression.java