diff --git a/mypy/checker.py b/mypy/checker.py index a492b6e035dc..fcd334edbcce 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -1874,8 +1874,8 @@ def check_return_stmt(self, s: ReturnStmt) -> None: if isinstance(typ, AnyType): # (Unless you asked to be warned in that case, and the # function is not declared to return Any) - if (not is_proper_subtype(AnyType(), return_type) and - self.options.warn_return_any): + if (self.options.warn_return_any and + not is_proper_subtype(AnyType(), return_type)): self.warn(messages.RETURN_ANY.format(return_type), s) return