title: Kotlin generics will not compile
body: <p>Been stuck on a problem for quite a while. This piece of code will not compile. I get an error on  line 4, <code>Type mismatch, found B require typeA</code> even though <code>B</code> is of <code>typeA</code>. I found a way to get around this by casting <code>B</code> to <code>typeA</code>, but this seems to be a horrible way(unchecked cast) to do it. Also changing the return type to <code>A&lt;C&gt;</code> would work too. I guess the smart cast is not smart enough?</p>
  
  <pre><code>class Test&lt;typeA : A&lt;C&gt;&gt; {
  
      fun returnB(): typeA {
          return B()
      }
  }
  
  
  open class A&lt;c : C&gt;
  
  class B : A&lt;C&gt;()
  
  open class C
  </code></pre>