diff --git a/mypy/fastparse2.py b/mypy/fastparse2.py index 9d85ea3486ba..b8cbef904a12 100644 --- a/mypy/fastparse2.py +++ b/mypy/fastparse2.py @@ -349,7 +349,7 @@ def visit_Module(self, mod: ast27.Module) -> MypyFile: self.type_ignores[ti.lineno] = parsed else: self.fail(INVALID_TYPE_IGNORE, ti.lineno, -1) - body = self.fix_function_overloads(self.translate_stmt_list(mod.body)) + body = self.fix_function_overloads(self.translate_stmt_list(mod.body, module=True)) return MypyFile(body, self.imports, False, diff --git a/test-data/unit/check-ignore.test b/test-data/unit/check-ignore.test index 6d3d1b097556..863d5ed5cd73 100644 --- a/test-data/unit/check-ignore.test +++ b/test-data/unit/check-ignore.test @@ -246,6 +246,11 @@ IGNORE # type: ignore import MISSING +[case testIgnoreWholeModulePy27] +# flags: --python-version 2.7 +# type: ignore +IGNORE + [case testDontIgnoreWholeModule1] if True: # type: ignore