KT-12305 Fix passing single argument to native vararg function
This commit is contained in:
+6
-1
@@ -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
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user