let this as a special type, can be used as return type
Detail
Allow use this as return type.
Only allow using return this to return.
Usecase
useful for chain builder, providing assert return this not new object.
Auto convert for derived type. For example
open class A{
fun setAny(v:Any): A/*this*/{
//do something
return this
}
}
class B:A{
fun doB(){}
}
B().setAny(xxx).doB()
//setAny return this and compiler know it is B not A.