Set<PsiElement> (@Nullable final PsiElement element) { final Set<PsiElement> result = new HashSet<>(); final PsiElement elementToProcess = ((element != null) ? element : myFixture.getElementAtCaret()); for (final PsiReference reference : elementToProcess.getReferences()) { final PsiElement directResolve = reference.resolve(); if (directResolve != null) { result.add(directResolve); } if (reference instanceof PsiPolyVariantReference) { for (final ResolveResult resolveResult : ((PsiPolyVariantReference)reference).multiResolve(true)) { result.add(resolveResult.getElement()); } } } return result; }