dotvariant icon indicating copy to clipboard operation
dotvariant copied to clipboard

Determine visibility of generated extension methods based on variant types

Open mknejp opened this issue 3 years ago • 2 comments

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 avatar Nov 26 '21 03:11 mknejp

This issue appears to be solved

ProphetLamb avatar Jun 21 '23 15:06 ProphetLamb

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);
    }
}

mknejp avatar Jul 08 '23 20:07 mknejp