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: initialize nullable members for nested containers #1660

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

clegoz
Copy link

@clegoz clegoz commented Jan 2, 2025

fix: initialize nullable members for nested containers

Description

Made changes to store IMemberAssignmentMappingContainer along with the MemberPath to keep track of nullable member initializations.

Fixes #1650

Checklist

  • The existing code style is followed
  • The commit message follows our guidelines
  • Performed a self-review of my code
  • Hard-to-understand areas of my code are commented
  • The documentation is updated (as applicable)
  • Unit tests are added/updated
  • Integration tests are added/updated (as applicable, especially if feature/bug depends on roslyn or framework version in use)

Copy link
Contributor

@latonz latonz left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution, I added my feedback 😊

Comment on lines +96 to +97
if (_initializedNullableTargetPaths.Contains((Mapping, nullablePath)))
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

This additional contains call is not needed, is it?

@@ -588,6 +588,45 @@ public partial B Map(A a)
);
}

[Fact]
public void NullableNestedMembersShouldInitializeWithNoNullAssignment()
Copy link
Contributor

@latonz latonz Jan 6, 2025

Choose a reason for hiding this comment

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

Could you also create a test case for this slightly different one: #1661 (initialization after the if, but outside of any if)

@latonz latonz added the bug Something isn't working label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants