KT-10939 CANNOT_COMPLETE_RESOLVE for inherited generic interface method
'original' for value parameters of fake override is not a value parameter of unsubstituted fake override. Match value parameters by index.
This commit is contained in:
+5
-1
@@ -69,6 +69,7 @@ class CandidateCallWithArgumentMapping<D : CallableDescriptor, K> private constr
|
||||
val argumentsToParameters = hashMapOf<K, ValueParameterDescriptor>()
|
||||
var parametersWithDefaultValuesCount = 0
|
||||
|
||||
val unsubstitutedValueParameters = call.candidateDescriptor.original.valueParameters
|
||||
for ((valueParameterDescriptor, resolvedValueArgument) in call.unsubstitutedValueArguments.entries) {
|
||||
if (resolvedValueArgument is DefaultValueArgument) {
|
||||
parametersWithDefaultValuesCount++
|
||||
@@ -76,7 +77,10 @@ class CandidateCallWithArgumentMapping<D : CallableDescriptor, K> private constr
|
||||
else {
|
||||
val keys = resolvedArgumentToKeys(resolvedValueArgument)
|
||||
for (argumentKey in keys) {
|
||||
argumentsToParameters[argumentKey] = valueParameterDescriptor.original
|
||||
// TODO fix 'original' for value parameters of Java generic descriptors.
|
||||
// Should be able to use just 'valueParameterDescriptor' below.
|
||||
// Doesn't work for Java generic descriptors. See also KT-10939.
|
||||
argumentsToParameters[argumentKey] = unsubstitutedValueParameters[valueParameterDescriptor.index]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-3
@@ -326,9 +326,6 @@ class OverloadingConflictResolver(private val builtIns: KotlinBuiltIns) {
|
||||
private fun getVarargElementTypeOrType(parameterDescriptor: ValueParameterDescriptor): KotlinType =
|
||||
parameterDescriptor.varargElementType ?: parameterDescriptor.type
|
||||
|
||||
private val CallableDescriptor.hasVarargs: Boolean get() =
|
||||
this.valueParameters.any { it.varargElementType != null }
|
||||
|
||||
private fun typeNotLessSpecific(specific: KotlinType, general: KotlinType): Boolean {
|
||||
val isSubtype = KotlinTypeChecker.DEFAULT.isSubtypeOf(specific, general) || numericTypeMoreSpecific(specific, general)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user