title: Scala type system, cannot find common ancestor inline
body: <p>I am on an heavily typed system with some generic methods declared as <code>def execute]C &lt;: A#C](cmd: C):EitherT[Future, Fail, Seq[A#E]]</code> (where <code>A</code>  is a generic type on the class.</p>
  
  <p>This works well. However in my tests, when I mock those calls, I have to explictiely type the super types of <code>Fail</code> and <code>A#E</code> or my code cannot compile.</p>
  
  <pre><code>// Event is the base type of Receiver#E
  val event:Event = SubOfEvent()
  handler.execute(any[SubOfCommand]) returns Seq(event).asRightT[Future, Fail]
  
  val fail:Fail = SubOfFail()
  handler.execute(any[SubOfCommand]) returns fail.asLeftT[Future, Seq[Receiver#E]]
  </code></pre>
  
  <p>If I inline the declarations of <code>event</code> or <code>fail</code> I have a <em>Type mismatch</em>:</p>
  
  <pre><code>  found   : cats.data.EitherT[scala.concurrent.Future,SubOfFail,scala.collection.immutable.Seq[SubOfEvent]]
    required: cats.data.EitherT[scala.concurrent.Future,Fail,scala.collection.immutable.Seq[Receiver#E]]
       (which expands to)  cats.data.EitherT[scala.concurrent.Future,Fail,scala.collection.immutable.Seq[Event]]
   Note: SubOfFail &lt;: Fail, but class EitherT is invariant in type A.
   You may wish to define A as +A instead. (SLS 4.5)
       handler.execute(any[SubOfCommand]) returns SubOfFail().asLeftT[Future,
                                                                     ^
  </code></pre>
  
  <p>I understand the message about <code>EitherT</code> being invariant in type <code>A</code>. But I was expecting it to be able to translate <code>EitherT[F, SubOfA, B]</code> as <code>EitherT[F, SubOfA.asInstanceOf[A], B]</code>.</p>
  
  <p>Can someone help me to reveal the flaw in my reasoning ?</p>
  
  <p>Thanks</p>