PyType (@NotNull PyFunction function, @Nullable PyExpression returnExpr, @NotNull TypeEvalContext context) { PyType returnTypeExpected = getExpectedReturnType(function, context); return returnExpr != null ? tryPromotingType(returnExpr, returnTypeExpected, context) : PyNoneType.INSTANCE; }