diff --git a/mypy/stats.py b/mypy/stats.py index 6abcfd334da8..43dde75d185a 100644 --- a/mypy/stats.py +++ b/mypy/stats.py @@ -332,7 +332,8 @@ def type(self, t: Optional[Type]) -> None: return if isinstance(t, AnyType) and is_special_form_any(t): - # This is not a real Any type, so don't collect stats for it. + # TODO: What if there is an error in special form definition? + self.record_line(self.line, TYPE_PRECISE) return if isinstance(t, AnyType): diff --git a/test-data/unit/reports.test b/test-data/unit/reports.test index 0aa0ce0c8c8f..68bbb180f984 100644 --- a/test-data/unit/reports.test +++ b/test-data/unit/reports.test @@ -422,3 +422,39 @@ async def some_function(x) -> None: l 1 0 0 0 0 0 0 ----------------------------------------------------------------------------------------------------------------- Total 1 1 0 0 0 0 0 + +[case testSpecialAnyHtmlReport] +# cmd: mypy --html-report report n.py +[file n.py] +from typing import Callable + +SourceToDisplay = Callable[[int], int] +DisplayToSource = Callable[[int], int] + +[file report/mypy-html.css] +[file report/index.html] +[outfile report/html/n.py.html] + +
+ + + + +1 +2 +3 +4 + |
+from typing import Callable + +SourceToDisplay = Callable[[int], int] +DisplayToSource = Callable[[int], int] + |
+