the source for a parameter of the generated copy() function is the corresponding constructor parameter
#KT-8698 Fixed
This commit is contained in:
@@ -268,7 +268,7 @@ public class DescriptorResolver {
|
|||||||
new ValueParameterDescriptorImpl(functionDescriptor, null, parameter.getIndex(), parameter.getAnnotations(),
|
new ValueParameterDescriptorImpl(functionDescriptor, null, parameter.getIndex(), parameter.getAnnotations(),
|
||||||
parameter.getName(), parameter.getType(),
|
parameter.getName(), parameter.getType(),
|
||||||
declaresDefaultValue,
|
declaresDefaultValue,
|
||||||
parameter.getVarargElementType(), SourceElement.NO_SOURCE);
|
parameter.getVarargElementType(), parameter.getSource());
|
||||||
parameterDescriptors.add(parameterDescriptor);
|
parameterDescriptors.add(parameterDescriptor);
|
||||||
if (declaresDefaultValue) {
|
if (declaresDefaultValue) {
|
||||||
trace.record(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameterDescriptor, propertyDescriptor);
|
trace.record(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameterDescriptor, propertyDescriptor);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
data class A(val <caret>x: Int)
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val a = A(x = 1)
|
||||||
|
val b = a.copy(x = 2)
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
data class A(val y: Int)
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val a = A(y = 1)
|
||||||
|
val b = a.copy(y = 2)
|
||||||
|
}
|
||||||
+4
@@ -51,6 +51,10 @@ public class SimpleNameReferenceRenameTest extends LightCodeInsightTestCase {
|
|||||||
doTest("xyzzy");
|
doTest("xyzzy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testParameterOfCopyMethod() throws Exception {
|
||||||
|
doTest("y");
|
||||||
|
}
|
||||||
|
|
||||||
private void doTest(String newName) throws Exception {
|
private void doTest(String newName) throws Exception {
|
||||||
configureByFile(getTestName(true) + ".kt");
|
configureByFile(getTestName(true) + ".kt");
|
||||||
PsiElement element = TargetElementUtilBase
|
PsiElement element = TargetElementUtilBase
|
||||||
|
|||||||
Reference in New Issue
Block a user