KT-3214: Verify error when get array convention is used with varargs
#KT-3214 Can'tReproduce
This commit is contained in:
@@ -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"
|
||||
}
|
||||
@@ -2817,6 +2817,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest("compiler/testData/codegen/box/functions/kt2929.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3214.kt")
|
||||
public void testKt3214() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/kt3214.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt3313.kt")
|
||||
public void testKt3313() throws Exception {
|
||||
doTest("compiler/testData/codegen/box/functions/kt3313.kt");
|
||||
|
||||
Reference in New Issue
Block a user