Repository navigation
Description
Package
CodoMetis.TypeKit.Generators
Version
2.3.0, and every release that generates validated value objects
How does it fail?
Silently. It compiles or answers, and does less than it appears to
What you ran
A base record in another project implements IValidatedValue<TSelf, T, TFault>.Create explicitly; the value object declares its own public Create and reaches the marker only through the base:
// Library (no generators):
public abstract record StrictBase<TSelf> : IValidatedValue<TSelf, string, LibFault>
where TSelf : StrictBase<TSelf>, IValidatedValue<TSelf, string, LibFault>
{
static Result<TSelf, LibFault> IValidatedValue<TSelf, string, LibFault>.Create(string value) => Result.Error(LibFault.Refused);
}
// Consumer:
public sealed partial record Lenient : StrictBase<Lenient>
{
public static Result<Lenient, LibFault> Create(string value) => new Lenient(value);
}
Lenient.TryFrom("x"); // Some: the value object's Create
CreateThrough<Lenient>("x"); // static T.Create(s), refused: the base'sWhat you got
Measured on release/2.4.0 at 97c87c1, 2026-10-30: two rule sets. Every generated way in calls Lenient.Create, which accepts; generic code calling T.Create reaches the base's explicit implementation, which refuses. ValueObjectDeclaration.CreateDeclarations reads the value object's own methods, and Metalama lists no private member of another assembly's type anyway. Declaring the marker on the value object as well (Lenient : StrictBase<Lenient>, IValidatedValue<Lenient, string, LibFault>) re-implements the interface and both agree. In the same project such a base carries the marker and is CMTK1022.
What you expected
CMTK1011, as for Create implemented explicitly on the value object beside a public one: one Create, public, implements the interface. Found by the interface mapping (TryFindImplementationForInterfaceMember), as #191's fix does. Reported from an outside review of #193.
Environment
.NET SDK 10.0.4xx, Metalama 2026.1; any consumer.
Fixed in #193 (1e09f8d)
CreateDeclarations asks the interface mapping where T.Create lands. An explicit Create in a base record or an interface is CMTK1011, and so is a base's public Create beside the value object's own. The error says to declare the marker on the value object itself, which re-implements it. A base's public Create alone is one rule set and builds. Held by BuildOutcomeTests (LenientOverStrictBase, OnlyStrictBase, LenientOverPublicBase; building: LenientListedOverStrictBase, OnlyPublicBase), over a library the fixture builds without the generators. Decision 124 records it.
Activity
fix: refuse a base record's Create that generic T.Create reaches besi…
fix: refuse a base record's Create that generic T.Create reaches besi…
CaffeinatedCoder commentedon Oct 30, 2026
Fixed by #201, merged into
release/2.3.1as 8fac39b; ships in 2.3.1.