Skip to content

Commit 4311b05

Browse files
committed
change method signature to be consistent with other classes in the hierarchy.
1 parent 37283a2 commit 4311b05

File tree

9 files changed

+72
-72
lines changed

9 files changed

+72
-72
lines changed

src/CommandLine/Core/InstanceBuilder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static ParserResult<T> Build<T>(
4444
(from p in specProps select p.Specification.ConversionType).ToArray());
4545

4646
Func<IEnumerable<Error>, ParserResult<T>> notParsed =
47-
errs => new NotParsed<T>(makeDefault().GetType().ToTypeInfo(), errs);
47+
errs => new NotParsed<T>(errs, makeDefault().GetType().ToTypeInfo());
4848

4949
var argumentsList = arguments.Memoize();
5050
Func<ParserResult<T>> buildUp = () =>

src/CommandLine/Core/InstanceChooser.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static HelpVerbRequestedError MakeHelpVerbRequestedError(
126126

127127
private static NotParsed<object> MakeNotParsed(IEnumerable<Type> types, params Error[] errors)
128128
{
129-
return new NotParsed<object>(TypeInfo.Create(typeof(NullInstance), types), errors);
129+
return new NotParsed<object>(errors, TypeInfo.Create(typeof(NullInstance), types));
130130
}
131131
}
132132
}

src/CommandLine/ErrorExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static class ErrorExtensions
1212
public static ParserResult<T> ToParserResult<T>(this IEnumerable<Error> errors, T instance)
1313
{
1414
return errors.Any()
15-
? (ParserResult<T>)new NotParsed<T>(instance.GetType().ToTypeInfo(), errors)
15+
? (ParserResult<T>)new NotParsed<T>(errors, instance.GetType().ToTypeInfo())
1616
: (ParserResult<T>)new Parsed<T>(instance);
1717
}
1818

src/CommandLine/ParserResult.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public bool Equals(Parsed<T> other)
170170
public sealed class NotParsed<T> : ParserResult<T>, IEquatable<NotParsed<T>>
171171
{
172172

173-
internal NotParsed(TypeInfo typeInfo, IEnumerable<Error> errors)
173+
internal NotParsed(IEnumerable<Error> errors, TypeInfo typeInfo)
174174
: base(errors, typeInfo)
175175
{
176176
}

src/CommandLine/Text/HelpText.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public static HelpText AutoBuild<T>(ParserResult<T> parserResult, Func<HelpText,
434434
}, e => e, maxDisplayWidth: maxDisplayWidth);
435435

436436
var err = errors.OfType<HelpVerbRequestedError>().Single();
437-
var pr = new NotParsed<object>(TypeInfo.Create(err.Type), new Error[] { err });
437+
var pr = new NotParsed<object>(new Error[] { err }, TypeInfo.Create(err.Type));
438438
return err.Matched
439439
? AutoBuild(pr, current =>
440440
{

tests/CommandLine.Tests/Unit/Core/InstanceBuilderTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void Explicit_help_request_generates_help_requested_error()
6868
{
6969
// Fixture setup
7070
var expectedResult = new NotParsed<Simple_Options>(
71-
TypeInfo.Create(typeof(Simple_Options)), new Error[] { new HelpRequestedError() });
71+
new Error[] { new HelpRequestedError() }, TypeInfo.Create(typeof(Simple_Options)));
7272

7373
// Exercize system
7474
var result = InvokeBuild<Simple_Options>(

tests/CommandLine.Tests/Unit/Issue104Tests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void Create_instance_with_enum_options_enabled_and_nullable_enum()
1919
// Exercize system
2020
var sut = new HelpText { AddDashesToOption = true, AddEnumValuesToHelpText = true, MaximumDisplayWidth = 80 }
2121
.AddPreOptionsLine("pre-options")
22-
.AddOptions(new NotParsed<Options_With_Nullable_Enum_Having_HelpText>(TypeInfo.Create(typeof(Options_With_Enum_Having_HelpText)), Enumerable.Empty<Error>()))
22+
.AddOptions(new NotParsed<Options_With_Nullable_Enum_Having_HelpText>(Enumerable.Empty<Error>(), TypeInfo.Create(typeof(Options_With_Enum_Having_HelpText))))
2323
.AddPostOptionsLine("post-options");
2424

2525
// Verify outcome

tests/CommandLine.Tests/Unit/Text/HelpTextAutoBuildFix.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public void HelpText_with_AdditionalNewLineAfterOption_true_should_have_newline(
1515
// Fixture setup
1616
// Exercize system
1717
var sut = new HelpText { AdditionalNewLineAfterOption = true }
18-
.AddOptions(new NotParsed<Simple_Options>(TypeInfo.Create(typeof(Simple_Options)),
19-
Enumerable.Empty<Error>()));
18+
.AddOptions(new NotParsed<Simple_Options>(Enumerable.Empty<Error>(),
19+
TypeInfo.Create(typeof(Simple_Options))));
2020

2121
// Verify outcome
2222

@@ -40,8 +40,8 @@ public void HelpText_with_AdditionalNewLineAfterOption_false_should_not_have_new
4040
// Fixture setup
4141
// Exercize system
4242
var sut = new HelpText { AdditionalNewLineAfterOption = false }
43-
.AddOptions(new NotParsed<Simple_Options>(TypeInfo.Create(typeof(Simple_Options)),
44-
Enumerable.Empty<Error>()));
43+
.AddOptions(new NotParsed<Simple_Options>(Enumerable.Empty<Error>(),
44+
TypeInfo.Create(typeof(Simple_Options))));
4545

4646
// Verify outcome
4747

@@ -59,8 +59,8 @@ public void HelpText_with_by_default_should_include_help_version_option()
5959
// Fixture setup
6060
// Exercize system
6161
var sut = new HelpText ()
62-
.AddOptions(new NotParsed<Simple_Options>(TypeInfo.Create(typeof(Simple_Options)),
63-
Enumerable.Empty<Error>()));
62+
.AddOptions(new NotParsed<Simple_Options>(Enumerable.Empty<Error>(),
63+
TypeInfo.Create(typeof(Simple_Options))));
6464

6565
// Verify outcome
6666

@@ -77,8 +77,8 @@ public void HelpText_with_AutoHelp_false_should_hide_help_option()
7777
// Fixture setup
7878
// Exercize system
7979
var sut = new HelpText { AutoHelp = false,AutoVersion = false}
80-
.AddOptions(new NotParsed<Simple_Options>(TypeInfo.Create(typeof(Simple_Options)),
81-
Enumerable.Empty<Error>()));
80+
.AddOptions(new NotParsed<Simple_Options>(Enumerable.Empty<Error>(),
81+
TypeInfo.Create(typeof(Simple_Options))));
8282

8383
// Verify outcome
8484

0 commit comments

Comments
 (0)