[NI] Preserve name of parameters for functional types

This commit is contained in:
Mikhail Zarechenskiy
2017-06-27 19:23:11 +03:00
parent 5ec8d4920f
commit 39349abd39
6 changed files with 33 additions and 1 deletions
@@ -84,7 +84,7 @@ internal object NoTypeArguments : ResolutionPart {
internal object MapArguments : ResolutionPart {
override fun SimpleKotlinResolutionCandidate.process(): List<KotlinCallDiagnostic> {
val mapping = callContext.argumentsToParametersMapper.mapArguments(kotlinCall, candidateDescriptor.original)
val mapping = callContext.argumentsToParametersMapper.mapArguments(kotlinCall, candidateDescriptor)
argumentMappingByOriginal = mapping.parameterToCallArgumentMap
return mapping.diagnostics
}
@@ -0,0 +1,8 @@
fun <T> test(a: T, b: T, operation: (x: T) -> T) {
operation(if (3 > 2) a else b)
}
fun box(): String {
test(1, 1, { it })
return "OK"
}
@@ -4631,6 +4631,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
doTest(fileName);
}
@TestMetadata("parameterWithNameForFunctionType.kt")
public void testParameterWithNameForFunctionType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/parameterWithNameForFunctionType.kt");
doTest(fileName);
}
@TestMetadata("quicksort.kt")
public void testQuicksort() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/quicksort.kt");
@@ -4631,6 +4631,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("parameterWithNameForFunctionType.kt")
public void testParameterWithNameForFunctionType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/parameterWithNameForFunctionType.kt");
doTest(fileName);
}
@TestMetadata("quicksort.kt")
public void testQuicksort() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/quicksort.kt");
@@ -4631,6 +4631,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
doTest(fileName);
}
@TestMetadata("parameterWithNameForFunctionType.kt")
public void testParameterWithNameForFunctionType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/parameterWithNameForFunctionType.kt");
doTest(fileName);
}
@TestMetadata("quicksort.kt")
public void testQuicksort() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/quicksort.kt");
@@ -5327,6 +5327,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
doTest(fileName);
}
@TestMetadata("parameterWithNameForFunctionType.kt")
public void testParameterWithNameForFunctionType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/parameterWithNameForFunctionType.kt");
doTest(fileName);
}
@TestMetadata("quicksort.kt")
public void testQuicksort() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/quicksort.kt");