'as?' works on types with generics
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Wrapper<T>() {
|
||||
fun castToSelf(wrapper: Any) = wrapper as? Wrapper<T>
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
val wrapper = new Wrapper<Int>()
|
||||
return wrapper.castToSelf(new Wrapper<String>())
|
||||
}
|
||||
Reference in New Issue
Block a user