Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt
T
Svetlana Isakova 1b1ee18f97 KT-3395 mapOf function can't be used as literal
#KT-3395 Fixed
2013-03-19 16:47:22 +04:00

36 lines
851 B
Kotlin

//KT-3395 mapOf function can't be used as literal
package b
import java.util.ArrayList
public fun query<T>(<!UNUSED_PARAMETER!>t<!>: T, <!UNUSED_PARAMETER!>args<!>: Map<String, Any>): List<T> {
return ArrayList<T>()
}
fun test(pair: Pair<String, Int>) {
val id = "Hello" // variable is marked as unused
println("Some" + query(0, mapOf(id to 1)))
println("Some" + query(0, mapOf(pair)))
}
//from standard library
fun mapOf<K, V>(vararg <!UNUSED_PARAMETER!>values<!>: Pair<K, V>): Map<K, V> { throw Exception() }
fun <A,B> A.to(<!UNUSED_PARAMETER!>that<!>: B): Pair<A, B> { throw Exception() }
fun println(<!UNUSED_PARAMETER!>message<!> : Any?) { throw Exception() }
class Pair<out A, out B> () {}
//short example
fun foo<T>(t: T) = t
fun test(t: String) {
println("Some" + foo(t)) // t was marked with black square
}