Skip to content

Generated AdditionOperators.g.cs for ValueObject<TimeSpan> won't compile #20

@nilsauf

Description

@nilsauf

Hi,

I just wanted to create a ValueObject but the generated source file wont compile.

namespace Sample.Space;

using System;

using Thinktecture;

[ValueObject<TimeSpan>]
public partial struct TimeSpanObject { }

this will generate the following Sample.Space.TimeSpanObject.AdditionOperators.g.cs file:

// <auto-generated />
#nullable enable

namespace Sample.Space;

partial struct TimeSpanObject :
{
   /// <inheritdoc cref="global::System.Numerics.IAdditionOperators{TSelf, TOther, TResult}.op_Addition(TSelf, TOther)" />
   public static global::Sample.Space.TimeSpanObject operator +(global::Sample.Space.TimeSpanObject left, global::Sample.Space.TimeSpanObject right)
   {
      return Create((left._value + right._value));
   }
}

But this wont compile, because the compiler expects a type after the ":", resulting in a CS2031 Error.

With an int as Key it generates it correct with interface and also checked + operator.

I am using Thinktecture.Runtime.Extensions in Version 10.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions