title: mypy: "Item of Union has no attribute" error
body: <p>Trying to learn to type hint in Python. Given these two functions:</p>
  
  <pre><code>from typing import Union, TextIO
  
  
  def myfunc_ok(file: TextIO):
      mydump = file.read()
      print(mydump)
  
  
  def myfunc_error(file: Union[str, TextIO]):
      mydump = file.read()
      print(mydump)
  </code></pre>
  
  <p>First one is ok to mypy, but it complains about the second one with an error</p>
  
  <pre><code>Item "str" of "Union[str, TextIO]" has no attribute "read"
  </code></pre>
  
  <p>Am I using type hinting incorrenctly in this case?
  (Using python3.7 with mypy 0.610, also tested with py3.6)</p>