-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposaltype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
BAD:
assert(foo = true); // Always evaluates to true, and will always pass.
assert(bar = false); // Always evaluates to false, and will always fail.GOOD:
assert(foo == true);
assert(bar == false);
// Intentionally set foo to true when asserts are enabled.
assert(() {
foo = true;
return true;
}());This has definitely caused problems for Flutter before - maybe @jonahwilliams remembers what, but I seem to remember him finding an assertion written like this that, when corrected, failed so often it had to just be disabled.
srawlins
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposaltype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug