PsiType (PsiElement completion) { PsiElement parent = myElement.getParent(); if (completion instanceof PsiMethod && parent instanceof PsiMethodReferenceExpression) { PsiType matchingType = ContainerUtil.find(myExpectedGroundTypes.getValue(), candidate -> candidate != null && hasSuitableType((PsiMethodReferenceExpression)parent, (PsiMethod)completion, candidate)); return matchingType != null ? matchingType : new PsiMethodReferenceType((PsiMethodReferenceExpression)parent); } return null; }