boolean (@NotNull PyStructuralType expected, @NotNull PyType actual, @NotNull TypeEvalContext context) { if (actual instanceof PyStructuralType) { return match(expected, (PyStructuralType)actual); } if (actual instanceof PyClassType) { return match(expected, (PyClassType)actual, context); } if (actual instanceof PyModuleType) { final PyFile module = ((PyModuleType)actual).getModule(); if (module.getLanguageLevel().isAtLeast(LanguageLevel.PYTHON37) && definesGetAttr(module, context)) { return true; } } final PyResolveContext resolveContext = PyResolveContext.defaultContext(context); return !ContainerUtil.exists(expected.getAttributeNames(), attribute -> ContainerUtil .isEmpty(actual.resolveMember(attribute, null, AccessDirection.READ, resolveContext))); }