Closed
Description
dart fix
for avoid_redundant_argument_values
makes semantic changes when involving kIsWeb
.
STEPS TO REPRODUCE
dart create dart_fix_test
- Replace the
dart_fix_test/bin/dart_fix_test.dart
file as follows:
void test({ bool foo = true }) { }
const bool kIsWeb = identical(0, 0.0);
void main(List<String> arguments) {
test(foo: kIsWeb);
}
- Replace the analysis_options.yaml file as follows:
linter:
rules:
- avoid_redundant_argument_values
- Run
dart fix --apply
EXPECTED RESULTS
The analyzer and dart fix
should magically know that identical(0, 0.0)
is not a constant value despite it being a constant according to the language, and thus make no change to the code above.
ACTUAL RESULTS
The argument is removed, because kIsWeb is assumed to be true (which is weird in itself, but that's another story) and so the argument is removed. This is, of course, a significant semantic change.