PyType (@NotNull PyReferenceExpression referenceExpression, @NotNull Context context) { // Check for the exact name in advance for performance reasons if ("Generic".equals(referenceExpression.getName())) { if (resolveToQualifiedNames(referenceExpression, context.myContext).contains(GENERIC)) { return createTypingGenericType(referenceExpression); } } // Check for the exact name in advance for performance reasons if ("Protocol".equals(referenceExpression.getName())) { if (ContainerUtil.exists(resolveToQualifiedNames(referenceExpression, context.myContext), n -> PROTOCOL.equals(n) || PROTOCOL_EXT.equals(n))) { return createTypingProtocolType(referenceExpression); } } // Check for the exact name in advance for performance reasons if ("Callable".equals(referenceExpression.getName())) { if (resolveToQualifiedNames(referenceExpression, context.myContext).contains(CALLABLE)) { return createTypingCallableType(referenceExpression); } } return null; }