Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt
T
2015-04-29 16:33:24 +02:00

17 lines
580 B
Kotlin

// !CHECK_TYPE
//KT-1718 compiler error when not using temporary variable
package n
import java.util.ArrayList
fun test() {
val list = arrayList("foo", "bar") + arrayList("cheese", "wine")
checkSubtype<List<String>>(list)
//check it's not an error type
checkSubtype<Int>(<!TYPE_MISMATCH!>list<!>)
}
//from library
fun arrayList<T>(vararg <!UNUSED_PARAMETER!>values<!>: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <T> Iterable<T>.plus(<!UNUSED_PARAMETER!>elements<!>: Iterable<T>): List<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>