File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -361,7 +361,7 @@ class InfoBuilder {
361361
362362 var lineInfo = result.unit.lineInfo;
363363 var insertions = < int , List <AtomicEdit >> {};
364- var hintsSeen = < HintComment > {} ;
364+ var infosSeen = Set < AtomicEditInfo >. identity () ;
365365
366366 // Apply edits and build the regions.
367367 var changes = sourceInfo.changes ?? {};
@@ -392,8 +392,7 @@ class InfoBuilder {
392392 ? const < TraceInfo > []
393393 : _computeTraces (info.fixReasons);
394394 var description = info? .description;
395- var hint = info? .hintComment;
396- var isCounted = hint == null || hintsSeen.add (hint);
395+ var isCounted = info != null && infosSeen.add (info);
397396 var explanation = description? .appliedMessage;
398397 var kind = description? .kind;
399398 if (edit.isInsertion) {
Original file line number Diff line number Diff line change @@ -161,6 +161,26 @@ bool b = a!.isEven;
161161 ['1 late final hint converted to late and final keywords' ]));
162162 }
163163
164+ Future <void > test_editList_countsWhereOrNullSingly () async {
165+ await buildInfoForSingleTestFile (
166+ '''
167+ import 'package:collection/collection.dart';
168+
169+ int firstEven(Iterable<int> x)
170+ => x.firstWhere((x) => x.isEven, orElse: () => null);
171+ ''' ,
172+ removeViaComments: false ,
173+ migratedContent: '''
174+ import 'package:collection/collection.dart';
175+
176+ int? firstEven(Iterable<int > x)
177+ => x.firstWherefirstWhereOrNull((x) => x.isEven, orElse: () => null);
178+ ''' );
179+ var output = renderUnits ()[0 ];
180+ expect (output.edits.keys,
181+ unorderedEquals (['1 method name changed' , '1 type made nullable' ]));
182+ }
183+
164184 Future <void > test_editList_pluralHeader () async {
165185 await buildInfoForSingleTestFile ('''
166186int a = null;
You can’t perform that action at this time.
0 commit comments