Skip to content

Commit c9f60ee

Browse files
replace cast in window() by ascription
see https://issues.scala-lang.org/browse/SI-7818 for details
1 parent 2bf40bc commit c9f60ee

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scalaimpl/Observable.scala

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,9 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
453453
* "count" produced values.
454454
*/
455455
def window(count: Int): Observable[Observable[T]] = {
456-
// this line makes the compiler crash (if it's the last line of the method):
457-
// Observable.jObsOfJObsToScObsOfScObs(asJava.window(count))
458-
459-
// this line gives an error:
460-
// "type mismatch; found : rx.Observable[rx.Observable[_$1]] required: rx.Observable[rx.Observable[T]]"
461-
// Observable.jObsOfJObsToScObsOfScObs(asJava.window(count) : JObservable[JObservable[T]])
462-
463-
// workaround with a cast:
464-
Observable.jObsOfJObsToScObsOfScObs(asJava.window(count).asInstanceOf[JObservable[JObservable[T]]])
456+
// this unnecessary ascription is needed because of this bug (without, compiler crashes):
457+
// https://issues.scala-lang.org/browse/SI-7818
458+
Observable.jObsOfJObsToScObsOfScObs(asJava.window(count)) : Observable[Observable[T]]
465459
}
466460

467461
/**

0 commit comments

Comments
 (0)