@@ -197,18 +197,18 @@ object Completion {
197197 while ctx ne NoContext do
198198 if ctx.isImportContext then
199199 importedCompletions(using ctx).foreach { (name, denots) =>
200- addMapping(name, ScopedDenotations (denots, ctx.scope, isFromImport = true ))
200+ addMapping(name, ScopedDenotations (denots, ctx))
201201 }
202202 else if ctx.owner.isClass then
203203 accessibleMembers(ctx.owner.thisType)
204204 .groupByName.foreach { (name, denots) =>
205- addMapping(name, ScopedDenotations (denots, ctx.scope, isFromImport = false ))
205+ addMapping(name, ScopedDenotations (denots, ctx))
206206 }
207207 else if ctx.scope != null then
208208 ctx.scope.toList.filter(symbol => include(symbol, symbol.name))
209209 .flatMap(_.alternatives)
210210 .groupByName.foreach { (name, denots) =>
211- addMapping(name, ScopedDenotations (denots, ctx.scope, isFromImport = false ))
211+ addMapping(name, ScopedDenotations (denots, ctx))
212212 }
213213
214214 ctx = ctx.outer
@@ -218,13 +218,13 @@ object Completion {
218218
219219 mappings.foreach { (name, denotss) =>
220220 val first = denotss.head
221- denotss.find(! _.isFromImport ) match {
221+ denotss.find(! _.ctx.isImportContext ) match {
222222 // most deeply nested member or local definition if not shadowed by an import
223- case Some (ScopedDenotations (denots, scope, _)) if scope == first.scope =>
224- resultMappings += name -> denots
223+ case Some (local) if local.ctx. scope == first.ctx .scope =>
224+ resultMappings += name -> local. denots
225225
226226 // most deeply nested import if not shadowed by another import
227- case None if denotss.length < 2 || (denotss(1 ).scope ne first.scope) =>
227+ case None if denotss.length < 2 || (denotss(1 ).ctx. scope ne first.ctx .scope) =>
228228 resultMappings += name -> first.denots
229229
230230 case _ =>
@@ -436,11 +436,7 @@ object Completion {
436436 /** Temporary data structure representing denotations with the same name introduced in a given scope
437437 * as a member of a type, by a local definition or by an import clause
438438 */
439- private case class ScopedDenotations (
440- denots : Seq [SingleDenotation ],
441- scope : Scope ,
442- isFromImport : Boolean
443- )
439+ private case class ScopedDenotations (denots : Seq [SingleDenotation ], ctx : Context )
444440
445441 /**
446442 * The completion mode: defines what kinds of symbols should be included in the completion
0 commit comments