Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise diagnostic for memberpaths that mistakenly specify the type name #1032

Open
TimothyMakkison opened this issue Dec 23, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@TimothyMakkison
Copy link
Collaborator

TimothyMakkison commented Dec 23, 2023

A common mistake with MapProperty is to include the type name as part of the string. This usually occurs when mapping a deeply nested property and the user removes nameof and adds parentheses. Mistakenly adding the enclosing type name to the path.

Note that C# does not allow properties to have the same name as the enclosing type.

public record Dog(Tail tail);

public record Tail(Colour colour);

// Diagnostic should be emitted because the first member path has the same name as the type
[MapProperty("Colour", "Dog.Tail.Colour")]
public static partial Dog Map(Table src);

This should probably also check MapperIgnoreTarget etc .

See #1030

@latonz latonz added the enhancement New feature or request label Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants