From ed026c0705c1bec35351420c59d0a3befe139f2a Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Mon, 3 Mar 2014 12:45:46 +0400 Subject: [PATCH] Renamed Callable.getReturnType() to getCallType() --- python/psi-api/src/com/jetbrains/python/psi/Callable.java | 4 ++-- .../codeInsight/override/PyOverrideImplementUtil.java | 2 +- .../userSkeletons/PyUserSkeletonsTypeProvider.java | 2 +- .../python/inspections/PyPropertyDefinitionInspection.java | 2 +- .../python/inspections/PyStringFormatInspection.java | 2 +- .../jetbrains/python/psi/impl/PyBinaryExpressionImpl.java | 2 +- .../jetbrains/python/psi/impl/PyCallExpressionHelper.java | 6 +++--- python/src/com/jetbrains/python/psi/impl/PyClassImpl.java | 2 +- .../src/com/jetbrains/python/psi/impl/PyFunctionImpl.java | 2 +- .../jetbrains/python/psi/impl/PyLambdaExpressionImpl.java | 2 +- .../com/jetbrains/python/psi/impl/PyNamedParameterImpl.java | 2 +- .../jetbrains/python/psi/impl/PyPrefixExpressionImpl.java | 2 +- .../python/psi/impl/PySubscriptionExpressionImpl.java | 2 +- .../jetbrains/python/psi/impl/PyTargetExpressionImpl.java | 2 +- .../src/com/jetbrains/python/psi/types/PyFunctionType.java | 4 ++-- .../src/com/jetbrains/python/psi/types/PyTypeChecker.java | 3 +-- 16 files changed, 20 insertions(+), 21 deletions(-) diff --git a/python/psi-api/src/com/jetbrains/python/psi/Callable.java b/python/psi-api/src/com/jetbrains/python/psi/Callable.java index 23a5ef7870b7..bade73381eae 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/Callable.java +++ b/python/psi-api/src/com/jetbrains/python/psi/Callable.java @@ -34,10 +34,10 @@ public interface Callable extends PyTypedElement, PyQualifiedNameOwner { PyParameterList getParameterList(); /** - * @return the type of returned value. + * Returns the type of the call to the callable. */ @Nullable - PyType getReturnType(@NotNull TypeEvalContext context, @Nullable PyQualifiedExpression callSite); + PyType getCallType(@NotNull TypeEvalContext context, @Nullable PyQualifiedExpression callSite); /** * @return a methods returns itself, non-method callables return null. diff --git a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java index 8783a7a16b58..a7fc0dc08d25 100644 --- a/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java +++ b/python/src/com/jetbrains/python/codeInsight/override/PyOverrideImplementUtil.java @@ -225,7 +225,7 @@ public class PyOverrideImplementUtil { statementBody.append(PyNames.PASS); } else { - if (!PyNames.INIT.equals(baseFunction.getName()) && baseFunction.getReturnType(context, null) != PyNoneType.INSTANCE) { + if (!PyNames.INIT.equals(baseFunction.getName()) && baseFunction.getCallType(context, null) != PyNoneType.INSTANCE) { statementBody.append("return "); } if (baseClass.isNewStyleClass()) { diff --git a/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsTypeProvider.java b/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsTypeProvider.java index b900e28f93c0..c836e0919dde 100644 --- a/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsTypeProvider.java +++ b/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsTypeProvider.java @@ -46,7 +46,7 @@ public class PyUserSkeletonsTypeProvider extends PyTypeProviderBase { public PyType getReturnType(@NotNull PyFunction function, @Nullable PyQualifiedExpression callSite, @NotNull TypeEvalContext context) { final PyFunction functionSkeleton = PyUserSkeletonsUtil.getUserSkeleton(function); if (functionSkeleton != null) { - return functionSkeleton.getReturnType(context, callSite); + return functionSkeleton.getCallType(context, callSite); } return null; } diff --git a/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java b/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java index 967e6a47c26d..33d9b0bf20a1 100644 --- a/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java @@ -301,7 +301,7 @@ public class PyPropertyDefinitionInspection extends PyInspection { } else { PyReferenceExpression callSite = being_checked instanceof PyReferenceExpression ? (PyReferenceExpression) being_checked : null; - hasReturns = !(callable.getReturnType(myTypeEvalContext, callSite) instanceof PyNoneType); + hasReturns = !(callable.getCallType(myTypeEvalContext, callSite) instanceof PyNoneType); } if (allowed ^ hasReturns) { if (allowed && callable instanceof PyFunction) { diff --git a/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java b/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java index 180fd1bfc3b0..280822ba7175 100644 --- a/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java @@ -149,7 +149,7 @@ public class PyStringFormatInspection extends PyInspection { } else if (rightExpression instanceof PyCallExpression) { final Callable callable = ((PyCallExpression)rightExpression).resolveCalleeFunction(resolveContext); - // TODO: Switch to Callable.getReturnType() + // TODO: Switch to Callable.getCallType() if (callable instanceof PyFunction && myTypeEvalContext.maySwitchToAST((PyFunction) callable)) { PyStatementList statementList = ((PyFunction)callable).getStatementList(); if (statementList == null) { diff --git a/python/src/com/jetbrains/python/psi/impl/PyBinaryExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyBinaryExpressionImpl.java index bee876ac948d..61513d1e4c4f 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyBinaryExpressionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyBinaryExpressionImpl.java @@ -137,7 +137,7 @@ public class PyBinaryExpressionImpl extends PyElementImpl implements PyBinaryExp } final PyTypeChecker.AnalyzeCallResults results = PyTypeChecker.analyzeCall(this, context); if (results != null) { - final PyType type = results.getCallable().getReturnType(context, this); + final PyType type = results.getCallable().getCallType(context, this); if (!PyTypeChecker.isUnknown(type) && !(type instanceof PyNoneType)) { return type; } diff --git a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java index c32ec1ba1566..874190b84104 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java +++ b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java @@ -198,7 +198,7 @@ public class PyCallExpressionHelper { final PyFunction function = (PyFunction)resolved; final Property property = function.getProperty(); if (property != null && isQualifiedByInstance(function, qualifiers, context)) { - final PyType type = function.getReturnType(context, null); + final PyType type = function.getCallType(context, null); if (type instanceof PyFunctionType) { resolved = ((PyFunctionType)type).getCallable(); } @@ -424,7 +424,7 @@ public class PyCallExpressionHelper { } } if (init != null) { - final PyType t = init.getReturnType(context, (PyReferenceExpression)callee); + final PyType t = init.getCallType(context, (PyReferenceExpression)callee); if (cls != null) { if (init.getContainingClass() != cls) { if (t instanceof PyCollectionType) { @@ -453,7 +453,7 @@ public class PyCallExpressionHelper { } if (target instanceof Callable) { final Callable callable = (Callable)target; - return callable.getReturnType(context, (PyReferenceExpression)callee); + return callable.getCallType(context, (PyReferenceExpression)callee); } } } diff --git a/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java b/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java index 516cb4704a95..b25ba2dbfa86 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyClassImpl.java @@ -750,7 +750,7 @@ public class PyClassImpl extends PyPresentableElementImpl implement if (!(callable instanceof StubBasedPsiElement) && !context.maySwitchToAST(callable)) { return null; } - return callable.getReturnType(context, null); + return callable.getCallType(context, null); } return null; } diff --git a/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java index 2ffc8e6cba03..eeeb0b3c2228 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyFunctionImpl.java @@ -176,7 +176,7 @@ public class PyFunctionImpl extends PyPresentableElementImpl imp @Nullable @Override - public PyType getReturnType(@NotNull TypeEvalContext context, @Nullable PyQualifiedExpression callSite) { + public PyType getCallType(@NotNull TypeEvalContext context, @Nullable PyQualifiedExpression callSite) { PyType type = getGenericReturnType(context, callSite); if (callSite == null) { return type; diff --git a/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java b/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java index 56249f1fdfa4..3b318d4962a0 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyLambdaExpressionImpl.java @@ -61,7 +61,7 @@ public class PyLambdaExpressionImpl extends PyElementImpl implements PyLambdaExp @Nullable @Override - public PyType getReturnType(@NotNull TypeEvalContext context, @Nullable PyQualifiedExpression callSite) { + public PyType getCallType(@NotNull TypeEvalContext context, @Nullable PyQualifiedExpression callSite) { final PyExpression body = getBody(); if (body != null) return context.getType(body); else return null; diff --git a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java index 6ad33d60569e..eeb3f9a0e3af 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java @@ -208,7 +208,7 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl