1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
object Test { import scala.collection._ trait T { def f() : Unit } def view = new T { def f() = () } trait TLike[+A, RR] { self => def repr: RR = ??? def view2 = new TraversableView[A, RR] { protected lazy val underlying = self.repr override def foreach[U](f: A => U): Unit = ??? } } }