Skip to content

Conversation

@park-jasper
Copy link
Member

When a union type is generic, and a derived type is declared not as a nested type, then the type parameter T is not considered to be equal between the base and the derived type since it is declared separately, and the generator whould not recognise the derived types as such.
This PR fixes that. Factory methods are not generated if the non-nested definition restricts the generic type argument to a specific type or if the type parameter has a different name (which could still be supported if we remember a mapping of the parameter names and exchange the parameter types)

@park-jasper park-jasper requested a review from ax0l0tl July 11, 2025 14:32
@park-jasper
Copy link
Member Author

Thinking about this a bit more, I dont think it makes sense for a case to be less generic (e.g. deriving form the base with a fixed type), just as it does not make sense for the case to be more generic (having an additional generic parameter). So I am not sure if this PR is going to have the intended effect, I may have to think about this before it can be merged

@park-jasper park-jasper marked this pull request as draft July 14, 2025 08:09
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.

2 participants