CollinAlpert / Lombok.NET

.NET adaptation for Java's Lombok using Source Generators.
MIT License
309 stars 16 forks source link

With Method's do not return correct type on classes with Generics #54

Closed ristogod closed 2 weeks ago

ristogod commented 3 weeks ago

Describe the bug If I decorate my class MyClass<T> with the [With] attribute, it will generate methods that do not return MyClass<T>, but instead MyClass

To Reproduce

[With]
public partial class MyClass<T>
{
   public T MyProperty { get; set: }
}

Generates

partial class MyClass<T>
{
   public MyClass WithMyProperty(T myProperty)
   {
      this.MyProperty = myProperty;

      return this;
   }
}

Expected behavior

partial class MyClass<T>
{
   public MyClass<T> WithMyProperty(T myProperty)
   {
      this.MyProperty = myProperty;

      return this;
   }
}

Environment info

.NET version: 8.0 Lombok.NET version: 2.4.0

CollinAlpert commented 2 weeks ago

Thank you for the issue, the fix is available in v2.4.1.