Skip to content

Fix bug where protected types appear as fields in unprotected types #7386

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 12, 2025

Conversation

jordanschalm
Copy link
Member

Ref: #7376

This PR fixes a bug reported in #7375 (comment), where a mutation-protected type is incorrectly reported by the linter when it appears as a field of a non-mutation protected type.

This PR improves the logic detecting which fields are allowed to be set to allow this case. It also extends the test cases to include this case.

add test case for directly and deeply nested fields for this case.
@codecov-commenter
Copy link

codecov-commenter commented May 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.12%. Comparing base (09bbb79) to head (6f52013).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7386      +/-   ##
==========================================
- Coverage   41.12%   41.12%   -0.01%     
==========================================
  Files        2206     2206              
  Lines      193447   193447              
==========================================
- Hits        79553    79551       -2     
- Misses     107268   107269       +1     
- Partials     6626     6627       +1     
Flag Coverage Δ
unittests 41.12% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@tim-barry tim-barry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes make sense. The test cases make the linter's functioning much clearer than the code does; thanks for making them so detailed.

Copy link
Contributor

@AndriiDiachuk AndriiDiachuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this so quick and for such detailed explanations in the code.

@AndriiDiachuk AndriiDiachuk added this pull request to the merge queue May 12, 2025
Merged via the queue into master with commit 482e80c May 12, 2025
57 checks passed
@AndriiDiachuk AndriiDiachuk deleted the jord/7376-structwrite-field-protected branch May 12, 2025 17:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants