Support for named arguments in dynamic calls
This commit is contained in:
@@ -109,15 +109,14 @@ object DynamicCallableDescriptors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createValueParameters(owner: DeclarationDescriptor, call: Call): List<ValueParameterDescriptor> =
|
private fun createValueParameters(owner: DeclarationDescriptor, call: Call): List<ValueParameterDescriptor> =
|
||||||
call.getValueArguments().indices.map {
|
call.getValueArguments().withIndices().map { p ->
|
||||||
index
|
val (index, arg) = p
|
||||||
->
|
|
||||||
ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl(
|
||||||
owner,
|
owner,
|
||||||
null,
|
null,
|
||||||
index,
|
index,
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
Name.identifier("p$index"),
|
arg.getArgumentName()?.getReferenceExpression()?.getReferencedNameAsName() ?: Name.identifier("p$index"),
|
||||||
DynamicType,
|
DynamicType,
|
||||||
false,
|
false,
|
||||||
null,
|
null,
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// MODULE[js]: m1
|
||||||
|
// FILE: k.kt
|
||||||
|
|
||||||
|
fun test(d: dynamic) {
|
||||||
|
d.foo(name = "name")
|
||||||
|
|
||||||
|
d.foo(1, name = "name")
|
||||||
|
|
||||||
|
d.foo(1, duplicate = "", <!ARGUMENT_PASSED_TWICE!>duplicate<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
internal fun test(/*0*/ d: dynamic): kotlin.Unit
|
||||||
@@ -3746,6 +3746,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("namedArguments.kt")
|
||||||
|
public void testNamedArguments() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/namedArguments.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nullable.kt")
|
@TestMetadata("nullable.kt")
|
||||||
public void testNullable() throws Exception {
|
public void testNullable() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/nullable.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/nullable.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user