KT-12305 Fix passing single argument to native vararg function

This commit is contained in:
Alexey Andreev
2016-05-16 15:01:49 +03:00
parent a0e8ed7186
commit 2f42f3bdf6
2 changed files with 15 additions and 2 deletions
@@ -115,7 +115,12 @@ class CallArgumentTranslator private constructor(
}
}
else {
kind = translateVarargArgument(arguments, result, argContext, !isNativeFunctionCall)
kind = if (isNativeFunctionCall) {
translateValueArguments(arguments, result, argContext)
}
else {
translateVarargArgument(arguments, result, argContext, true)
}
}
}
else {
+9 -1
View File
@@ -72,6 +72,8 @@ fun box(): String {
if (paramCount() != 0)
return "failed when call native function without args"
if (paramCount(1) != 1) return "failed when call native function with single vararg"
if (paramCount(1, 2, 3) != 3)
return "failed when call native function with some args"
@@ -93,6 +95,12 @@ fun box(): String {
if (!spreadInMethodCall(2, 1, 2))
return "failed when call method using spread operator"
if (!Bar(1).test(0, 1, 1))
return "failed when call method with single arg"
if (!spreadInMethodCall(2, 1, 2))
return "failed when call method using spread operator"
if (!(obj.test(5, 1, 2, 3, 4, 5)))
return "failed when call method of object"
@@ -146,4 +154,4 @@ fun box(): String {
assertEquals(6, idArrayVarArg(arrayOf(1, 2), *arrayOf(arrayOf(3, 4), arrayOf(5, 6)), arrayOf(7), *arrayOf(arrayOf(8, 9), arrayOf(10, 11))).size)
return "OK"
}
}