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

Adding support for mappers being nested under interfaces or records #1464

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

david-driscoll
Copy link
Contributor

@david-driscoll david-driscoll commented Aug 26, 2024

Allow mappers to be nested in records or interfaces

Description

This is a minor update to allow mappers to be nested under an interface or record in addition to class.

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)

@david-driscoll david-driscoll marked this pull request as ready for review August 26, 2024 00:56
@latonz latonz added the enhancement New feature or request label Aug 26, 2024
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 great contribution!

The failing test should be fixable by simply adding a pseudo field like private readonly string _test = test;

@latonz
Copy link
Contributor

latonz commented Aug 26, 2024

As the integration tests run on all supported .NET versions the primary constructor test needs to be excluded from .NET versions < 8.0.
But IMO these tests would fit better as unit tests instead of integration tests since the generated code is not really .NET version dependent and there is already one integration test for this scenario (NestedTestMapper).

@david-driscoll
Copy link
Contributor Author

I added the primary constructor because I've run into issues with it in the past on my own source generators, so I just thought I'd add it for completeness.

I'm working on the changes now.

@david-driscoll
Copy link
Contributor Author

Looks like everything is passing, let me know if there are any other changes!

@latonz
Copy link
Contributor

latonz commented Aug 27, 2024

LGTM, thanks for this contribution!

@latonz latonz merged commit c7a3b95 into riok:main Aug 27, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants