class Foo { getClosure() { fun f() { fun g() { fun h() { return this.toString(); } return h; } return g; } return f; } toString() { return "Foo"; } } var closure = Foo().getClosure(); print(closure()()()); # expect: Foo