void (@NotNull PyGlobalStatement node) { final PyTargetExpression[] globals = node.getGlobals(); for (PyTargetExpression global : globals) { final PyResolveContext resolveContext = PyResolveContext.defaultContext(myTypeEvalContext); final List<PsiElement> elements = PyUtil.multiResolveTopPriority(global.getReference(resolveContext)); final boolean noTopLevelDeclaration = elements.stream().noneMatch(PyUtil::isTopLevel); if (noTopLevelDeclaration) { registerProblem(global, PyPsiBundle.message("INSP.global.variable.undefined", global.getName())); } } }