Can we ensure that A<T>
is always an instance of T
?
open class A<T : A<T>> {
fun self(): T = this as T // is this safe?
}
or are there any cases where it's not true?
Can we ensure that A<T>
is always an instance of T
?
open class A<T : A<T>> {
fun self(): T = this as T // is this safe?
}
or are there any cases where it's not true?