PsiType (@NotNull GrExpression caller, @NotNull PsiMethod method, @NotNull GroovyPsiElement context) { final PsiType type = caller.getType(); if (type instanceof PsiIntersectionType) { final PsiType[] conjuncts = ((PsiIntersectionType)type).getConjuncts(); for (PsiType conjunct : conjuncts) { final GenerationUtil.CheckProcessElement processor = new GenerationUtil.CheckProcessElement(method); ResolveUtil.processAllDeclarations(conjunct, processor, false, context); if (processor.isFound()) return conjunct; } } return type; }