title: Why PyCharm cannot find reference when typing Union of two classes
body: <p>PyCharm highlights: "cannot find reference 'object_var' in 'Foo | Bar' </p>
  
  <p>There is no highlight with 'class_var'.
  The code is running ok, without errors.</p>
  
  <pre><code>from typing import Union, Type
  
  
  class Foo:
      class_var = "fo"
  
      def __init__(self):
          self.object_var = "o"
  
  
  class Bar:
      class_var = "ba"
  
      def __init__(self):
          self.object_var = "r"
  
  
  def foo_bar(file_object: Union[Type[Foo], Type[Bar]]):
  
      class_var = file_object.class_var
      object_var = file_object.object_var
  
      return class_var, object_var
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/y9wYu.png" rel="nofollow noreferrer">code with highlighted part</a></p>