Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/commonSystem/kt3372toCollection.kt
T
2015-07-10 15:05:07 +03:00

12 lines
337 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
// !CHECK_TYPE
// KT-3372 Use upper bound in type argument inference
import java.util.HashSet
fun <T, C: MutableCollection<T>> Iterable<T>.toCollection(result: C) : C = throw Exception()
fun test(list: List<Int>) {
val set = list.toCollection(HashSet())
set checkType { _<HashSet<Int>>() }
}