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

Finer grained determination of visibility for extension methods #44

Open
mknejp opened this issue Nov 26, 2021 · 0 comments · May be fixed by #58
Open

Finer grained determination of visibility for extension methods #44

mknejp opened this issue Nov 26, 2021 · 0 comments · May be fixed by #58
Assignees
Labels
bug Something isn't working

Comments

@mknejp
Copy link
Owner

mknejp commented Nov 26, 2021

Currently the generated static class containing extension methods is either public or internal based on the visibility of the variant itself, but it doesn't take into consideration the visibility of the value types.

In addition to that, now that we support generic types we can end up in a scenario like the following:

public partial class Variant<T1> { /* ... */ }

internal partial class Variant<T2, T2> { /* ... */ }

// generated code:
internal static class VariantEx
{
  // Extension methods for Variant<T1> are public
  ...
  // Extension methods for Variant<T1, T2> are public
  ...
}

Even though this is a very questionable design, users can write code like that and it should not generate a broken implementation.

To support this properly we need to determine the visibility for the extension class itself separately from the visibility of the generated extension methods. So in the above example VariantEx should be public with the extension methods for Variant<T1> generated public and for Variant<T1, T2> generated internal.

@mknejp mknejp added the bug Something isn't working label Nov 26, 2021
@mknejp mknejp self-assigned this Nov 27, 2021
ProphetLamb added a commit to ProphetLamb/dotvariant that referenced this issue Jun 21, 2023
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
Development

Successfully merging a pull request may close this issue.

1 participant