title: Why is instantiating a trait with default values in Scala a compilation error?
body: <p>The error can be reproduced by compiling the following code:</p>
  
  <pre><code>object ReproducingMyError {
  
    trait MyTrait[X] {
      def someFunc: X
    }
  
    def f[X] = new MyTrait[X] {
      var x: X = _
      def someFunc: X = x
    }
  
  }
  </code></pre>
  
  <p>2 error messages were generated. Both point to</p>
  
  <pre><code>  def f[X] = new MyTrait[X] {
                   ^
  </code></pre>
  
  <p>The messages are similar:</p>
  
  <p><code>Error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement</code></p>
  
  <p><code>Error: Parameter type in structural refinement may not refer to a type member of that refinement</code></p>
  
  <p>Why is this a compilation error?</p>