PyTypeProvider can return 'Any' type for parameter and return types

Previously there was no way for a type provider to tell that the type
is really 'Any'. The 'null' return value was just a sign that the
provider doesn't know the return type and we should try other
alternatives.
This commit is contained in:
Andrey Vlasovskikh
2015-03-31 18:07:34 +03:00
parent f7fc82a999
commit bf1d5b924e
10 changed files with 68 additions and 29 deletions
@@ -16,6 +16,7 @@
package com.jetbrains.python.psi.impl;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiElement;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.types.PyType;
@@ -36,10 +37,10 @@ public interface PyTypeProvider {
PyType getReferenceType(@NotNull PsiElement referenceTarget, TypeEvalContext context, @Nullable PsiElement anchor);
@Nullable
PyType getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context);
Ref<PyType> getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context);
@Nullable
PyType getReturnType(@NotNull PyCallable callable, @NotNull TypeEvalContext context);
Ref<PyType> getReturnType(@NotNull PyCallable callable, @NotNull TypeEvalContext context);
@Nullable
PyType getCallType(@NotNull PyFunction function, @Nullable PyCallSiteExpression callSite, @NotNull TypeEvalContext context);
@@ -15,6 +15,7 @@
*/
package com.jetbrains.python.psi.types;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiElement;
import com.intellij.util.containers.FactoryMap;
import com.jetbrains.python.psi.*;
@@ -92,13 +93,13 @@ public class PyTypeProviderBase implements PyTypeProvider {
}
@Override
public PyType getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context) {
public Ref<PyType> getParameterType(@NotNull PyNamedParameter param, @NotNull PyFunction func, @NotNull TypeEvalContext context) {
return null;
}
@Nullable
@Override
public PyType getReturnType(@NotNull PyCallable callable, @NotNull TypeEvalContext context) {
public Ref<PyType> getReturnType(@NotNull PyCallable callable, @NotNull TypeEvalContext context) {
return null;
}