fun Any.get(a: Int) { if (a > 0) { this[a - 1] } } class A { override fun equals(other: Any?): Boolean { this == other return true } fun inc(): A { this++ ++this return this } fun component1(): Int { // TODO: should be recursion marker too val (a) = this return 1 } fun plus() { +this } fun minus() { -this } fun plus(a: Int) { this + 1 this += 1 } fun invoke() { val a = A() a() a.invoke() this.invoke() this() } } class B fun B.invoke() { this() invoke() }