We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b8a762e commit 37283a2Copy full SHA for 37283a2
src/CommandLine/ParserResult.cs
@@ -68,17 +68,17 @@ public abstract class ParserResult<T>
68
internal ParserResult(IEnumerable<Error> errors, TypeInfo typeInfo)
69
{
70
this.tag = ParserResultType.NotParsed;
71
- this.typeInfo = typeInfo;
72
- Errors = errors;
+ this.typeInfo = typeInfo ?? TypeInfo.Create(typeof(T));
+ Errors = errors ?? new Error[0];
73
Value = default;
74
}
75
76
internal ParserResult(T value, TypeInfo typeInfo)
77
78
+ Value = value ?? throw new ArgumentNullException(nameof(value));
79
this.tag = ParserResultType.Parsed;
80
+ this.typeInfo = typeInfo ?? TypeInfo.Create(value?.GetType() ?? typeof(T));
81
Errors = new Error[0];
- Value = value;
82
83
84
/// <summary>
0 commit comments