Skip to content

Newtype for decimal fails to build #5

@LWEdslev

Description

@LWEdslev

This fails to build

using newtype;

Id foo = new(5);
Console.WriteLine(foo);

[newtype<decimal>]
public readonly partial struct Id;

with the following message

/home/lasse-edslev/csharp/Playground/NewType.Generator/newtype.generator.AliasGenerator/Id.g.cs(121,56): error CS0191: A readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer) [/home/lasse-edslev/csharp/Playground/Playground.csproj]
/home/lasse-edslev/csharp/Playground/NewType.Generator/newtype.generator.AliasGenerator/Id.g.cs(124,56): error CS0191: A readonly field cannot be assigned to (except in a constructor or init-only setter of the type in which the field is defined or a variable initializer) [/home/lasse-edslev/csharp/Playground/Playground.csproj]

It works if I use double

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions