-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Partial properties: attributes #73437
Partial properties: attributes #73437
Conversation
@@ -1087,10 +1093,29 @@ private CustomAttributesBag<CSharpAttributeData> GetAttributesBag() | |||
return bag; | |||
} | |||
|
|||
// The property is responsible for completion of the backing field | |||
_ = BackingField?.GetAttributes(); | |||
var copyFrom = this.BoundAttributesSource; |
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.
Compare with SourceMethodSymbolWithAttributes.GetAttributesBag
780ebde
to
9edf5b5
Compare
0c68bb7
to
98e4536
Compare
src/Compilers/CSharp/Portable/Symbols/Source/FieldSymbolWithAttributesAndModifiers.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs
Show resolved
Hide resolved
Not related to this PR: it seems the only use we have for Refers to: src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbolBase.cs:92 in 3ce6777. [](commit_id = 3ce6777, deletion_comment = False) |
src/Compilers/CSharp/Test/Symbol/Symbols/PartialPropertiesTests.cs
Outdated
Show resolved
Hide resolved
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.
Done with review pass (iteration 3)
For those outside of CodeFlow, context is: roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs Lines 338 to 360 in e5d344a
These comments seem wrong, it feels most reasonable to me to just delete them. |
…tAttributeDeclarations()
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.
LGTM Thanks (iteration 13)
@333fred for second review |
src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs
Outdated
Show resolved
Hide resolved
@jcouv feel free to follow up in this PR if you had more comments on the more recent changes, I can be sure to address in subsequent PR. |
28c886c
into
dotnet:features/partial-properties
Hey @RikkiGibson, couldn't find this specific bit in the spec, is this planned to work? // User code
[field: Foo]
public partial string Name { get; set; }
// Generated.g.cs
private string _name;
public string Name { get => _name; set => _name = value; } Or would this not work because Roslyn wouldn't be able to know what backing field the partial property implementation would be using? IIRC we discussed allowing |
That's right. It's possible that field keyword in properties will also land this release, which might make your generator's job easier, but otherwise, you'll be looking at suppressing the compiler warning about a bad attribute target, and "forwarding" the attribute to the field, as I think you've done before from a field to a property. |
Test plan: #73090
Related spec change: dotnet/csharplang#8127