title: Kotlin and RxJava - Why is my Single.zip() not compiling?
body: <p>I'm going a little crazy here. I'm trying to create an <code>Observable&lt;BigDecimal&gt;</code> extension function (against RxJava 2.x) to emit the average of the emissions, but I'm getting a compile error with the <code>Single.zip()</code> function. Does anybody have any ideas what I'm doing wrong? I tried to be explicit with all my types too and that didn't work...</p>
  
  <pre><code>import io.reactivex.Observable
  import io.reactivex.Single
  import java.math.BigDecimal
  
  
  fun Observable&lt;BigDecimal&gt;.sum() = reduce { total, next -&gt; total + next }
  
  //compile error
  fun Observable&lt;BigDecimal&gt;.average() = publish().autoConnect(2).let {
      Single.zip(it.sum().toSingle(), it.count()) {
          sum, count -&gt; sum / BigDecimal.valueOf(count)
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/NxDZZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NxDZZ.png" alt="enter image description here"></a></p>