Redeclare operations from RACStream with more precise ValueType #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since the operations built on
RACStream
primitives have aninstancetype
return value, the compiler assumes that they inherit the receiving signal’sValueType
when they are invoked onRACSignal
. For operators likemap:
, this is almost always an incorrect assumption. As such, in cases where theValueType
of the result of the operation is not able to be inferred, theValueType
is erased in the result by returningRACSignal *
with noValueType
information.Additionally, in cases where
instancetype
is a valid return type and no more preciseValueType
information could be added to the method signature, the operation is not redeclared, since the compiler will assume the correct return types.Finally, in cases where more precise type information could be provided, the operators are redeclared as such.