fun checkSubtype(t: T) = t class A(val a:Int) { inner class B() { val x = checkSubtype(this@B) val y = checkSubtype(this@A) val z = checkSubtype(this) val Int.xx : Int get() = checkSubtype(this) fun Byte.xx() : Double.() -> Unit { checkSubtype(this) val a: Double.() -> Unit = { checkSubtype(this) + checkSubtype(this@xx) } val b: Double.() -> Unit = a@{checkSubtype(this@a) + checkSubtype(this@xx) } val c = a@{this@a + checkSubtype(this@xx) } return (a@{checkSubtype(this@a) + checkSubtype(this@xx) }) } } }