title: How does CanBuildFrom know whether a type can build from another?
body: <p>I read the <a href="http://docs.scala-lang.org/overviews/core/architecture-of-scala-collections.html" rel="noreferrer">official doc</a> but I can't still understand how it works. For example:</p>
  
  <pre><code>class A {
    type Self
  }
  def seqToSet[T &lt;: A](seq: Seq[T])
                      (implicit cbf: CanBuildFrom[Seq[T], T#Self, Set[T]]) {}
  </code></pre>
  
  <p>The above code can be compiled... but how? How does Scala know a <code>Set</code> can be built from a <code>Seq</code>? And how could it ensure a <code>T#Self</code>(literally any type) can be put into <code>Set[T]</code>?</p>