In Swift, if I declare a class based on generic type:
class BasicRequest<T>{
}
class StartRequest: BasicRequest<BasicPayload> {
}
And then try to use generic method:
class SocketClient {
public func send(request: BasicRequest<Any>){
}
}
It does not compile:
SocketClient.shared.send(request: StartRequest())
with message
Cannot convert value of type 'StartRequest' to expected argument type 'BasicRequest'
Why actually? The type info should be available across the inheritance chain.