-
Notifications
You must be signed in to change notification settings - Fork 548
[RGen] Update the class validator to deal with properties and fields. #23656
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
[RGen] Update the class validator to deal with properties and fields. #23656
Conversation
Weak delegate properties have to start with 'Weak' or provide a strong delegate name for the rgen to generate a unique valid name. Added tests to ensure that both the PropertyValidator and PropertyOrFieldValidator return the correct error.
Add part of the class validator that will analyze a class and will check for several things in the propertites and methods: 1. Validates all fields and properties using the PropertyOrField validator. 2. Validates that WeakDelegates do not use the same strong delegate name. 3. Selectors are unique. Added a end to end test for the class analyzer.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
/// <param name="diagnostics">When this method returns, contains diagnostics for any duplicate selectors; otherwise, an empty array.</param> | ||
/// <param name="location">The code location to be used for the diagnostics.</param> | ||
/// <returns><c>true</c> if all selectors are unique; otherwise, <c>false</c>.</returns> | ||
bool SelectorsAreUnique (Binding binding, RootContext context, |
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.
Selectors can actually be duplicated, it's only a problem if they're exported, which doesn't happen if the [Sealed] attribute is present.
Here's an example:
Lines 5378 to 5388 in 052a9e9
[Internal] | |
[Sealed] | |
[Export ("replaceObjectAtIndex:withObject:")] | |
void _ReplaceObject (nint index, IntPtr withObject); | |
/// <param name="index">To be added.</param> | |
/// <param name="withObject">To be added.</param> | |
/// <summary>To be added.</summary> | |
/// <remarks>To be added.</remarks> | |
[Export ("replaceObjectAtIndex:withObject:")] | |
void ReplaceObject (nint index, NSObject withObject); |
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 think we can leave it as a warning that can be disabled with a #prama so that we know it is a not common situation.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #1062fa8] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #1062fa8] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commit.NET ( No breaking changes )✅ API diff vs stable.NET ( No breaking changes )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #1062fa8] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #1062fa8] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #1062fa8] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #1062fa8] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #1062fa8] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #1062fa8] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 121 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Add part of the class validator that will analyze a class and will check for several things in the propertites and methods:
Added a end to end test for the class analyzer.