diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt index 5b8a7233c51..d172d429156 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt @@ -19,7 +19,7 @@ package org.jetbrains.kotlin.idea.util import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.resolve.calls.inference.CallHandle import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl @@ -94,8 +94,8 @@ class FuzzyType( } private fun TypeParameterDescriptor.toOriginal(): TypeParameterDescriptor { - val functionDescriptor = containingDeclaration as? FunctionDescriptor ?: return this - return functionDescriptor.original.typeParameters[index] + val callableDescriptor = containingDeclaration as? CallableMemberDescriptor ?: return this + return callableDescriptor.original.typeParameters[index] } override fun equals(other: Any?) = other is FuzzyType && other.type == type && other.freeParameters == freeParameters diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/TypesWithOperatorDetector.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/TypesWithOperatorDetector.kt index dd926ae8812..12d445d0747 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/TypesWithOperatorDetector.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/TypesWithOperatorDetector.kt @@ -38,7 +38,7 @@ abstract class TypesWithOperatorDetector( private val scope: LexicalScope, private val indicesHelper: KotlinIndicesHelper? ) { - protected abstract fun checkIsSuitableByType(function: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? + protected abstract fun checkIsSuitableByType(operator: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? private val cache = HashMap?>() @@ -109,9 +109,9 @@ class TypesWithContainsDetector( private val argumentType: KotlinType ) : TypesWithOperatorDetector(OperatorNameConventions.CONTAINS, scope, indicesHelper) { - override fun checkIsSuitableByType(function: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? { - val parameter = function.valueParameters.single() - val fuzzyParameterType = FuzzyType(parameter.type, function.typeParameters + freeTypeParams) + override fun checkIsSuitableByType(operator: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? { + val parameter = operator.valueParameters.single() + val fuzzyParameterType = FuzzyType(parameter.type, operator.typeParameters + freeTypeParams) return fuzzyParameterType.checkIsSuperTypeOf(argumentType) } } @@ -123,13 +123,13 @@ class TypesWithGetValueDetector( private val propertyType: KotlinType? ) : TypesWithOperatorDetector(OperatorNameConventions.GET_VALUE, scope, indicesHelper) { - override fun checkIsSuitableByType(function: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? { - val paramType = FuzzyType(function.valueParameters.first().type, freeTypeParams) + override fun checkIsSuitableByType(operator: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? { + val paramType = FuzzyType(operator.valueParameters.first().type, freeTypeParams) val substitutor = paramType.checkIsSuperTypeOf(propertyOwnerType) ?: return null if (propertyType == null) return substitutor - val fuzzyReturnType = FuzzyType(function.returnType ?: return null, freeTypeParams) + val fuzzyReturnType = FuzzyType(operator.returnType ?: return null, freeTypeParams) val substitutorFromPropertyType = fuzzyReturnType.checkIsSubtypeOf(propertyType) ?: return null return TypeSubstitutor.createChainedSubstitutor(substitutor.substitution, substitutorFromPropertyType.substitution) } @@ -141,8 +141,8 @@ class TypesWithSetValueDetector( private val propertyOwnerType: KotlinType ) : TypesWithOperatorDetector(OperatorNameConventions.SET_VALUE, scope, indicesHelper) { - override fun checkIsSuitableByType(function: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? { - val paramType = FuzzyType(function.valueParameters.first().type, freeTypeParams) + override fun checkIsSuitableByType(operator: FunctionDescriptor, freeTypeParams: Collection): TypeSubstitutor? { + val paramType = FuzzyType(operator.valueParameters.first().type, freeTypeParams) return paramType.checkIsSuperTypeOf(propertyOwnerType) } } \ No newline at end of file