PsiType (PsiType currentType, @NotNull LocalSearchScope localSearchScope) { final PsiElement[] scope = localSearchScope.getScope(); if (scope.length == 1 && scope[0] instanceof PsiIfStatement) { final PsiExpression condition = ((PsiIfStatement)scope[0]).getCondition(); if (condition != null) { PsiInstanceOfExpression[] expressions = PsiTreeUtil.getChildrenOfType(condition, PsiInstanceOfExpression.class); if (expressions != null) { for (PsiInstanceOfExpression instanceOfExpression : expressions) { if (isOfCurrentType(instanceOfExpression, currentType)) return null; } } else if (condition instanceof PsiInstanceOfExpression) { if (isOfCurrentType((PsiInstanceOfExpression)condition, currentType)) return null; } } } return currentType; }