Added tests for parameter names in function type from SAM-adapter + fixed KT-13861

#KT-13861 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-09-14 21:38:26 +03:00
parent 59269ef1ae
commit a62a37f6d8
11 changed files with 79 additions and 10 deletions
@@ -355,7 +355,12 @@ abstract class KotlinParameterInfoWithCallHandlerBase<TArgumentList : KtElement,
}
val candidates = callToUse.resolveCandidates(bindingContext, resolutionFacade)
val resolvedCall = candidates.firstOrNull { descriptorsEqual(it.resultingDescriptor, overload) } ?: return null
// First try to find strictly matching descriptor, then one with the same declaration.
// The second way is needed for the case when the descriptor was invalidated and new one has been built.
// See testLocalFunctionBug().
val resolvedCall = candidates.singleOrNull { it.resultingDescriptor.original == overload.original }
?: candidates.singleOrNull { descriptorsEqual(it.resultingDescriptor, overload) }
?: return null
val resultingDescriptor = resolvedCall.resultingDescriptor
fun argumentToParameter(argument: ValueArgument): ValueParameterDescriptor? {