KT-3395 mapOf function can't be used as literal

#KT-3395 Fixed
This commit is contained in:
Svetlana Isakova
2013-03-13 16:16:28 +04:00
parent 7143393172
commit 1b1ee18f97
4 changed files with 48 additions and 0 deletions
@@ -0,0 +1,35 @@
//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
}