Move data class-related functions to DataClassDescriptorResolver

This commit is contained in:
Alexander Udalov
2016-09-14 12:06:55 +03:00
parent 22f8e7db3b
commit 98f6ea577a
13 changed files with 161 additions and 174 deletions
@@ -0,0 +1,124 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
import org.jetbrains.kotlin.name.Name
object DataClassDescriptorResolver {
val COPY_METHOD_NAME = Name.identifier("copy")
private val COMPONENT_FUNCTION_NAME_PREFIX = "component"
fun createComponentName(index: Int): Name
= Name.identifier(COMPONENT_FUNCTION_NAME_PREFIX + index)
fun getComponentIndex(componentName: String): Int
= componentName.substring(COMPONENT_FUNCTION_NAME_PREFIX.length).toInt()
fun isComponentLike(name: Name): Boolean
= isComponentLike(name.asString())
private fun isComponentLike(name: String): Boolean {
if (!name.startsWith(COMPONENT_FUNCTION_NAME_PREFIX)) return false
try {
getComponentIndex(name)
}
catch (e: NumberFormatException) {
return false
}
return true
}
fun createComponentFunctionDescriptor(
parameterIndex: Int,
property: PropertyDescriptor,
parameter: ValueParameterDescriptor,
classDescriptor: ClassDescriptor,
trace: BindingTrace
): SimpleFunctionDescriptor {
val functionDescriptor = SimpleFunctionDescriptorImpl.create(
classDescriptor,
Annotations.EMPTY,
createComponentName(parameterIndex),
CallableMemberDescriptor.Kind.SYNTHESIZED,
parameter.source
)
functionDescriptor.initialize(
null,
classDescriptor.thisAsReceiverParameter,
emptyList<TypeParameterDescriptor>(),
emptyList<ValueParameterDescriptor>(),
property.type,
Modality.FINAL,
property.visibility
)
functionDescriptor.isOperator = true
trace.record(BindingContext.DATA_CLASS_COMPONENT_FUNCTION, parameter, functionDescriptor)
return functionDescriptor
}
fun createCopyFunctionDescriptor(
constructorParameters: Collection<ValueParameterDescriptor>,
classDescriptor: ClassDescriptor,
trace: BindingTrace
): SimpleFunctionDescriptor {
val functionDescriptor = SimpleFunctionDescriptorImpl.create(
classDescriptor,
Annotations.EMPTY,
COPY_METHOD_NAME,
CallableMemberDescriptor.Kind.SYNTHESIZED,
classDescriptor.source
)
val parameterDescriptors = arrayListOf<ValueParameterDescriptor>()
for (parameter in constructorParameters) {
val propertyDescriptor = trace.bindingContext.get(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter)
// If a parameter doesn't have the corresponding property, it must not have a default value in the 'copy' function
val declaresDefaultValue = propertyDescriptor != null
val parameterDescriptor = ValueParameterDescriptorImpl(
functionDescriptor, null, parameter.index, parameter.annotations, parameter.name, parameter.type, declaresDefaultValue,
parameter.isCrossinline, parameter.isNoinline, parameter.isCoroutine, parameter.varargElementType, parameter.source
)
parameterDescriptors.add(parameterDescriptor)
if (declaresDefaultValue) {
trace.record(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameterDescriptor, propertyDescriptor)
}
}
functionDescriptor.initialize(
null,
classDescriptor.thisAsReceiverParameter,
emptyList<TypeParameterDescriptor>(),
parameterDescriptors,
classDescriptor.defaultType,
Modality.FINAL,
Visibilities.PUBLIC
)
trace.record(BindingContext.DATA_CLASS_COPY_FUNCTION, classDescriptor, functionDescriptor)
return functionDescriptor
}
}
@@ -1,43 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.resolve.dataClassUtils
import org.jetbrains.kotlin.name.Name
private val COMPONENT_FUNCTION_NAME_PREFIX = "component"
fun isComponentLike(name: Name): Boolean
= isComponentLike(name.asString())
fun isComponentLike(name: String): Boolean {
if (!name.startsWith(COMPONENT_FUNCTION_NAME_PREFIX)) return false
try {
getComponentIndex(name)
}
catch (e: NumberFormatException) {
return false
}
return true
}
fun getComponentIndex(componentName: String): Int
= componentName.substring(COMPONENT_FUNCTION_NAME_PREFIX.length).toInt()
fun createComponentName(index: Int): Name
= Name.identifier(COMPONENT_FUNCTION_NAME_PREFIX + index)
@@ -46,7 +46,6 @@ import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory;
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsKt;
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyTypeAliasDescriptor;
import org.jetbrains.kotlin.resolve.scopes.*;
@@ -70,18 +69,16 @@ import static org.jetbrains.kotlin.resolve.ModifiersChecker.resolveMemberModalit
import static org.jetbrains.kotlin.resolve.ModifiersChecker.resolveVisibilityFromModifiers;
public class DescriptorResolver {
public static final Name COPY_METHOD_NAME = Name.identifier("copy");
@NotNull private final TypeResolver typeResolver;
@NotNull private final AnnotationResolver annotationResolver;
@NotNull private final StorageManager storageManager;
@NotNull private final KotlinBuiltIns builtIns;
@NotNull private final SupertypeLoopChecker supertypeLoopsResolver;
@NotNull private final VariableTypeResolver variableTypeResolver;
@NotNull private final ExpressionTypingServices expressionTypingServices;
@NotNull private final OverloadChecker overloadChecker;
@NotNull private final LanguageFeatureSettings languageFeatureSettings;
@NotNull private final FunctionsTypingVisitor functionsTypingVisitor;
private final TypeResolver typeResolver;
private final AnnotationResolver annotationResolver;
private final StorageManager storageManager;
private final KotlinBuiltIns builtIns;
private final SupertypeLoopChecker supertypeLoopsResolver;
private final VariableTypeResolver variableTypeResolver;
private final ExpressionTypingServices expressionTypingServices;
private final OverloadChecker overloadChecker;
private final LanguageFeatureSettings languageFeatureSettings;
private final FunctionsTypingVisitor functionsTypingVisitor;
public DescriptorResolver(
@NotNull AnnotationResolver annotationResolver,
@@ -227,91 +224,6 @@ public class DescriptorResolver {
}
}
@NotNull
public static SimpleFunctionDescriptor createComponentFunctionDescriptor(
int parameterIndex,
@NotNull PropertyDescriptor property,
@NotNull ValueParameterDescriptor parameter,
@NotNull ClassDescriptor classDescriptor,
@NotNull BindingTrace trace
) {
Name functionName = DataClassUtilsKt.createComponentName(parameterIndex);
KotlinType returnType = property.getType();
SimpleFunctionDescriptorImpl functionDescriptor = SimpleFunctionDescriptorImpl.create(
classDescriptor,
Annotations.Companion.getEMPTY(),
functionName,
CallableMemberDescriptor.Kind.SYNTHESIZED,
parameter.getSource()
);
functionDescriptor.initialize(
null,
classDescriptor.getThisAsReceiverParameter(),
Collections.<TypeParameterDescriptor>emptyList(),
Collections.<ValueParameterDescriptor>emptyList(),
returnType,
Modality.FINAL,
property.getVisibility()
);
functionDescriptor.setOperator(true);
trace.record(BindingContext.DATA_CLASS_COMPONENT_FUNCTION, parameter, functionDescriptor);
return functionDescriptor;
}
@NotNull
public static SimpleFunctionDescriptor createCopyFunctionDescriptor(
@NotNull Collection<ValueParameterDescriptor> constructorParameters,
@NotNull ClassDescriptor classDescriptor,
@NotNull BindingTrace trace
) {
KotlinType returnType = classDescriptor.getDefaultType();
SimpleFunctionDescriptorImpl functionDescriptor = SimpleFunctionDescriptorImpl.create(
classDescriptor,
Annotations.Companion.getEMPTY(),
COPY_METHOD_NAME,
CallableMemberDescriptor.Kind.SYNTHESIZED,
classDescriptor.getSource()
);
List<ValueParameterDescriptor> parameterDescriptors = Lists.newArrayList();
for (ValueParameterDescriptor parameter : constructorParameters) {
PropertyDescriptor propertyDescriptor = trace.getBindingContext().get(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameter);
// If parameter hasn't corresponding property, so it mustn't have default value as a parameter in copy function for data class
boolean declaresDefaultValue = propertyDescriptor != null;
ValueParameterDescriptorImpl parameterDescriptor =
new ValueParameterDescriptorImpl(functionDescriptor, null, parameter.getIndex(), parameter.getAnnotations(),
parameter.getName(), parameter.getType(),
declaresDefaultValue,
parameter.isCrossinline(),
parameter.isNoinline(),
parameter.isCoroutine(),
parameter.getVarargElementType(), parameter.getSource());
parameterDescriptors.add(parameterDescriptor);
if (declaresDefaultValue) {
trace.record(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameterDescriptor, propertyDescriptor);
}
}
functionDescriptor.initialize(
null,
classDescriptor.getThisAsReceiverParameter(),
Collections.<TypeParameterDescriptor>emptyList(),
parameterDescriptors,
returnType,
Modality.FINAL,
Visibilities.PUBLIC
);
trace.record(BindingContext.DATA_CLASS_COPY_FUNCTION, classDescriptor, functionDescriptor);
return functionDescriptor;
}
public static Visibility getDefaultVisibility(KtModifierListOwner modifierListOwner, DeclarationDescriptor containingDescriptor) {
Visibility defaultVisibility;
if (containingDescriptor instanceof ClassDescriptor) {
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.CallResolverUtilKt;
import org.jetbrains.kotlin.resolve.dataClassUtils.DataClassUtilsKt;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
@@ -583,7 +582,7 @@ public class OverrideResolver {
private void checkOverrideForMember(@NotNull final CallableMemberDescriptor declared) {
if (declared.getKind() == CallableMemberDescriptor.Kind.SYNTHESIZED) {
if (DataClassUtilsKt.isComponentLike(declared.getName())) {
if (DataClassDescriptorResolver.INSTANCE.isComponentLike(declared.getName())) {
checkOverrideForComponentFunction(declared);
}
return;
@@ -32,8 +32,6 @@ import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtProperty
import org.jetbrains.kotlin.psi.KtTypeReference
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.dataClassUtils.createComponentName
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.resolve.lazy.LazyClassContext
import org.jetbrains.kotlin.resolve.lazy.declarations.ClassMemberDeclarationProvider
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
@@ -148,7 +146,7 @@ open class LazyClassMemberScope(
val primaryConstructorParameters = declarationProvider.getOwnerInfo().primaryConstructorParameters
assert(constructor.valueParameters.size == primaryConstructorParameters.size) { "From descriptor: " + constructor.valueParameters.size + " but from PSI: " + primaryConstructorParameters.size }
if (isComponentLike(name)) {
if (DataClassDescriptorResolver.isComponentLike(name)) {
var componentIndex = 0
for (parameter in constructor.valueParameters) {
@@ -162,22 +160,22 @@ open class LazyClassMemberScope(
++componentIndex
if (name == createComponentName(componentIndex)) {
val functionDescriptor = DescriptorResolver.createComponentFunctionDescriptor(componentIndex, property, parameter, thisDescriptor, trace)
result.add(functionDescriptor)
if (name == DataClassDescriptorResolver.createComponentName(componentIndex)) {
result.add(DataClassDescriptorResolver.createComponentFunctionDescriptor(
componentIndex, property, parameter, thisDescriptor, trace
))
break
}
}
}
if (name == DescriptorResolver.COPY_METHOD_NAME) {
if (name == DataClassDescriptorResolver.COPY_METHOD_NAME) {
for (parameter in constructor.valueParameters) {
// force properties resolution to fill BindingContext.VALUE_PARAMETER_AS_PROPERTY slice
getContributedVariables(parameter.name, location)
}
val copyFunctionDescriptor = DescriptorResolver.createCopyFunctionDescriptor(constructor.valueParameters, thisDescriptor, trace)
result.add(copyFunctionDescriptor)
result.add(DataClassDescriptorResolver.createCopyFunctionDescriptor(constructor.valueParameters, thisDescriptor, trace))
}
}
@@ -257,7 +255,7 @@ open class LazyClassMemberScope(
// Generate componentN functions until there's no such function for some n
var n = 1
while (true) {
val componentName = createComponentName(n)
val componentName = DataClassDescriptorResolver.createComponentName(n)
val functions = getContributedFunctions(componentName, location)
if (functions.isEmpty()) break
@@ -22,9 +22,9 @@ import org.jetbrains.kotlin.psi.KtDestructuringDeclaration
import org.jetbrains.kotlin.psi.KtDestructuringDeclarationEntry
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.resolve.LocalVariableResolver
import org.jetbrains.kotlin.resolve.TypeResolver
import org.jetbrains.kotlin.resolve.dataClassUtils.createComponentName
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.types.ErrorUtils
@@ -45,7 +45,7 @@ class DestructuringDeclarationResolver(
context: ExpressionTypingContext
) {
for ((componentIndex, entry) in destructuringDeclaration.entries.withIndex()) {
val componentName = createComponentName(componentIndex + 1)
val componentName = DataClassDescriptorResolver.createComponentName(componentIndex + 1)
val componentType = resolveComponentFunctionAndGetType(componentName, context, entry, receiver, initializer)
val variableDescriptor = localVariableResolver.resolveLocalVariableDescriptorWithType(writableScope, entry, componentType, context.trace)
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
import org.jetbrains.kotlin.psi.stubs.impl.KotlinFunctionStubImpl
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPlaceHolderStubImpl
import org.jetbrains.kotlin.psi.stubs.impl.KotlinPropertyStubImpl
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.ProtoBuf.MemberKind
@@ -78,7 +78,7 @@ private fun shouldSkip(flags: Int, name: Name): Boolean {
return when (Flags.MEMBER_KIND.get(flags)) {
MemberKind.FAKE_OVERRIDE, MemberKind.DELEGATION -> true
//TODO: fix decompiler to use sane criteria
MemberKind.SYNTHESIZED -> !isComponentLike(name)
MemberKind.SYNTHESIZED -> !DataClassDescriptorResolver.isComponentLike(name)
else -> false
}
}
@@ -24,8 +24,8 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
import org.jetbrains.kotlin.renderer.DescriptorRendererOptions
import org.jetbrains.kotlin.renderer.ExcludedTypeAnnotations
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.resolve.descriptorUtil.secondaryConstructors
import org.jetbrains.kotlin.types.isFlexible
@@ -139,7 +139,7 @@ fun buildDecompiledText(
if (member is CallableMemberDescriptor
&& member.kind != CallableMemberDescriptor.Kind.DECLARATION
//TODO: not synthesized and component like
&& !isComponentLike(member.name)) {
&& !DataClassDescriptorResolver.isComponentLike(member.name)) {
continue
}
newlineExceptFirst()
@@ -40,9 +40,8 @@ import org.jetbrains.kotlin.psi.psiUtil.getParentOfTypeAndBranch
import org.jetbrains.kotlin.psi.psiUtil.getQualifiedElement
import org.jetbrains.kotlin.psi.psiUtil.getQualifiedElementSelector
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.renderer.render
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.types.expressions.OperatorConventions
class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleReference<KtSimpleNameExpression>(expression) {
@@ -106,7 +105,7 @@ class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleRefere
// Do not rename if the reference corresponds to synthesized component function
val expressionText = expression.text
if (expressionText != null && Name.isValidIdentifier(expressionText)) {
if (isComponentLike(Name.identifier(expressionText)) && resolve() is KtParameter) {
if (DataClassDescriptorResolver.isComponentLike(Name.identifier(expressionText)) && resolve() is KtParameter) {
return expression
}
}
@@ -39,8 +39,7 @@ import org.jetbrains.kotlin.idea.util.fuzzyExtensionReceiverType
import org.jetbrains.kotlin.idea.util.toFuzzyType
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.dataClassUtils.getComponentIndex
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
import org.jetbrains.kotlin.types.expressions.OperatorConventions
import org.jetbrains.kotlin.util.OperatorNameConventions
@@ -125,9 +124,9 @@ abstract class OperatorReferenceSearcher<TReferenceElement : KtElement>(
options: KotlinReferencesSearchOptions,
searchScope: SearchScope
): OperatorReferenceSearcher<*>? {
if (isComponentLike(name)) {
if (DataClassDescriptorResolver.isComponentLike(name)) {
if (!options.searchForComponentConventions) return null
val componentIndex = getComponentIndex(name.asString())
val componentIndex = DataClassDescriptorResolver.getComponentIndex(name.asString())
return DestructuringDeclarationReferenceSearcher(declaration, componentIndex, searchScope, consumer, optimizer)
}
@@ -35,9 +35,9 @@ import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.dataClassUtils.getComponentIndex
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.types.ErrorUtils
@@ -199,7 +199,7 @@ class ChangeFunctionReturnTypeFix(element: KtFunction, type: KotlinType) : Kotli
companion object {
fun getDestructuringDeclarationEntryThatTypeMismatchComponentFunction(diagnostic: Diagnostic): KtDestructuringDeclarationEntry {
val componentName = COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH.cast(diagnostic).a
val componentIndex = getComponentIndex(componentName.asString())
val componentIndex = DataClassDescriptorResolver.getComponentIndex(componentName.asString())
val multiDeclaration = QuickFixUtil.getParentElementOfType(diagnostic, KtDestructuringDeclaration::class.java) ?: error("COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH reported on expression that is not within any multi declaration")
return multiDeclaration.entries[componentIndex - 1]
}
@@ -24,8 +24,7 @@ import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.Functi
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.TypeInfo
import org.jetbrains.kotlin.psi.KtDestructuringDeclaration
import org.jetbrains.kotlin.psi.KtForExpression
import org.jetbrains.kotlin.resolve.dataClassUtils.getComponentIndex
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.types.Variance
object CreateComponentFunctionActionFactory : CreateCallableMemberFromUsageFactory<KtDestructuringDeclaration>() {
@@ -38,9 +37,9 @@ object CreateComponentFunctionActionFactory : CreateCallableMemberFromUsageFacto
val diagnosticWithParameters = Errors.COMPONENT_FUNCTION_MISSING.cast(diagnostic)
val name = diagnosticWithParameters.a
if (!isComponentLike(name)) return null
if (!DataClassDescriptorResolver.isComponentLike(name)) return null
val componentNumber = getComponentIndex(name.asString()) - 1
val componentNumber = DataClassDescriptorResolver.getComponentIndex(name.asString()) - 1
val ownerType = element.initializer?.let { TypeInfo(it, Variance.IN_VARIANCE) }
?: TypeInfo(diagnosticWithParameters.b, Variance.IN_VARIANCE)
@@ -55,9 +55,9 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
import org.jetbrains.kotlin.psi.psiUtil.findPropertyByName
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.dataClassUtils.isComponentLike
import org.jetbrains.kotlin.resolve.source.getPsi
import org.jetbrains.kotlin.util.findCallableMemberBySignature
import org.jetbrains.kotlin.utils.DFS
@@ -349,7 +349,7 @@ class RenameKotlinPropertyProcessor : RenameKotlinPsiProcessor() {
val adjustedUsages = if (element is KtParameter) usages.filterNot {
val refTarget = it.reference?.resolve()
refTarget is KtLightMethod && isComponentLike(Name.guessByFirstCharacter(refTarget.name))
refTarget is KtLightMethod && DataClassDescriptorResolver.isComponentLike(Name.guessByFirstCharacter(refTarget.name))
} else usages.toList()
val refKindUsages = adjustedUsages.groupBy { usage: UsageInfo ->