mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Ignore __getitem__ for Generic indirect inheritors (PY-27102)
This commit is contained in:
@@ -36,7 +36,7 @@ class PyTypingInspectionExtension : PyInspectionExtension() {
|
||||
private fun isGenericItselfOrDescendant(type: PyClassLikeType,
|
||||
context: TypeEvalContext): Boolean {
|
||||
return PyTypingTypeProvider.GENERIC_CLASSES.contains(type.classQName) ||
|
||||
type.getSuperClassTypes(context).any { PyTypingTypeProvider.GENERIC_CLASSES.contains(it.classQName) }
|
||||
type.getAncestorTypes(context).any { PyTypingTypeProvider.GENERIC_CLASSES.contains(it.classQName) }
|
||||
}
|
||||
|
||||
private fun isBuiltin(type: PyClassLikeType): Boolean {
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import typing
|
||||
|
||||
|
||||
T = typing.TypeVar('T')
|
||||
|
||||
|
||||
class X(typing.Generic[T]):
|
||||
pass
|
||||
|
||||
|
||||
class Y(X[T]):
|
||||
pass
|
||||
|
||||
|
||||
class Z(Y[T]):
|
||||
pass
|
||||
|
||||
|
||||
Z[int]
|
||||
+5
@@ -215,6 +215,11 @@ public class Py3UnresolvedReferencesInspectionTest extends PyInspectionTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-27102
|
||||
public void testTypingGenericIndirectInheritorGetItem() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-21655
|
||||
public void testUsageOfFunctionDecoratedWithAsyncioCoroutine() {
|
||||
doMultiFileTest("a.py");
|
||||
|
||||
Reference in New Issue
Block a user