PY-76629 PY-39761 Don't type check __class_getitem__ arguments inside type hints

GitOrigin-RevId: 060a2952d49777bff9853a2d5bc4d257271e559e
This commit is contained in:
Mikhail Golubev
2024-08-13 17:02:15 +02:00
committed by intellij-monorepo-bot
parent 732cd5275a
commit 20b2e20d26

View File

@@ -63,6 +63,9 @@ public class PyTypeCheckerInspection extends PyInspection {
// Type check in TypedDict subscription expressions cannot be properly done because each key should have its own value type,
// so this case is covered by PyTypedDictInspection
if (myTypeEvalContext.getType(node.getOperand()) instanceof PyTypedDictType) return;
// Don't type check __class_getitem__ calls inside type hints. Normally these are not type hinted as a construct
// special-cased by type checkers
if (PyTypingTypeProvider.isInsideTypeHint(node, myTypeEvalContext)) return;
checkCallSite(node);
}