-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make cast and ofType operate on wildcard types rather than Any #176
Conversation
@ansman could you provide few examples of cases you are talking about? |
The most obvious example that doesn't work is this:
You can only cast Maybe to And besides, it should be implemented like it is for |
@ansman but this example is not correct from RxJava perspective
will work just fine. |
Sure but then the other extensions are needlessly wide in the types they accept. I don't see any reason to not accept this PR for parity's sake alone. |
I mean just a simple So I would vote for this to get merged |
I have a sense that this goes beyond the scope of RxKotlin. Such extension functions can be implemented on one's own domain if they are needed. |
I'm sorry but this feels like an extremely bad reason for closing this. This does not add, change or remove functionally but rather fix something that is, in my opinion, broken. The built in |
Sorry I completely skimmed through this too quickly. This makes sense. |
@ansman can you resolve conflict and then I will merge? |
@thomasnield Thanks, fixed |
Maybe.ofType
,Maybe.cast
andSingle.cast
are declared as extensions onMaybe<Any>/Single<Any>
rather than onMaybe<*>/Single<*>
which prevents them from being used in some cases.This PR fixes this and will align them with how the Observable and Flowable extensions are implemented.
This would be a binary compatible change and all existing consumers wouldn't need to change anything.