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> =
|
||||
call.getValueArguments().indices.map {
|
||||
index
|
||||
->
|
||||
call.getValueArguments().withIndices().map { p ->
|
||||
val (index, arg) = p
|
||||
ValueParameterDescriptorImpl(
|
||||
owner,
|
||||
null,
|
||||
index,
|
||||
Annotations.EMPTY,
|
||||
Name.identifier("p$index"),
|
||||
arg.getArgumentName()?.getReferenceExpression()?.getReferencedNameAsName() ?: Name.identifier("p$index"),
|
||||
DynamicType,
|
||||
false,
|
||||
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);
|
||||
}
|
||||
|
||||
@TestMetadata("namedArguments.kt")
|
||||
public void testNamedArguments() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/namedArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullable.kt")
|
||||
public void testNullable() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/nullable.kt");
|
||||
|
||||
Reference in New Issue
Block a user