Skip to content
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

fix: private members can override public members #554

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

TimothyMakkison
Copy link
Collaborator

Private members with greater flattening priority can override public members

Description

Under specific circumstances, when Mapperly attempts to map to a target, a private source members with greater flattening priority can override another public member. A later validation check would reject the mapping as the source is inaccessible, emitting a diagnostic.
#537 prevents this by only mapping accessable source members.

This PR contains a test to validate that the bug is fixed.

Fixes #521

Checklist

  • Unit tests are added/updated

@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Merging #554 (2bbc24d) into main (85347e4) will decrease coverage by 0.60%.
The diff coverage is 89.89%.

@@            Coverage Diff             @@
##             main     #554      +/-   ##
==========================================
- Coverage   91.96%   91.37%   -0.60%     
==========================================
  Files         147      162      +15     
  Lines        4656     5496     +840     
  Branches      588      696     +108     
==========================================
+ Hits         4282     5022     +740     
- Misses        254      325      +71     
- Partials      120      149      +29     
Impacted Files Coverage Δ
src/Riok.Mapperly/Helpers/HashHelper.cs 0.00% <0.00%> (ø)
...numerables/EnsureCapacity/EnsureCapacityBuilder.cs 45.94% <42.10%> (-32.32%) ⬇️
src/Riok.Mapperly/MapperResults.cs 50.00% <50.00%> (ø)
src/Riok.Mapperly/ImmutableEquatableArray.cs 54.54% <54.54%> (ø)
...ok.Mapperly/Configuration/AttributeDataAccessor.cs 68.88% <64.58%> (-7.93%) ⬇️
.../Descriptors/MappingBuilders/SpanMappingBuilder.cs 80.00% <80.00%> (ø)
...lders/NewInstanceObjectMemberMappingBodyBuilder.cs 80.00% <83.33%> (+1.21%) ⬆️
src/Riok.Mapperly/Helpers/SymbolExtensions.cs 86.02% <83.33%> (-5.29%) ⬇️
...scriptors/InlineExpressionMappingBuilderContext.cs 95.91% <85.71%> (+0.79%) ⬆️
...Mapperly/Descriptors/UserMethodMappingExtractor.cs 93.77% <85.71%> (+0.08%) ⬆️
... and 52 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@TimothyMakkison TimothyMakkison force-pushed the priv_521 branch 2 times, most recently from de10dc1 to 77b05a7 Compare July 11, 2023 08:13
@latonz
Copy link
Contributor

latonz commented Jul 12, 2023

@TimothyMakkison thank you for this test, could you rebase?

@latonz latonz merged commit f6d8d34 into riok:main Jul 12, 2023
@github-actions
Copy link

🎉 This PR is included in version 2.9.0-next.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Aug 7, 2023

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Private members can prevent the generation of valid mappings
2 participants