-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field-backed properties: [field:] should not be considered a backing field reference #75461
Conversation
var attributes = attributeList.Attributes; | ||
for (int i = 0; i < attributes.Count; i++) | ||
{ | ||
if (containsFieldExpressionInGreenNode(attributes[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so is the idea that this way of visiting the syntax is skipping the attribute target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we're skipping the attribute target. I've since changed containsFieldExpressionInGreenNode()
to look for FieldExpression
rather than FieldToken
, so this change is no longer strictly necessary, but it seemed reasonable to me to keep both changes.
An attribute with a
field:
target used on a property accessor was incorrectly considered a reference to the backing field, resulting in a synthesized field for the property.Fixes #75459.