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 {
|
else {
|
||||||
kind = translateVarargArgument(arguments, result, argContext, !isNativeFunctionCall)
|
kind = if (isNativeFunctionCall) {
|
||||||
|
translateValueArguments(arguments, result, argContext)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
translateVarargArgument(arguments, result, argContext, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ fun box(): String {
|
|||||||
if (paramCount() != 0)
|
if (paramCount() != 0)
|
||||||
return "failed when call native function without args"
|
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)
|
if (paramCount(1, 2, 3) != 3)
|
||||||
return "failed when call native function with some args"
|
return "failed when call native function with some args"
|
||||||
|
|
||||||
@@ -93,6 +95,12 @@ fun box(): String {
|
|||||||
if (!spreadInMethodCall(2, 1, 2))
|
if (!spreadInMethodCall(2, 1, 2))
|
||||||
return "failed when call method using spread operator"
|
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)))
|
if (!(obj.test(5, 1, 2, 3, 4, 5)))
|
||||||
return "failed when call method of object"
|
return "failed when call method of object"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user