Ref<PyType> (@NotNull PyFunction function, @NotNull PyCallSiteExpression callSite, @NotNull TypeEvalContext context) { final String qname = function.getQualifiedName(); if (qname != null) { if (OPEN_FUNCTIONS.contains(qname) && callSite instanceof PyCallExpression) { return getOpenFunctionCallType(function, (PyCallExpression)callSite, LanguageLevel.forElement(callSite), context); } else if ("tuple.__new__".equals(qname) && callSite instanceof PyCallExpression) { return getTupleInitializationType((PyCallExpression)callSite, context); } else if ("tuple.__add__".equals(qname) && callSite instanceof PyBinaryExpression) { return getTupleConcatenationResultType((PyBinaryExpression)callSite, context); } else if ("tuple.__mul__".equals(qname) && callSite instanceof PyBinaryExpression) { return getTupleMultiplicationResultType((PyBinaryExpression)callSite, context); } else if ("object.__new__".equals(qname) && callSite instanceof PyCallExpression) { final PyExpression firstArgument = ((PyCallExpression)callSite).getArgument(0, PyExpression.class); final PyClassLikeType classLikeType = as(firstArgument != null ? context.getType(firstArgument) : null, PyClassLikeType.class); return classLikeType != null ? Ref.create(classLikeType.toInstance()) : null; } } return null; }