-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-IDEConcept-Design DebtEngineering Debt, Design Debt, or poor product code qualityEngineering Debt, Design Debt, or poor product code qualityFeature - RecordsRecordsRecordsFeature - Rename
Milestone
Description
Scenario 1 (trigger rename from parameter list in declaration):
record Person(string First, string Second); // change `Second` to `Renamed`
// corresponding synthesized code
class Person
{
public Person(string First, string Second) { this.First = First; this.Second = Second; } // synthesized primary constructor
string First { get; init; }
string Second { get; init; }
...
}
Expected:
Person p = new Person(First: "", Second: ""); // `Second` should be renamed here (works!)
_ = p.Second; // property `Second` should be renamed too
record Student(string First, string Second, int Id) : Base(First: First, Second: Second); // `Second:` should renamed too, like `Student.Second` should be renamed as well (same property, but good to confirm with IDE design)
Scenario 2 (trigger rename from parameter list in declaration, with user-defined property):
record Person(string First, string Second) // `Second` here is just a parameter, no longer refers to property
{
public string Second { get { ... } init { ... } } = Second /* parameter */;
}
Expected:
// same changes as in scenario 1
// we should rename the user-defined property as well (need to confirm with IDE design review)
Scenario 3 (trigger from usage site):
Person p = new Person(First: "", Second: ""); // trigger the rename from `Second:`
_ = p.Second; // trigger the rename from usage of the property
record Person(string First, string Second)
{
public string Second { get { ... } init { ... } } = Second /* parameter */; // trigger rename from property declaration
}
Misc
How do link parameter and property symbols?
- add a compiler API (for example
.AssociateSymbol, problematic because of language design and metadata) - do it manually (syntax shows that we have "record", you can tell which constructor is primary, allows us to find corresponding properties)
Relates to #40726 (test plan for "records")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-IDEConcept-Design DebtEngineering Debt, Design Debt, or poor product code qualityEngineering Debt, Design Debt, or poor product code qualityFeature - RecordsRecordsRecordsFeature - Rename
