Repository: python/mypy

Issue:
Type aliases become red in html report.
Take the following code:
```python
SourceToDisplay = Callable[[int], int]
DisplayToSource = Callable[[int], int]
```
This becomes red, while it shouldn't.
![image](https://user-images.githubusercontent.com/216638/57254300-35df4f80-7051-11e9-949f-48e3d7b72bba.png)

Thanks!


Discussion:
Taking a look at this.
@jonathanslenders Can you provide more infomations, such as mypy version, options and source code.

I can't reproduce your result using your code.
![image](https://user-images.githubusercontent.com/7857126/66581849-648ac480-ebb3-11e9-8976-1184ea41efdd.png)

This may have been fixed at some point. 

@forrestchang Could you check if you can reproduce the issue using a mypy commit from May 6?
I can reproduce this error:  
- Python 3.6.8
- mypy 0.730 

when defining alias at runtime, alias type is `AnyType(TypeOfAny.special_form)`.  
in report special AnyTypes are ignored. so this line becomes unanalyzed.  
i suggest recording special AnyType as `precise` in reports, is it ok? @JukkaL 


Resolving patch:
diff --git a/mypy/stats.py b/mypy/stats.py
--- 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):


Test patch:
diff --git a/test-data/unit/reports.test b/test-data/unit/reports.test
--- 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]
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" type="text/css" href="../mypy-html.css">
+</head>
+<body>
+<h2>n</h2>
+<table>
+<caption>n.py</caption>
+<tbody><tr>
+<td class="table-lines"><pre><span id="L1" class="lineno"><a class="lineno" href="#L1">1</a></span>
+<span id="L2" class="lineno"><a class="lineno" href="#L2">2</a></span>
+<span id="L3" class="lineno"><a class="lineno" href="#L3">3</a></span>
+<span id="L4" class="lineno"><a class="lineno" href="#L4">4</a></span>
+</pre></td>
+<td class="table-code"><pre><span class="line-precise" title="No Anys on this line!">from typing import Callable</span>
+<span class="line-empty" title="No Anys on this line!"></span>
+<span class="line-precise" title="No Anys on this line!">SourceToDisplay = Callable[[int], int]</span>
+<span class="line-precise" title="No Anys on this line!">DisplayToSource = Callable[[int], int]</span>
+</pre></td>
+</tr></tbody>
+</table>
+</body>
+</html>