void (@NotNull PyFunction node) { final PyAnnotation annotation = node.getAnnotation(); final String typeCommentAnnotation = node.getTypeCommentAnnotation(); if (annotation != null || typeCommentAnnotation != null) { if (!PyUtil.isEmptyFunction(node)) { final ReturnVisitor visitor = new ReturnVisitor(node); node.getStatementList().accept(visitor); if (!visitor.myHasReturns) { final PyType expected = getExpectedReturnType(node); final String expectedName = PythonDocumentationProvider.getTypeName(expected, myTypeEvalContext); if (expected != null && !(expected instanceof PyNoneType)) { registerProblem(annotation != null ? annotation.getValue() : node.getTypeComment(), PyPsiBundle.message("INSP.type.checker.expected.to.return.type.got.no.return", expectedName)); } } } if (PyUtil.isInitMethod(node) && !(getExpectedReturnType(node) instanceof PyNoneType || PyTypingTypeProvider.isNoReturn(node, myTypeEvalContext))) { registerProblem(annotation != null ? annotation.getValue() : node.getTypeComment(), PyPsiBundle.message("INSP.type.checker.init.should.return.none")); } } }