Closed CC007 closed 1 year ago
To make sure that this wasn't an issue with overloading the existing Stream.map(Function<T, R> mapper)
method, I renamed the extension method (for instance to mapIt(...)
. The issue still persisted.
@CC007 this is a known issue. I should carve some time out and implement this, relatively simple to implement.
Duplicate of https://github.com/manifold-systems/manifold/issues/7
I also noticed that I have to use the same generic type name as was used in the original class definition (so T
for Iterable
and E
for Set
), otherwise I'd get a compilation error. Does that also have to do with #7?
Describe the bug Wrong method is attempted to get called, due to generics being ignored in an extension method.
To Reproduce Steps to reproduce the behavior:
streamIndexed
andfilterIndexed
extension method in theIterableExt
class (see screenshot)map
extension method with@This Stream<Indexed<T>>
andIndexedFunction<T, R>
parameter inStreamExt
(see last screenshot)map
extension method (see first screenshot)Expected behavior The ability to use the extension method without error, The method I'm expecting to call is
Stream<R> map(IndexedFunction<Boolean, R> mapper)
, rather thanStream<R> map(IndexedFunction<Indexed<Boolean>, R> mapper)
Screenshots
Desktop (please complete the following information):
Additional context
Indexed<T>
is defined like this:Workaround As a workaround, I can define a
Function<Indexed<T>,R>
rather than anIndexedFunction<T, R>
and call the normalStream.map(...)
method instead of my extension method, however it would be nice if the extension method worked too.