-
Couldn't load subscription status.
- Fork 1.7k
Closed
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-quick-fixIssues with analysis server (quick) fixesIssues with analysis server (quick) fixestype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
For example,
class F {
final v1 = () => 42;
void f() {
v1();
}
}fails the lint check prefer_function_declarations_over_variables and the convert_to_function_declaration fix should fix it to:
class F {
int v1() => 42;
void f() {
v1();
}
}But it doesn't do so.
I added the same as a new test case in pkg/analysis_server/test/src/services/correction/fix/convert_to_function_declaration_test.dart and that fails with:
00:01 +15 -1: ConvertToFunctionDeclarationTest | test_classField [E]
Expected to find fix dart.fix.convert.toFunctionDeclaration in
Fix(kind=dart.fix.ignore.line, change={"message":"Ignore 'prefer_function_declarations_over_variables' for this line","edits":[{"file":"/home/test/lib/test.dart","fileStamp":0,"edits":[{"offset":10,"length":0,"replacement":" // ignore: prefer_function_declarations_over_variables\n"}]}],"linkedEditGroups":[],"id":"dart.fix.ignore.line"})
Fix(kind=dart.fix.ignore.file, change={"message":"Ignore 'prefer_function_declarations_over_variables' for the whole file","edits":[{"file":"/home/test/lib/test.dart","fileStamp":0,"edits":[{"offset":0,"length":0,"replacement":"// ignore_for_file: prefer_function_declarations_over_variables\n\n"}]}],"linkedEditGroups":[],"id":"dart.fix.ignore.file"})
Fix(kind=dart.fix.ignore.analysis, change={"message":"Ignore 'prefer_function_declarations_over_variables' in `analysis_options.yaml`","edits":[{"file":"/home/test/analysis_options.yaml","fileStamp":0,"edits":[{"offset":9,"length":0,"replacement":"\n errors:\n prefer_function_declarations_over_variables: ignore"}]}],"linkedEditGroups":[],"id":"dart.fix.ignore.analysis"})
package:matcher fail
pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart 552:7 FixProcessorTest._assertHasFix
===== asynchronous gap ===========================
pkg/analysis_server/test/src/services/correction/fix/fix_processor.dart 389:15 FixProcessorTest.assertHasFix
===== asynchronous gap ===========================
pkg/analysis_server/test/src/services/correction/fix/convert_to_function_declaration_test.dart 336:5 ConvertToFunctionDeclarationTest.test_classField
===== asynchronous gap ===========================
package:test_reflective_loader/test_reflective_loader.dart 281:5 _runTest
===== asynchronous gap ===========================
package:test_reflective_loader/test_reflective_loader.dart 164:19 _addTestsIfTopLevelSuite.runTests.<fn>
Dart SDK version: 3.11.0-edge.945f32dfc76fd029f8a0e782107b4fc6aaefa924 (main) (Fri Oct 24 06:15:16 2025 -0700) on "macos_arm64"
FMorschel
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-quick-fixIssues with analysis server (quick) fixesIssues with analysis server (quick) fixestype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug