Skip to content

Commit b3a4d57

Browse files
committed
change some GetValueFor* overloads to use interface for parameter
1 parent 7b204de commit b3a4d57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/System.CommandLine/Parsing/ParseResult.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ internal T GetValueFor<T>(IValueDescriptor<T> symbol) =>
9797
public object? ValueForOption(string alias) =>
9898
ValueForOption<object?>(alias);
9999

100-
[Obsolete("This method is obsolete and will be removed in a future version. Please use ParseResult.GetValueForOption<T>(Option) instead. For details see https://github.com/dotnet/command-line-api/issues/1127")]
100+
[Obsolete("This method is obsolete and will be removed in a future version. Please use ParseResult.GetValueForOption<T>(IOption) instead. For details see https://github.com/dotnet/command-line-api/issues/1127")]
101101
public object? ValueForOption(Option option) =>
102102
GetValueForOption<object?>(option);
103103

@@ -112,7 +112,7 @@ internal T GetValueFor<T>(IValueDescriptor<T> symbol) =>
112112
public object? ValueForArgument(Argument argument) =>
113113
GetValueForArgument<object?>(argument);
114114

115-
public object? GetValueForArgument(Argument argument) =>
115+
public object? GetValueForArgument(IArgument argument) =>
116116
GetValueForArgument<object?>(argument);
117117

118118
[Obsolete(
@@ -140,15 +140,15 @@ internal T ValueForArgument<T>(Argument argument) =>
140140
GetValueForArgument<T>(argument);
141141

142142
[return: MaybeNull]
143-
public T GetValueForArgument<T>(Argument argument)
143+
public T GetValueForArgument<T>(IArgument argument)
144144
{
145145
if (FindResultFor(argument) is { } result &&
146146
result.GetValueOrDefault<T>() is { } t)
147147
{
148148
return t;
149149
}
150150

151-
return (T)Binder.GetDefaultValue(argument.ValueType);
151+
return (T)Binder.GetDefaultValue(argument.ValueType)!;
152152
}
153153

154154
[return: MaybeNull]

0 commit comments

Comments
 (0)