-
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
Partial properties: merging declarations and emit of simple cases #72999
Partial properties: merging declarations and emit of simple cases #72999
Conversation
2332072
to
71d62ff
Compare
8dba532
to
a77b9f4
Compare
a77b9f4
to
f23ba9a
Compare
@@ -545,22 +545,28 @@ internal static bool IsExplicitInterfaceImplementation(this Symbol member) | |||
} | |||
} | |||
|
|||
internal static bool IsPartialMethod(this Symbol member) | |||
internal static bool IsPartialMember(this Symbol member) |
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.
I did consider introducing some new members on a common base type, or introducing an IPartialMemberSymbol
interface or something similar. But ultimately I think extension methods with type tests is an appropriate level of abstraction for this feature.
I am meaning to add a debug assertion that these methods are only used with original definition symbols. I'll try and add a check for that in future PR.
src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.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 1)
I have addressed the feedback, please take another look at your convenience @jcouv. |
src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs
Outdated
Show resolved
Hide resolved
I have addressed the next round of feedback, please take another look at your convenience @jcouv. |
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 3)
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.
Leaving my feedback on the impl now. Still need to review tests.
src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertyAccessorSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.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 review pass.
src/Compilers/CSharp/Test/Symbol/Symbols/PartialPropertiesTests.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Symbol/Symbols/PartialPropertiesTests.cs
Outdated
Show resolved
Hide resolved
// not the implementation (member.Locations includes both parts). If the | ||
// span is in fact in the implementation, return that member instead. | ||
if (sym switch | ||
#pragma warning disable format |
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.
nit: could we link to a tracking issue? Is the problem what's described in #46464?
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.
Alternatively, take the switch
out of the if
?
Symbol implementation = sym switch
{
MethodSymbol method => method.PartialImplementationPart,
SourcePropertySymbol property => property.PartialImplementationPart,
_ => throw ExceptionUtilities.UnexpectedValue(sym)
};
if (implementation is { } && InSpan(implementation.GetFirstLocation(), this.syntaxTree, memberSpan))
{
result = implementation;
return true;
}
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.
I am not sure, I feel like it is more likely to have the same cause as #73251
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.
I would be willing to do either including a link or extracting the switch in a follow-up PR. I almost feel a little defiant toward keeping the current factoring since I want the formatter to be fixed :)
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.
I'd like it fixed too :-) But all the related issues are currently marked as Backlog :-/
It would help to add links and screenshots to get a fix prioritized
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
src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs
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.
LGTM Thanks (iteration 6) with a minor comment to consider
c3f13e3
into
dotnet:features/partial-properties
Test plan: #73090