private @Nullable PsiType getMethodReferenceType(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;
  }
private @Nullable PsiType getMethodReferenceType(PsiElement completion)