@Nullable
  public static PsiElement resolveDeclaration(@NotNull PsiReference reference, @NotNull PyResolveContext resolveContext) {
    final PsiElement element = reference.getElement();

    final var context = resolveContext.getTypeEvalContext();
    final var call = context.maySwitchToAST(element) ? PyCallExpressionNavigator.getPyCallExpressionByCallee(element) : null;
    if (call != null && element instanceof PyTypedElement) {
      final var type = PyUtil.as(context.getType((PyTypedElement)element), PyClassType.class);

      if (type != null && type.isDefinition()) {
        final var cls = type.getPyClass();

        final var constructor = ContainerUtil.find(
          PyUtil.filterTopPriorityElements(PyCallExpressionHelper.resolveImplicitlyInvokedMethods(type, call, resolveContext)),
          it -> it instanceof PyPossibleClassMember && ((PyPossibleClassMember)it).getContainingClass() == cls
        );

        if (constructor != null) {
          return constructor;
        }
      }
    }

    return reference.resolve();
  }
@Nullable
  public static PsiElement resolveDeclaration(@NotNull PsiReference reference, @NotNull PyResolveContext resolveContext)