Files
kotlin-fork/compiler/testData/codegen/box/functions/kt3214.kt
T
Alexander Udalov 128c938965 Make Array.size() a function instead of a property
Also add a deprecated extension property to help migration. This is done to
unify getting size of arrays and collections
2014-11-17 15:02:38 +03:00

34 lines
495 B
Kotlin

class A {
fun get(vararg x: Int) = x.size()
}
class B {
fun get(vararg x: Unit) = x.size()
}
fun test1(a: A): Int {
return a[1]
}
fun test2(a: A): Int {
return a[1, 2]
}
fun test3(b: B): Int {
return b[Unit, Unit]
}
fun box() : String {
var result = test1(A())
if (result != 1) return "fail1: $result"
result = test2(A())
if (result != 2) return "fail2: $result"
result = test3(B())
if (result != 2) return "fail3: $result"
return "OK"
}