Support for named arguments in dynamic calls

This commit is contained in:
Andrey Breslav
2014-11-13 04:03:41 +02:00
parent 0ebc478d50
commit 645d931a9e
4 changed files with 22 additions and 4 deletions
@@ -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");