Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1191.jet
T
Svetlana Isakova cc244fad94 KT-1191 Wrong detection of unused parameters
KT-1219 Incorrect 'unused value' error in closures
2012-02-24 12:09:02 +04:00

22 lines
492 B
Plaintext

//KT-1191 Wrong detection of unused parameters
package kt1191
trait FunctionalList<T> {
val size: Int
val head: T
val tail: FunctionalList<T>
}
fun <erased T> FunctionalList<T>.plus(element: T) : FunctionalList<T> = object: FunctionalList<T> {
override val size: Int
get() = 1 + this@plus.size
override val tail: FunctionalList<T>
get() = this@plus
override val head: T
get() = element
}
fun foo(unused: Int) = object {
val a : Int get() = unused
}