@@ -134,14 +134,14 @@ object Completion {
134134 * If several denotations share the same name, the type denotations appear before term denotations inside
135135 * the same `Completion`.
136136 */
137- private def describeCompletions (completions : Map [ Name , Seq [ SingleDenotation ]] )(using Context ): List [Completion ] = {
137+ private def describeCompletions (completions : CompletionMap )(using Context ): List [Completion ] = {
138138 completions
139139 .toList.groupBy(_._1.toTermName) // don't distinguish between names of terms and types
140140 .toList.map { (name, namedDenots) =>
141- val denots = namedDenots.flatMap(_._2)
142- val typesFirst = denots.sortWith((d1, d2) => d1.isType && ! d2.isType)
143- val desc = description(typesFirst)
144- Completion (name.show, desc, typesFirst.map(_.symbol))
141+ val denots = namedDenots.flatMap(_._2)
142+ val typesFirst = denots.sortWith((d1, d2) => d1.isType && ! d2.isType)
143+ val desc = description(typesFirst)
144+ Completion (name.show, desc, typesFirst.map(_.symbol))
145145 }
146146 }
147147
@@ -188,7 +188,7 @@ object Completion {
188188 * (even if the import follows it syntactically)
189189 * - a more deeply nested import shadowing a member or a local definition causes an ambiguity
190190 */
191- def scopeCompletions (using context : Context ): Map [ Name , Seq [ SingleDenotation ]] = {
191+ def scopeCompletions (using context : Context ): CompletionMap = {
192192 val mappings = collection.mutable.Map .empty[Name , List [ScopedDenotations ]].withDefaultValue(List .empty)
193193 def addMapping (name : Name , denots : ScopedDenotations ) =
194194 mappings(name) = mappings(name) :+ denots
@@ -238,15 +238,15 @@ object Completion {
238238 * Direct members take priority over members from extensions
239239 * and so do members from extensions over members from implicit conversions
240240 */
241- def selectionCompletions (qual : Tree )(using Context ): Map [ Name , Seq [ SingleDenotation ]] =
241+ def selectionCompletions (qual : Tree )(using Context ): CompletionMap =
242242 implicitConversionMemberCompletions(qual) ++
243243 extensionCompletions(qual) ++
244244 directMemberCompletions(qual)
245245
246246 /** Completions for members of `qual`'s type.
247247 * These include inherited definitions but not members added by extensions or implicit conversions
248248 */
249- def directMemberCompletions (qual : Tree )(using Context ): Map [ Name , Seq [ SingleDenotation ]] =
249+ def directMemberCompletions (qual : Tree )(using Context ): CompletionMap =
250250 if qual.tpe.widenDealias.isExactlyNothing then
251251 Map .empty
252252 else
@@ -255,7 +255,7 @@ object Completion {
255255 /** Completions introduced by imports directly in this context.
256256 * Completions from outer contexts are not included.
257257 */
258- private def importedCompletions (using Context ): Map [ Name , Seq [ SingleDenotation ]] = {
258+ private def importedCompletions (using Context ): CompletionMap = {
259259 val imp = ctx.importInfo
260260
261261 def fromImport (name : Name , nameInScope : Name ): Seq [(Name , SingleDenotation )] =
@@ -293,7 +293,7 @@ object Completion {
293293 }
294294
295295 /** Completions from implicit conversions including old style extensions using implicit classes */
296- private def implicitConversionMemberCompletions (qual : Tree )(using Context ): Map [ Name , Seq [ SingleDenotation ]] =
296+ private def implicitConversionMemberCompletions (qual : Tree )(using Context ): CompletionMap =
297297 if qual.tpe.widenDealias.isExactlyNothing || qual.tpe.isNullType then
298298 Map .empty
299299 else
@@ -302,7 +302,7 @@ object Completion {
302302 membersFromConversion.toSeq.groupByName
303303
304304 /** Completions from extension methods */
305- private def extensionCompletions (qual : Tree )(using Context ): Map [ Name , Seq [ SingleDenotation ]] =
305+ private def extensionCompletions (qual : Tree )(using Context ): CompletionMap =
306306 def asDefLikeType (tpe : Type ): Type = tpe match
307307 case _ : MethodOrPoly => tpe
308308 case _ => ExprType (tpe)
@@ -424,13 +424,15 @@ object Completion {
424424 }
425425
426426 extension (denotations : Seq [SingleDenotation ])
427- def groupByName (using Context ): Map [ Name , Seq [ SingleDenotation ]] = denotations.groupBy(_.name)
427+ def groupByName (using Context ): CompletionMap = denotations.groupBy(_.name)
428428
429429 extension [N <: Name ](namedDenotations : Seq [(N , SingleDenotation )])
430430 @ annotation.targetName(" groupByNameTupled" )
431- def groupByName : Map [ N , Seq [ SingleDenotation ]] = namedDenotations.groupMap((name, denot) => name)((name, denot) => denot)
431+ def groupByName : CompletionMap = namedDenotations.groupMap((name, denot) => name)((name, denot) => denot)
432432 }
433433
434+ private type CompletionMap = Map [Name , Seq [SingleDenotation ]]
435+
434436 /** Temporary data structure representing denotations with the same name introduced in a given scope
435437 * as a member of a type, by a local definition or by an import clause
436438 */
0 commit comments