title: Path-dependent types - what's wrong with the following code?
body: <p>The following code:</p>
  
  <pre><code>trait Foo {
    type T
    val x: T
  }
  
  trait Bar {
    type F &lt;: Foo { type T &lt;: F }
  }
  
  class C[B &lt;: Bar](val f: B#F) {
    val x: f.T = f.x
  }    
  </code></pre>
  
  <p>is rejected by the Scala compiler (2.11.5) with the following error message:</p>
  
  <pre><code>error: type mismatch;
  found   : C.this.f.x.type (with underlying type C.this.f.T)
  required: this.T
        val x: f.T = f.x
                    ^
  </code></pre>
  
  <p>If the explicit type declaration is omitted, the type is correctly inferred, according to the output from typer phase:</p>
  
  <pre><code>private[this] val x: C.this.f.T = C.this.f.x;
  &lt;stable&gt; &lt;accessor&gt; def x: C.this.f.T = C.this.x
  </code></pre>
  
  <p>The problem also disappears if <code>F</code> inside the bound in <code>Bar</code> is changed to a type that is not a member of <code>Bar</code>, i.e.</p>
  
  <pre><code>type F &lt;: Foo { type T &lt;: Foo }
  </code></pre>
  
  <p>works correctly.</p>
  
  <p>Is it a bug? Or some fundamental misunderstanding on my part? Or some arcane feature?</p>