Hello, I have a problem. How to cast type `<T&g...
# getting-started
i
Hello, I have a problem. How to cast type
<T>
to
<Base<T>>
?
Copy code
open class C<T:C<T>>{
    fun <R> foo(a:R){
        a as T // looks not works...
    }
}
t
What is the definition of
Base<T>
?
Casting an
R
to
T
is completely unsafe, as there is no defined relationship between
T
and
R
. I would have worked with
Copy code
open class C<T : C<T>> {
    fun foo(a: T) {
        // a is already a T
    }
}