Skip to content

Conversation

@Kataane
Copy link
Contributor

@Kataane Kataane commented Jan 2, 2026

Add multi-enum to enum target mapping support

Description

Hi @latonz,

This PR adds support for mapping multiple enum source types to a single enum target type. This feature allows developers to map from different enum sources to a unified enum target in more flexible ways.

Key changes:

  • Added EnumMultiSourceMapping and EnumSourceMapping classes to handle multi-source enum mappings.
  • Enhanced the EnumToEnumMappingBuilder with comprehensive multi-enum support
  • Added the EnumAdditionalParametersTest class with extensive test coverage for enum mapping scenarios.
  • Updated CollectionInfoBuilder and SyntaxFactoryHelper for improved enum handling
  • Maintains full backward compatibility with existing enum mappings.

New capabilities:

  • Support for mapping multiple enum sources to a single enum target
  • Handling additional parameters in situations with multiple lists of options
  • Improved support for complex enum mappings
  • Comprehensive testing ensures reliability

Now possible to do next:

partial IEnumerable<Target> ToArray(Source1 s1, Source2 s2); // return [ Target.B, Target.C ]

enum Source1 { B = 2 }
enum Source2 { C = 3 }
enum Target { A = 1, B = 2, C = 3 }
partial Target Combine(Source1 s1, Source2 s2); // if pass Source1.Five and Source2.Three return Target.Three

enum Source1 { One = 1, Two = 2, Four = 4, Five = 5 }
enum Source2 { Two = 2, Three = 3 }
enum Target { One = 1, Two = 2, Three = 3, Four = 4 }

Fixes # (issue)

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)

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.

1 participant