codecentric / net_automatic_interface

.Net Source Generator for Automatic Interfaces
MIT License
62 stars 14 forks source link

does not handle boolean default values correctly #39

Closed anotherthomas closed 8 months ago

anotherthomas commented 8 months ago

When annotating a class with a method that has a bool parameter with a default:

namespace test;

public class GenerateAutomaticInterfaceAttribute : Attribute
{
    public GenerateAutomaticInterfaceAttribute(string namespaceName = "") { }
}

[GenerateAutomaticInterface]
public class DemoClass : IDemoClass // Generics, including constraints are allowed, too.
{
    public bool BMethod(string x, bool y=true) // ignored because not public
    {
        return false;
    }
}

The following gets generated:

using System.CodeDom.Compiler;

namespace test
{
    [GeneratedCode("AutomaticInterface", "")]
    public partial interface IDemoClass
    {
        /// <inheritdoc />
        bool BMethod(string x, bool y = False);

    }
}

False /True are both capitalized.

simonmckenzie commented 8 months ago

I have opened a PR for this issue (I found it independently and only just saw this!)

https://github.com/codecentric/net_automatic_interface/pull/40

ChristianSauer commented 8 months ago

@simonmckenzie Thanks for the PR. Should be in 2.3.0 @anotherthomas Thanks for reporting!

ChristianSauer commented 8 months ago

I am writing both python and C# and somehow capitalization of True/False always gets me.

anotherthomas commented 8 months ago

Thanks @simonmckenzie you bet me to the fix @ChristianSauer thanks for the fast release

simonmckenzie commented 8 months ago

My apologies @anotherthomas 😳. I hope I didn't steal your fun. Next time I'll check the open issues first.

anotherthomas commented 8 months ago

I prefer a "first come, first merged" policy if that get's me newer versions faster :grin: