File tree 1 file changed +8
-5
lines changed
compiler/src/dotty/tools/dotc/typer 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -273,11 +273,14 @@ trait ImportSuggestions:
273
273
/** The `ref` parts of this list of pairs, discarding subsequent elements that
274
274
* have the same String part. Elements are sorted by their String parts.
275
275
*/
276
- extension (refs : List [(TermRef , String )]) def distinctRefs (using Context ): List [TermRef ] = refs match
277
- case (ref, str) :: refs1 =>
278
- ref :: refs1.dropWhile(_._2 == str).distinctRefs
279
- case Nil =>
280
- Nil
276
+ extension (refs : List [(TermRef , String )]) def distinctRefs (using Context ): List [TermRef ] =
277
+ val buf = new mutable.ListBuffer [TermRef ]
278
+ var last = " "
279
+ for (ref, str) <- refs do
280
+ if last != str then
281
+ buf += ref
282
+ last = str
283
+ buf.toList
281
284
282
285
/** The best `n` references in `refs`, according to `compare`
283
286
* `compare` is a partial order. If there's a tie, we take elements
You can’t perform that action at this time.
0 commit comments