Closed
Description
This may be a dupe of #28262, #29431 or #28967 but it looks different to me so I thought it worth raising.
var hasAnError = false;
void danny() {
if (hasAnError) {
return;
}
setError();
if (hasAnError) { // Conditions should not unconditionally evaluate to `true` or to `false`.
return;
}
print('Running');
}
void setError() {
hasAnError = true;
}
I wouldn't expect it to look through all called code to see if the variable is set, but possibly it's a bit too keen to report here.