mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
[python] Delete duplicated method PyUtil.getGenericTypeForClass()
GitOrigin-RevId: 700e2d60a86d34fcc0d3c709b2fd9f161f17dfa0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9c03ffac0e
commit
d424ea892b
@@ -44,7 +44,6 @@ import com.jetbrains.python.codeInsight.mlcompletion.PyCompletionMlElementKind;
|
||||
import com.jetbrains.python.psi.impl.PyBuiltinCache;
|
||||
import com.jetbrains.python.psi.impl.PyExpressionCodeFragmentImpl;
|
||||
import com.jetbrains.python.psi.impl.PyPsiUtils;
|
||||
import com.jetbrains.python.psi.impl.PyTypeProvider;
|
||||
import com.jetbrains.python.psi.resolve.PyResolveContext;
|
||||
import com.jetbrains.python.psi.resolve.QualifiedNameFinder;
|
||||
import com.jetbrains.python.psi.resolve.RatedResolveResult;
|
||||
@@ -686,7 +685,7 @@ public final class PyUtil {
|
||||
if (isInitMethod(function)) {
|
||||
final PyClass cls = function.getContainingClass();
|
||||
if (cls != null) {
|
||||
PyType providedClassType = getGenericTypeForClass(context, cls);
|
||||
PyType providedClassType = PyTypeChecker.findGenericDefinitionType(cls, context);
|
||||
if (providedClassType != null) return providedClassType;
|
||||
|
||||
final PyInstantiableType classType = as(context.getType(cls), PyInstantiableType.class);
|
||||
@@ -699,16 +698,6 @@ public final class PyUtil {
|
||||
return context.getReturnType(function);
|
||||
}
|
||||
|
||||
public static @Nullable PyType getGenericTypeForClass(@NotNull TypeEvalContext context, PyClass cls) {
|
||||
for (PyTypeProvider provider : PyTypeProvider.EP_NAME.getExtensionList()) {
|
||||
final PyType providedClassType = provider.getGenericType(cls, context);
|
||||
if (providedClassType != null) {
|
||||
return providedClassType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new expressions fragment from the given text, setting the specified element as its context,
|
||||
* and return the contained expression of the first expression statement in it.
|
||||
|
||||
@@ -50,7 +50,6 @@ import static com.intellij.util.containers.ContainerUtil.map;
|
||||
import static com.jetbrains.python.ast.PyAstFunction.Modifier.CLASSMETHOD;
|
||||
import static com.jetbrains.python.ast.PyAstFunction.Modifier.STATICMETHOD;
|
||||
import static com.jetbrains.python.psi.PyUtil.as;
|
||||
import static com.jetbrains.python.psi.PyUtil.getGenericTypeForClass;
|
||||
import static com.jetbrains.python.psi.impl.PyCallExpressionHelper.interpretAsModifierWrappingCall;
|
||||
import static com.jetbrains.python.psi.impl.PyDeprecationUtilKt.extractDeprecationMessageFromDecorator;
|
||||
|
||||
@@ -227,7 +226,7 @@ public class PyFunctionImpl extends PyBaseElementImpl<PyFunctionStub> implements
|
||||
if (substitutions != null) {
|
||||
PyClass containingClass = getContainingClass();
|
||||
if (containingClass != null && type instanceof PySelfType) {
|
||||
PyType genericType = getGenericTypeForClass(context, containingClass);
|
||||
PyType genericType = PyTypeChecker.findGenericDefinitionType(containingClass, context);
|
||||
if (genericType != null) {
|
||||
type = genericType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user