void (@NotNull PyReturnStatement node) { ScopeOwner owner = ScopeUtil.getScopeOwner(node); if (owner instanceof PyFunction function) { PyAnnotation annotation = function.getAnnotation(); String typeCommentAnnotation = function.getTypeCommentAnnotation(); if (annotation != null || typeCommentAnnotation != null) { PyExpression returnExpr = node.getExpression(); PyType expected = getExpectedReturnType(function); PyType actual = returnExpr != null ? tryPromotingType(returnExpr, expected) : PyNoneType.INSTANCE; if (expected != null && actual instanceof PyTypedDictType) { if (reportTypedDictProblems(expected, (PyTypedDictType)actual, returnExpr)) return; } if (!PyTypeChecker.match(expected, actual, myTypeEvalContext)) { String expectedName = PythonDocumentationProvider.getTypeName(expected, myTypeEvalContext); String actualName = PythonDocumentationProvider.getTypeName(actual, myTypeEvalContext); var localQuickFix = new PyMakeFunctionReturnTypeQuickFix(function, returnExpr, actual, myTypeEvalContext); var globalQuickFix = new PyMakeFunctionReturnTypeQuickFix(function, returnExpr, null, myTypeEvalContext); registerProblem(returnExpr != null ? returnExpr : node, PyPsiBundle.message("INSP.type.checker.expected.type.got.type.instead", expectedName, actualName), localQuickFix, globalQuickFix); } } } }