Skip to content

Commit de06294

Browse files
authored
Remove a non-useful type check on generic type variable (#3457)
* Invert a type test on a type variable This type test was introduced during the null safety migration and I do not see discussion about the intention. In practice this is `assert(true)` so it would be safest to remove it entirely, but we can also take a guess at the intention. The full assert when it was introduced was `asset(T is! Iterable || splitCommas == true)`. Later the second condition was removed, and the `splitCommas` field overridden to always return `false`. I think the intention was to express that options which support multiple values _must_ split commas, and now that this class is only used without splitting commas the intention is that the options must be scalar values. Invert the type test with a value known to satisfy a check for any subtype of `Iterable`. Add a string explaining the assert. * Remove assert entirely
1 parent d5dc076 commit de06294

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/src/dartdoc_options.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,7 @@ class DartdocOptionArgSynth<T> extends DartdocOption<T>
599599
String help = '',
600600
OptionKind optionIs = OptionKind.other,
601601
this.negatable = false})
602-
: assert(T is! Iterable),
603-
super(name, null, help, optionIs, mustExist, null, resourceProvider);
602+
: super(name, null, help, optionIs, mustExist, null, resourceProvider);
604603

605604
@override
606605
bool get hide => false;

0 commit comments

Comments
 (0)