From 38e54e233706dd1cb38bfad789bf0a994cec21e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=92=D0=B5=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B2?= Date: Thu, 23 Jul 2026 09:21:23 +0300 Subject: [PATCH] Reset errors before suggestion reload --- mypy/suggestions.py | 1 + test-data/unit/daemon.test | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/mypy/suggestions.py b/mypy/suggestions.py index 39a220e34091e..f5dfd44d06a80 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 448af5d080029..3a1f0f3c21d5e 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