KT-3214: Verify error when get array convention is used with varargs

#KT-3214 Can'tReproduce
This commit is contained in:
Mikhael Bogdanov
2014-04-01 10:53:39 +04:00
parent 596dc68ea4
commit 4269729b0a
2 changed files with 38 additions and 0 deletions
@@ -0,0 +1,33 @@
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.VALUE, Unit.VALUE]
}
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"
}