[NI] Handle vararg parameter in reflection type wrt array types

Vararg parameter in reflection type is interpreted as covariant
array type against array in expected functional type and as
vararg element type otherwise. For instance having function
fun foo(vararg args: Int): Unit { /*...*/ }
reference ::foo can be passed against expected
(Int) -> Unit,
(Int, Int) -> Unit, etc.
In none of such cases type for parameter in foo's reflection type
should be changed to array.
However, against expected type (IntArray) -> Unit args' type
must become IntArray.

^KT-25514 Fixed
This commit is contained in:
Pavel Kirpichenkov
2019-11-19 19:14:45 +03:00
parent aba5ff0c1e
commit f80a71517f
13 changed files with 173 additions and 8 deletions
@@ -2697,6 +2697,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/callableReference/varargAndDefaults/varargViewedAsArray.kt");
}
@TestMetadata("varargViewedAsPrimitiveArray.kt")
public void testVarargViewedAsPrimitiveArray() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/varargAndDefaults/varargViewedAsPrimitiveArray.kt");
}
@TestMetadata("varargWithDefaultValue.kt")
public void testVarargWithDefaultValue() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/varargAndDefaults/varargWithDefaultValue.kt");