ResolveResult[] (final boolean incompleteCode) { LinkedHashSet<ResolveResult> result = new LinkedHashSet<>(); for (PsiReference reference : myReferences) { if (reference instanceof PsiPolyVariantReference) { for (ResolveResult rr : ((PsiPolyVariantReference)reference).multiResolve(incompleteCode)) { if (rr.isValidResult()) { result.add(rr); } } } else { final PsiElement resolved = reference.resolve(); if (resolved != null) { result.add(new PsiElementResolveResult(resolved)); } } } return result.toArray(ResolveResult.EMPTY_ARRAY); }