File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -629,6 +629,33 @@ linter:
629
629
});
630
630
});
631
631
632
+ group ('regression' , () {
633
+ test ('field without name' , () async {
634
+ // This is a test for https://github.com/dart-lang/sdk/issues/60927.
635
+ p = project (
636
+ mainSrc: '''
637
+ class C {
638
+ int? a,;
639
+ }
640
+ ''' ,
641
+ analysisOptions: '''
642
+ linter:
643
+ rules:
644
+ - prefer_final_fields
645
+ ''' ,
646
+ );
647
+ var result = await p! .runFix (['--apply' , '.' ], workingDir: p! .dirPath);
648
+ expect (result.exitCode, 0 );
649
+ expect (result.stderr, isEmpty);
650
+ expect (
651
+ result.stdout,
652
+ stringContainsInOrderWithVariableBullets ([
653
+ 'Computing fixes in myapp...' ,
654
+ 'Nothing to fix!' ,
655
+ ]));
656
+ });
657
+ });
658
+
632
659
group ('compare-to-golden' , () {
633
660
test ('target is not a directory' , () async {
634
661
p = project (
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class _DeclarationsCollector extends RecursiveAstVisitor<void> {
52
52
for (var variable in node.fields.variables) {
53
53
var element = variable.declaredFragment? .element;
54
54
if (element is FieldElement &&
55
+ element.name3 != null &&
55
56
element.isPrivate &&
56
57
! overridesField (element)) {
57
58
fields[element] = variable;
You can’t perform that action at this time.
0 commit comments