public class A { public class func f() { B().f() } } class B { private class C { var this: C? = nil lazy var number: Int = { var local: C? = self let count = 0 while let temp = local?.this { local = temp } return count }() func f() -> C { if number == 0 { return self } print(number) return self } } func f() { C().f() } }