-
Notifications
You must be signed in to change notification settings - Fork 548
[RGen] Update string strategy to fail on empty selectors. #23646
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
Conversation
Add the baseic checks to ensue that a user did not use any of the fields of the ExportAttribute<T> that are only allowed with ExportAttribute<Method>.
1. Make sure that the native prefix/suffix does not have white spaces. 2. Make sure that the async method name does not have white spaces. 3. Make sure that the different type names do not have white spaces. Tests got added for all the new strategies.
Passing the RootContext will allow to provide the compilation information such as the target platform of the current compilation this can be used to make better decisions.
… and a set of validators. Move the analyzer to use the Validator approach, this removes the need to add some code duplication to parse the AST. This new approach re-uses the data model of rgen to parse the AST and uses a validator to ensure that the data struct is correct. The SmartEnumsAnalyzer will be remove in later commits as soon as we have the SmartEnumValidator implemented with the same checks.
This commit implements the validation of SmartEnums. There are some changes in how we generate the enums since we now can relay on the analyzer to raise errors and be just let the struct parse the ast/semantic model. The analyzer checks for the following errors: 1. A SmartEnum must have at least ONE memeber that points to a native value. We allow to have other memebers without it to allow things such as "FIRST = LAST". 2. All fields should be unique. We cannot have two fields pointing to the same native value. 3. The fields are a valid identifier. 4. The library paths are set when in a custom namespace. 5. The library paths should not be set when working with a Apple framework. 6. Ensure that if a enum or enum value is present in the compilation, that the platform is marked as supported.
The validator makes sure that: 1. The selector is not null. 2. The selector has no white spaces. 3. No flgas that will be ignored are used. If they are we raise a warning. 4. Fields are partial. 5. Fields are static. 6. If a field or any of its accessors was marked as unsupported but is present in the compilation platform, we raise an error. This class will later be used to validate fields on a class.
Do not allow selectors to be null or empty.
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 #de4c39b] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. 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.
🚀 [CI Build #de4c39b] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 115 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
c1d3e60
to
f1e21b4
Compare
b9d109e
to
db1d4ec
Compare
✅ [PR Build #db1d4ec] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [PR Build #d924e12] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #db1d4ec] Build passed (Build packages) ✅Pipeline on Agent |
✅ [CI Build #db1d4ec] Build passed (Build macOS tests) ✅Pipeline on Agent |
✅ 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 |
✅ 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 |
✅ [CI Build #d924e12] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #db1d4ec] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #db1d4ec] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #db1d4ec] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #d924e12] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #d924e12] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #d924e12] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
Do not allow selectors to be null or empty.