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

Determine visibility of generated extension methods based on variant types #45

Open
mknejp opened this issue Nov 26, 2021 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@mknejp
Copy link
Owner

mknejp commented Nov 26, 2021

Currently all generated extension methods are public regardless of the visibility of the variant type.

Thus the following generates invalid code because the generated extensions have inconsistent accessibility:

namespace Foo
{
    internal class A { }

    [dotVariant.Variant]
    public partial class Variant
    {
        static partial void VariantOf(A a);
    }
}

// generated code:
public static class VariantEx
{
  // CS0051 and CS0057: Inconsistent accessibility
  public static void Match(this Variant v, out A a) { ... }
}
@mknejp mknejp added the bug Something isn't working label Nov 26, 2021
@mknejp mknejp self-assigned this Nov 27, 2021
@ProphetLamb
Copy link

This issue appears to be solved

@mknejp
Copy link
Owner Author

mknejp commented Jul 8, 2023

Unfortunately not, adding the following to the test project still fails with hard errors in the generated code.

namespace Foo
{
    internal class A { }

    [dotVariant.Variant]
    public partial class Variant
    {
        static partial void VariantOf(A a);
    }
}

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

No branches or pull requests

2 participants