Skip to content

Commit 66b9b1b

Browse files
tgodzikWojciechMazur
authored andcommitted
chore: Add logget.warn in case where it breaks
[Cherry-picked 078be56]
1 parent ff14efd commit 66b9b1b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

compiler/src/dotty/tools/dotc/interactive/Completion.scala

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import dotty.tools.dotc.core.Constants
3535
import dotty.tools.dotc.core.TypeOps
3636
import dotty.tools.dotc.core.StdNames
3737

38+
import java.util.logging.Logger
39+
3840
/**
3941
* One of the results of a completion query.
4042
*
@@ -48,6 +50,8 @@ case class Completion(label: String, description: String, symbols: List[Symbol])
4850

4951
object Completion:
5052

53+
private val logger = Logger.getLogger(this.getClass.getName)
54+
5155
def scopeContext(pos: SourcePosition)(using Context): CompletionResult =
5256
val tpdPath = Interactive.pathTo(ctx.compilationUnit.tpdTree, pos.span)
5357
val completionContext = Interactive.contextOfPath(tpdPath).withPhase(Phases.typerPhase)
@@ -599,7 +603,11 @@ object Completion:
599603
val tpe = asDefLikeType(tree.typeOpt.dealias)
600604
termRef.denot.asSingleDenotation.mapInfo(_ => tpe)
601605
}
602-
catch case NonFatal(_) => None
606+
catch case NonFatal(ex) =>
607+
logger.warning(
608+
s"Exception when trying to apply extension method:\n ${ex.getMessage()}\n${ex.getStackTrace().mkString("\n")}"
609+
)
610+
None
603611

604612
def extractMemberExtensionMethods(types: Seq[Type]): Seq[(TermRef, TermName)] =
605613
object DenotWithMatchingName:
@@ -703,7 +711,11 @@ object Completion:
703711

704712
interactiv.println(i"implicit conversion targets considered: ${conversions.toList}%, %")
705713
conversions
706-
} catch case NonFatal(_) => Set.empty
714+
} catch case NonFatal(ex) =>
715+
logger.warning(
716+
s"Exception when searching for implicit conversions:\n ${ex.getMessage()}\n${ex.getStackTrace().mkString("\n")}"
717+
)
718+
Set.empty
707719

708720
/** Filter for names that should appear when looking for completions. */
709721
private object completionsFilter extends NameFilter:

0 commit comments

Comments
 (0)