You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Code fix: implement Create for an IValidatedValue that lacks it #82
A validated value object has one hand-written member, Create. Declaring IValidatedValue<TSelf, T, TFault> without it fails the build on the missing static member, and nothing helps the user write it: the analyzers' two code fixes cover positional Match arguments and a required parameterless constructor.
Proposal
A code fix, offered where a type declares IValidatedValue<TSelf, T, TFault> and lacks Create, that inserts:
publicstaticResult<TSelf,TFault>Create(Tvalue){// your rules: if (...) return Result.Error(TFault.Member);returnResult.Success(newTSelf(value));}
with the type arguments filled in from the declaration (the shape of the Generators README's Email). Optionally the same for a plain IValue<T> turned into a validated one.
Done when
The fix is offered on the diagnostic the missing Create raises, for a struct and a class value object, a nested and a generic-containing one (the TypeArgumentSites and TypeArgumentKinds catalogues where they apply), and the fixed code compiles and generates.
No new diagnostic at Error severity (a minor release); the Generators README mentions the fix where it explains Create.
Done in PR #110 as Add Create, the code fix for CS0535 (open into release/2.3.0). The optional part, the same fix for a plain IValue<T> turned into a validated value object, is left out. A plain IValue<T> raises no CS0535 to hang it on, so it is no part of this fix and would be an issue of its own.
Activity
CaffeinatedCoder commentedon Oct 29, 2026
Done in PR #110 as Add Create, the code fix for CS0535 (open into release/2.3.0). The optional part, the same fix for a plain
IValue<T>turned into a validated value object, is left out. A plainIValue<T>raises no CS0535 to hang it on, so it is no part of this fix and would be an issue of its own.CaffeinatedCoder commentedon Oct 29, 2026
Done in PR #110, merged into release/2.3.0.