Strange cast errors with Kotlin 1.0.2-1 and RxKotlin 0.60.0

In the follow code:

import rx.lang.kotlin.toObservable

fun main(vararg args: String) {
    val csv = listOf(
                arrayOf("key", "value1"),
                arrayOf("", "value2")
              ).toObservable()

    csv
            .reduce(listOf<Array<String>>()) { list, row ->
                println("row ${listOf(*row)}")
                if (row[0].length == 0) {
                    // java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;
                    val key = list.last().get(0)
                    println("key $key")
                    row[0] = key
                }
                list.plus(row) // required cast: as List<Array<String>>
            }.forEach { println(it) }

}

compiler force me to cast “list.plus(row) as List<Array>” (inferred as List!)!) ), if I fix this error then run the application produces a ClassCastException.

How can I fix the code?

Thanks,
Vasco

PS: build.gradle

apply plugin: 'kotlin'
apply plugin: 'application'

mainClassName='TestKt'

buildscript {
    ext.kotlin_version = '1.0.2-1'
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    compile 'io.reactivex:rxkotlin:0.60.0'
}

repositories {
    mavenCentral()
}

Looks like you may have run into a flavor of https://youtrack.jetbrains.com/issue/KT-9992 where the list.plus(row) call is resolving to try to add each element of the row array to the list rather than adding the Array<String> reference as a single element. Try using list.plusElement(row) in place of list.plus(row) as noted in the comments on that issue.

Thanks for suggestion,
I’m going to investigate later.

Vasco