Stream.filterIsInstance has wrong return type #KT-5097 Fixed
This commit is contained in:
committed by
Andrey Breslav
parent
a2a93a3830
commit
e6f5c7012c
@@ -341,8 +341,8 @@ public fun <T, R : T> Iterable<T>.filterIsInstance(klass: Class<R>): List<R> {
|
|||||||
/**
|
/**
|
||||||
* Returns a stream containing all elements that are instances of specified class
|
* Returns a stream containing all elements that are instances of specified class
|
||||||
*/
|
*/
|
||||||
public fun <T, R : T> Stream<T>.filterIsInstance(klass: Class<R>): Stream<T> {
|
public fun <T, R : T> Stream<T>.filterIsInstance(klass: Class<R>): Stream<R> {
|
||||||
return FilteringStream(this, true, { klass.isInstance(it) })
|
return FilteringStream(this, true, { klass.isInstance(it) }) as Stream<R>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ fun specialJVM(): List<GenericFunction> {
|
|||||||
exclude(ArraysOfPrimitives, Strings)
|
exclude(ArraysOfPrimitives, Strings)
|
||||||
|
|
||||||
doc(Streams) { "Returns a stream containing all elements that are instances of specified class" }
|
doc(Streams) { "Returns a stream containing all elements that are instances of specified class" }
|
||||||
returns(Streams) { "Stream<T>" }
|
returns(Streams) { "Stream<R>" }
|
||||||
body(Streams) {
|
body(Streams) {
|
||||||
"""
|
"""
|
||||||
return FilteringStream(this, true, { klass.isInstance(it) })
|
return FilteringStream(this, true, { klass.isInstance(it) }) as Stream<R>
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user