Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions compiler/src/dotty/tools/dotc/interactive/Completion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,15 @@ object Completion:
case _: MethodOrPoly => tpe
case _ => ExprType(tpe)

// Try added due to https://github.com/scalameta/metals/issues/7872
def tryApplyingReceiverToExtension(termRef: TermRef): Option[SingleDenotation] =
ctx.typer.tryApplyingExtensionMethod(termRef, qual)
.map { tree =>
val tpe = asDefLikeType(tree.typeOpt.dealias)
termRef.denot.asSingleDenotation.mapInfo(_ => tpe)
}
try
ctx.typer.tryApplyingExtensionMethod(termRef, qual)
.map { tree =>
val tpe = asDefLikeType(tree.typeOpt.dealias)
termRef.denot.asSingleDenotation.mapInfo(_ => tpe)
}
catch case NonFatal(_) => None

def extractMemberExtensionMethods(types: Seq[Type]): Seq[(TermRef, TermName)] =
object DenotWithMatchingName:
Expand Down Expand Up @@ -704,13 +707,13 @@ object Completion:
* @param qual The argument to which the implicit conversion should be applied.
* @return The set of types after `qual` implicit conversion.
*/
private def implicitConversionTargets(qual: tpd.Tree)(using Context): Set[SearchSuccess] = {
private def implicitConversionTargets(qual: tpd.Tree)(using Context): Set[SearchSuccess] = try {
val typer = ctx.typer
val conversions = new typer.ImplicitSearch(defn.AnyType, qual, pos.span, Set.empty).allImplicits

interactiv.println(i"implicit conversion targets considered: ${conversions.toList}%, %")
conversions
}
} catch case NonFatal(_) => Set.empty

/** Filter for names that should appear when looking for completions. */
private object completionsFilter extends NameFilter:
Expand Down
Loading