@Nullable
  public static PsiType inferReturnType(PsiElement position) {
    final GrControlFlowOwner flowOwner = ControlFlowUtils.findControlFlowOwner(position);
    if (flowOwner == null) return null;

    final PsiElement parent = flowOwner.getContext();
    if (flowOwner instanceof GrOpenBlock && parent instanceof GrMethod method) {
      if (method.isConstructor()) return null;
      return method.getReturnType();
    }

    return null;
  }
@Nullable
  public static PsiType inferReturnType(PsiElement position)