Skip to content

Strongly generates a field that shadows constructor #9

Open
@AlexeyRaga

Description

@AlexeyRaga

This scenario is allowed and the compiler doesn't fail:

[Strongly]
public partial record struct ProductId(Guid Value);

However it generates an extra Value field that shadows the one that is provided in the constructor:

readonly partial record struct ProductId : System.IFormattable, System.IParsable<ProductId>
{
    public System.Guid Value { get; }

As a result, values that are created with the constructor are "missing" the provided inner value:

var pid = new ProductId(Guid.NewGuid());

// pid.value == Guid.Empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions