diff --git a/mypy/suggestions.py b/mypy/suggestions.py index 39a220e34091..f5dfd44d06a8 100644 --- a/mypy/suggestions.py +++ b/mypy/suggestions.py @@ -706,6 +706,7 @@ def try_type(self, func: FuncDef, typ: ProperType) -> list[str]: def reload(self, state: State) -> list[str]: """Recheck the module given by state.""" assert state.path is not None + self.manager.errors.reset() self.fgmanager.flush_cache() return self.fgmanager.update([(state.id, state.path)], []) diff --git a/test-data/unit/daemon.test b/test-data/unit/daemon.test index 448af5d08002..3a1f0f3c21d5 100644 --- a/test-data/unit/daemon.test +++ b/test-data/unit/daemon.test @@ -392,6 +392,31 @@ def bar() -> None: x = foo('abc') # type: str foo(arg='xyz') +[case testDaemonSuggestStdlibAfterMessage] +$ dmypy start -- --follow-imports=error --no-error-summary +Daemon started +$ dmypy check main.py +main.py:1: note: Revealed type is "Literal[1]?" +$ dmypy suggest os.path.islink --callsites +No suggestions +$ dmypy status +Daemon is up and running +$ dmypy suggest os.path.isdir --callsites +No suggestions +$ dmypy check main.py +main.py:1: note: Revealed type is "Literal[1]?" +== Return code: 1 +$ {python} -c "import shutil; shutil.copy('main2.py', 'main.py')" +$ dmypy check main.py +main.py:1: note: Revealed type is "Literal[2]?" +== Return code: 1 +$ dmypy stop +Daemon stopped +[file main.py] +reveal_type(1) +[file main2.py] +reveal_type(2) + [case testDaemonInspectCheck] $ dmypy start Daemon started