boolean (@NotNull final PsiClass trait, @NotNull final PsiElement place) { GrTypeDefinition scopeClass = PsiTreeUtil.getParentOfType(place, GrTypeDefinition.class, true); return scopeClass != null && ContainerUtil.find(scopeClass.getSuperTypes(), type -> place.getManager().areElementsEquivalent(type.resolve(), trait)) != null; }