aboutsummaryrefslogblamecommitdiff
path: root/tests/pos/t2018.scala
blob: 198b4be42a2f89e81d8a60acb60fa79a2f49eb2f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                      
class A {
  val b = new B

  def getChildren = List(new A).iterator

  class B {
    private def check = true

    private def getAncestor(p: A): A = {
      val c = (p.getChildren.find(_.b.check)) match {case Some(d) => d case None => p}

      if (c == p) p else c.b.getAncestor(c)
    }
  }
}