Repository navigation
Diagnose static data-source properties in inaccessible containing types - #7503
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ReviewCorrect fix for #7461: the full containing-chain check via 1. A 2. Two code paths decide accessibility. 3. Cache keying. 4. Minor. The diagnostic message says to make types "internal or public". For a private nested type that means changing the user's design, so a hint that the property can move to an accessible type might help. Consider also adding a test for a generic container and for Overall this is good. Point 1 is worth fixing before merge; the others are optional. |
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThe generator reports
Reviews (5) · Last reviewed commit: "Test diagnostic identity across compilat..." · Reviewed by Greptile |
|
Addressed the review in 49c5ce7:
Validation: full core generator suite on net10.0: 266 passed, 1 existing skip; static-property incremental suite: 6 passed. Existing diagnostic snapshots pass unchanged. Other frameworks remain for CI. PR remains draft for fresh reviews of this head. |
|
@codex review |
ReviewThe approach is sound. Reporting a clear diagnostic where the generator used to emit uncompilable code (CS0122) is better than a silent failure. Checking Points to consider:
No blocking issues. Looks good to merge once CI is green on the other target frameworks. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Fixed the remaining file-level diagnostic settings finding in d41073e. The incremental discovery models still retain only equatable location data; the output callback uses the current compilation to restore a source-tree location. Added a per-file suppression regression and source-tree identity assertions. Full net10.0 core generator suite: 267 passed, 1 existing skip, existing snapshots unchanged. Other target frameworks remain for CI. Disposition of the latest Claude suggestions:
PR stays draft pending fresh reviews of this head. |
|
@codex review |
ReviewThe approach is sound. The generator now checks the whole containing-type chain, drops the initialization that would not compile (CS0122), and reports a clear diagnostic on the user's property. The tests cover the accessibility matrix, file-local types, skipped helpers, deduplication and per-file suppression. I haven't built or run anything. Points to consider:
Nothing here blocks the merge. Item 1 is worth a quick look, and item 2 needs a check for collisions. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Fixed duplicate-path diagnostic identity in e39d76c. Full net10.0 core generator suite including snapshots: 269 passed, 1 existing skip; snapshots unchanged. Other target frameworks remain for CI. Disposition of the latest Claude suggestions: the compilation combine is retained to restore current source-tree identity and per-file options correctly; models remain equatable. TUNITGEN005 is unique and existing cross-generator ID collisions/documentation are tracked in #7504. Error severity is retained because these references previously failed compilation with CS0122; source generation disabled remains covered and emits no diagnostic. Structural diagnostic assertions supplement message snapshots. PR remains draft pending fresh reviews of the new head. |
|
@codex review |
|
Review: TUNITGEN005 for inaccessible containing types The approach is sound. Checking the whole containing-type chain, skipping file-local types, and reporting a clear diagnostic on the user's property is better than emitting code that fails with CS0122. The test matrix is good: every accessibility level, nested types, the disabled-generation case, deduplication, and a suppression case. Main concern:
A sturdier option is to keep the tree out of the model and resolve it in the output step from the file path plus the span. To distinguish duplicate paths, use something stable such as the text content hash. Alternatively, report the diagnostic from its own Smaller points
Overall: good direction. I'd fix the ordinal fragility before merging. 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Addressed the latest review with regression coverage in 48937b5. The stale-ordinal concern does not reproduce: CreateSyntaxProvider's semantic transform reruns when the compilation changes, and SegmentCaches is keyed by Compilation, so cached segments from the earlier compilation are not reused. Added second-run tests reusing the generator driver and unchanged offending syntax tree, both inserting a new tree before it and reordering existing trees. All trees deliberately share a path; suppression applies only to the unrelated tree. Both cases preserve the diagnostic's exact SourceTree, property span, and file options. Added a source comment documenting this invariant. Validation: full net10.0 core generator suite including snapshots passed: 271 succeeded, 1 existing skip, 0 failures. No snapshot changes. Other target frameworks remain for CI. Smaller suggestions: retain the compilation combine to attach diagnostics to current trees and honor file options. Retain the existing accessibility message, which gives a sufficient remedy (replace file with internal/public for file-local types). Retain HasAnyProperty to avoid unrelated naming churn. Prior diagnostic-ID/documentation follow-up remains tracked by #7504. The PR remains draft pending fresh Claude and Codex reviews of this head. |
|
@codex review |
Review of #7503The fix is correct in direction. It checks the whole containing-type chain, treats file-local types as inaccessible, skips the emitted initialization, and reports a diagnostic on the user's property instead of letting generated code fail with CS0122. The tests are thorough: all accessibility combinations, file-local types, skipped generic/struct/record helpers, inherited-chain deduplication, and duplicate tree paths. I read the diff only and did not build or run the tests. One design concern and two smaller points:
Overall this is a solid fix with strong regression coverage. I'd recommend considering the analyzer-based approach for the diagnostic before merging, but I don't see a correctness blocker. 🤖 Generated with Claude Code |
A public static data-source property inside a private nested helper previously emitted references to the inaccessible type and failed with CS0122 in generated code. The generator now checks the full containing-type chain, omits inaccessible initialization, and reports TUNITGEN005 on the user's property with instructions to make the containing types accessible. File-local containers are also excluded.
Regression tests cover private, protected, private protected, internal, protected internal, and public containers, including a public nested type inside each container. They compile generated output, snapshot the diagnostic, and verify that disabling source generation suppresses it. Diagnostics share the initializer discovery pass, use equatable location models, and exclude skipped generic/struct/record helpers. File-local direct/nested and inherited diagnostic deduplication regressions are covered. Reflection initialization remains unchanged: this is validation of references emitted only by the generator.
Validation: core source-generator suite on net10.0: 266 passed, 1 existing skip. Static-property incremental suite on net10.0: 6 passed. No reflection paths or shipped public APIs changed. Other target frameworks are left to CI. Restore's existing Pkcs vulnerability warning is tracked by #7412.
Closes #7461
Summary by CodeRabbit