Netflix/RxJava — pull request #584 by khernyo (2013-12-08 13:38:09+00:00)
Title: Fixes OnCompleted.unapply result type

The Scala spec says that an extractor matches a pattern with zero
argument pattern if the result type of unapply is Boolean. The result
type of Option[T] means that the extractor has exactly one argument
pattern of type T.

The "Option[Unit]" result type does work, but it's probably a compiler
bug. Based on the result type, the pattern match "case OnCompleted() =>"
should not compile and "case OnCompleted(()) =>" should be used instead.
Using the latter one crashes the compiler... Changing the result type of
unapply to Boolean does _not_ change any of this, so using the pattern
"case OnCompleted(()) =>" still crashes the compiler, but at least the
pattern is not suggested by the unapply result type and the pattern
match results in one less object allocation.

The included test does _not_ check for this problem, it simply makes
sure that it still works correctly when using the correct pattern.