Lombok.NET icon indicating copy to clipboard operation
Lombok.NET copied to clipboard

`const` "members" in `[AllArgsConstructor]`

Open daaa57150 opened this issue 1 year ago • 0 comments

Describe the bug [AllArgsConstructor] also picks up const "members".

To Reproduce

[AllArgsConstructor]
public partial class MyService
{
    // Compile-time constant
    private const string SomeId = "ConstId";
    
    // Injections
    private readonly AnotherService service;
}

Expected behavior I expect a constructor injecting AnotherService, but I get one with AnotherService and SomeId. This of course does not compile and I get the error Error CS0176 Member 'MyService.SomeId' cannot be accessed with an instance reference; qualify it with a type name instead

Environment info

  • .NET version: 6.x
  • Lombok.NET version: 2.4.1

daaa57150 avatar Jan 27 '25 16:01 daaa57150