title: Synthetic value during scala compiling
body: <p>When are the synthetic value generated? What are they used for? During which compiler phase are they erased? I keep encountering errors about synthetic values when making a scala compiler plugin. Here's the error:</p>
  
  <blockquote>
    <p>error: scala.reflect.internal.FatalError:
      symbol value x$3#33790 does not exist in scala.collection.immutable.Stream.scala$collection$immutable$Stream$$advance$1, which contains locals value newvalue#39255,value newvalue#39254,value rest#33601,value stub1#33600,value stub0#33599.</p>
  </blockquote>
  
  <pre><code>Method code: def advance(stub0: List[A], stub1: List[A], rest: Stream[A]): Stream[A] = if (rest.isEmpty())
    Stream.empty()
  else
    {
      if (stub0.isEmpty())
        {
          val newvalue: scala#27.collection#2835.immutable#5932.Stream#8383 = Stream.this.scala$collection$immutable$Stream$$advance$1(stub1.reverse(), Nil, rest);
          newvalue
        }
      else
        {
          val newvalue: collection#2835.immutable#5932.Stream$Cons#11078 = scala.collection.immutable.Stream$cons.apply(stub0.head(), {
            ((new &lt;$anon: Function0#2069&gt;(Stream.this, stub0, stub1, rest, x$3)): Function0#2069)
          });
          newvalue
        }
    }
  </code></pre>