diff --git a/mypy/checker.py b/mypy/checker.py index ccf58d825497..9da5a9ba3745 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -959,11 +959,7 @@ def _visit_func_def(self, defn: FuncDef) -> None: # Function definition overrides a variable initialized via assignment or a # decorated function. orig_type = defn.original_def.type - if orig_type is None: - # XXX This can be None, as happens in - # test_testcheck_TypeCheckSuite.testRedefinedFunctionInTryWithElse - self.msg.note("Internal mypy error checking function redefinition", defn) - return + assert orig_type is not None, f"Error checking function redefinition {defn}" if isinstance(orig_type, PartialType): if orig_type.type is None: # Ah this is a partial type. Give it the type of the function.