-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
Recently when consuming the package on a particular class of my code base I noticed an issue where properties named similarly to language keywords results in errors on generated code:
Consider the following sample:
[FluentApi]
public class SomeEntity
{
/// <summary>
/// Gets the operation to perform.
/// </summary>
[FluentMember(1)]
public ConstraintOperator Operator { get; private set; }
public static SomeEntity SomeFactory()
=> CreateSomeEntity.InitialStep().WithOperator(null);
}When looking at the generated code you can notice that the IDE thinks you are referring to the language keyword operator raising an error ( Identifier expected):
fluentapi.g.cs:
public interface IWithOperator
{
SomeEntity WithOperator(ConstraintOperator operator); // <-- Identifier expected
}Usually parameters with names that conflicts with reserved keywords are prefixed with a "@" . In my particular scenario I don't have any problem in renaming the original property to avoid the errors on generated code, but maybe this could be checked by the generator itself.
Best regards,
Christian
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working