-
-
Notifications
You must be signed in to change notification settings - Fork 141
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: add modifying nested struct diagnostic #551
Conversation
e912d1a
to
4d7849e
Compare
2004686
to
0da62af
Compare
Codecov Report
@@ Coverage Diff @@
## main #551 +/- ##
==========================================
+ Coverage 90.89% 90.94% +0.05%
==========================================
Files 172 172
Lines 6106 6141 +35
Branches 777 782 +5
==========================================
+ Hits 5550 5585 +35
Misses 378 378
Partials 178 178
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/Riok.Mapperly/Descriptors/MappingBodyBuilders/ObjectMemberMappingBodyBuilder.cs
Outdated
Show resolved
Hide resolved
src/Riok.Mapperly/Descriptors/MappingBodyBuilders/ObjectMemberMappingBodyBuilder.cs
Outdated
Show resolved
Hide resolved
eaa0cf4
to
cd933e7
Compare
Sorry, I though I had fixed all of this a week ago. Turns out I forgot to push it 😅
Yeah, I'm still not sure about this. I decided that the only the last two values mattered.. Even if all the preceeding members are structs, the error only occurs when trying to set the final struct property. If the penultimate member is a class the error won't occur. Cone to think of it, this probably isn't true when accessing fields |
3f3ed6d
to
0941b0f
Compare
@TimothyMakkison ah yep on a second thought I think that makes sense, that only the second last is checked. |
src/Riok.Mapperly/Descriptors/MappingBodyBuilders/ObjectMemberMappingBodyBuilder.cs
Outdated
Show resolved
Hide resolved
151bf56
to
3ead800
Compare
Added CS1612 to error message. Modified the check to iterate backwards, checking for value type properties. Checking the penultimate member would work if field types didn't exist |
3ead800
to
880e3b7
Compare
880e3b7
to
6b6c4d1
Compare
6b6c4d1
to
a4d60f2
Compare
Analyzer doesn't like the length of |
d01f886
to
e0c6189
Compare
IMO its okay here to ignore the warning, could you change it to suppressmessage attribute? Often the readability is improved that when reading a method and submethods are called instead of inlined code, code which I'm not interested in reading can be skipped easier. |
Added attribute
Should I extract all the methods? |
e0c6189
to
c15c130
Compare
Nope, should be fine like this, just my general opinion on the topic… |
🎉 This PR is included in version 3.1.0-next.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 3.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Add diagnostic for modifying a temporary value type
Description
Added check for if a nested value type is being modified.
Probably not a common issue so I went with a diagnostic.
I considered nested chain assignment or a
with
expression ietarget.NestedValue = target.NestedValue with { StringValue = src.StringValue };
(can repeatedly chain)Fixes #516
Checklist