[XSG] Refactor MemberAccess to remove double negatives#33449
[XSG] Refactor MemberAccess to remove double negatives#33449
Conversation
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
…ssible to IsGetterAccessible/IsSetterAccessible Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the MemberAccess record properties from double negatives (IsGetterInaccessible, IsSetterInaccessible) to positive form (IsGetterAccessible, IsSetterAccessible) to improve code readability throughout the BindingSourceGen code generator.
Key Changes:
- Property defaults changed from
falsetotrue(members are accessible by default) - Logic inversions applied where properties are checked
- Pattern matching expressions updated to check for
falseinstead oftrue
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| PathPart.cs | Renamed properties to positive form, updated defaults to true, inverted logic in HasInaccessibleAccessor computation |
| PathParser.cs | Simplified assignment by removing double negation when setting property values |
| Setter.cs | Updated pattern matching from IsSetterInaccessible: true to IsSetterAccessible: false |
| AccessExpressionBuilder.cs | Updated pattern matching from IsGetterInaccessible: true to IsGetterAccessible: false |
| BindingCodeWriter.cs | Updated condition checks to negate positive properties (!member.IsGetterAccessible) |
| SetterBuilderTests.cs | Updated test data to use new property names with appropriate boolean values |
| BindingRepresentationGenTests.cs | Updated test expectations to use new property names |
| AccessExpressionBuilderTests.cs | Updated test data to use new property names |
|
/azp run maui-pr-devicetests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot I'm seeing this failure in maui-pr-uitests: |
…ty names Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Fixed in 93e4dab. The base branch had added RelayCommand support code that was using the old property names ( |
|
/azp run maui-pr,maui-pr-devicetests,maui-pr-uitests |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run maui-pr,maui-pr-devicetests,maui-pr-uitests |
|
Azure Pipelines successfully started running 3 pipeline(s). |
- [x] Refactor `IsGetterInaccessible` to `IsGetterAccessible` in `MemberAccess` record (PathPart.cs) - [x] Refactor `IsSetterInaccessible` to `IsSetterAccessible` in `MemberAccess` record (PathPart.cs) - [x] Update the computed property `HasInaccessibleAccessor` to use the new properties - [x] Update `PathParser.cs` to use the new property names (simplified assignment) - [x] Update `Setter.cs` to check for `IsSetterAccessible: false` instead of `IsSetterInaccessible: true` - [x] Update `AccessExpressionBuilder.cs` to check for `IsGetterAccessible: false` instead of `IsGetterInaccessible: true` - [x] Update `BindingCodeWriter.cs` to use the new property names - [x] Update all test files to use the new property names: - [x] `SetterBuilderTests.cs` - [x] `BindingRepresentationGenTests.cs` - [x] `AccessExpressionBuilderTests.cs` - [x] Build and verify tests pass (all 119 tests pass) - [x] Run code review (passed with no comments) - [x] Run CodeQL security scan (no issues found) - [x] Fix CI failure by adding missing RelayCommand support code from base branch (updated to use new property names) <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[XSG][Compiled bindings] Refactor code to remove double negatives in MemberAccess</issue_title> > <issue_description>I always get confused because of `MemberAccess` properties `bool IsGetterInaccessible` and `IsSetterInaccessible`. Let's change them to `IsGetterAccessible` and `IsSetterAccessible`.</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #33448 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/maui/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> Co-authored-by: Šimon Rozsíval <simon@rozsival.com>
IsGetterInaccessibletoIsGetterAccessibleinMemberAccessrecord (PathPart.cs)IsSetterInaccessibletoIsSetterAccessibleinMemberAccessrecord (PathPart.cs)HasInaccessibleAccessorto use the new propertiesPathParser.csto use the new property names (simplified assignment)Setter.csto check forIsSetterAccessible: falseinstead ofIsSetterInaccessible: trueAccessExpressionBuilder.csto check forIsGetterAccessible: falseinstead ofIsGetterInaccessible: trueBindingCodeWriter.csto use the new property namesSetterBuilderTests.csBindingRepresentationGenTests.csAccessExpressionBuilderTests.csOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.