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

Ambiguous Constructor Call on Partial Record w/ One Property #8

Closed
MooVC opened this issue Aug 11, 2024 · 0 comments · Fixed by #11
Closed

Ambiguous Constructor Call on Partial Record w/ One Property #8

MooVC opened this issue Aug 11, 2024 · 0 comments · Fixed by #11
Assignees
Labels
bug Something isn't working

Comments

@MooVC
Copy link
Owner

MooVC commented Aug 11, 2024

Describe the bug
It is not possible to apply Fluentify to a partial record that has only one property defined.

To Reproduce
Define a partial record with just one property and annotate it with Fluentify e.g.

[Fluentify]
public partial record Pie(string Type);

The code will fail to compile due to the following error:

Error (active)	CS0121	The call is ambiguous between the following methods or properties: 'Pie.Pie(string)' and 'Pie.Pie(Pie)'

Expected behavior
The code should compile, with an extension method generated for the property and a default constructor generated for the record.

Environment (please complete the following information):

  • Fluentify Version: 1.1.0
  • .NET Version (Your Project): NET 8
  • IDE: Visual Studio 2022 (17.10.5)

Additional context
Add any other context about the problem here.

@MooVC MooVC added the bug Something isn't working label Aug 11, 2024
@MooVC MooVC self-assigned this Aug 11, 2024
MooVC added a commit that referenced this issue Aug 14, 2024
- The default constructor, generated for record types when marked as partial, now applies the fully qualified type when propagating the default value, thereby removing the potential for ambiguity with the projection constructor (#8).
@MooVC MooVC linked a pull request Aug 14, 2024 that will close this issue
MooVC added a commit that referenced this issue Aug 15, 2024
* ## Fixed

- The default constructor, generated for record types when marked as partial, now applies the fully qualified type when propagating the default value, thereby removing the potential for ambiguity with the projection constructor (#8).

* Updated Sonar Analyzer

* Applied Sonar recommendation
@MooVC MooVC closed this as completed in #11 Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant