-
-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
When using lint 1.5.1
In the following switch statement there are two cases that both check if char = ' '.
The lint incorrectly marks the second test as invariant_booleans as it sees the if char = ' ' in the first case and assume that the test protects the second case from having a space.
If you change the first char = ' ' in the first case to anything else the warning goes away.
The lint should not fire in this scenario.
enum _ParseState { starting, inQuote, inWord }
/// parses the given command breaking them done into words
void _parse2(String commandLine) {
var state = _ParseState.starting;
for (var i = 0; i < commandLine.length; i++) {
final char = commandLine[i];
switch (state) {
case _ParseState.starting:
if (char == ' ') {
break;
}
break;
case _ParseState.inWord:
if (char == ' ')
{
break;
}
}
}
}
jimbengtsson92
Metadata
Metadata
Assignees
Labels
No labels