GroovyResolveResult[] (@NotNull GrReferenceExpressionImpl ref, boolean incomplete) { if (incomplete) { return resolveIncomplete(ref).toArray(GroovyResolveResult.EMPTY_ARRAY); } final GroovyReference rValueRef = ref.getRValueReference(); final GroovyReference lValueRef = ref.getLValueReference(); if (rValueRef != null && lValueRef != null) { // merge results from both references final Map<PsiElement, GroovyResolveResult> results = new HashMap<>(); for (GroovyResolveResult result : rValueRef.resolve(false)) { results.putIfAbsent(result.getElement(), result); } for (GroovyResolveResult result : lValueRef.resolve(false)) { results.putIfAbsent(result.getElement(), result); } return results.values().toArray(GroovyResolveResult.EMPTY_ARRAY); } else if (rValueRef != null) { // r-value only return rValueRef.resolve(false).toArray(GroovyResolveResult.EMPTY_ARRAY); } else if (lValueRef != null) { // l-value only return lValueRef.resolve(false).toArray(GroovyResolveResult.EMPTY_ARRAY); } else { LOG.error("Reference expression has no references"); return GroovyResolveResult.EMPTY_ARRAY; } }