Skip to content

Commit 913408e

Browse files
committed
chore: Add logget.warn in case where it breaks
[Cherry-picked 078be56]
1 parent 8b081a2 commit 913408e

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
@@ -33,6 +33,8 @@ import dotty.tools.dotc.core.Types
3333
import dotty.tools.dotc.core.Symbols
3434
import dotty.tools.dotc.core.Constants
3535

36+
import java.util.logging.Logger
37+
3638
/**
3739
* One of the results of a completion query.
3840
*
@@ -46,6 +48,8 @@ case class Completion(label: String, description: String, symbols: List[Symbol])
4648

4749
object Completion:
4850

51+
private val logger = Logger.getLogger(this.getClass.getName)
52+
4953
def scopeContext(pos: SourcePosition)(using Context): CompletionResult =
5054
val tpdPath = Interactive.pathTo(ctx.compilationUnit.tpdTree, pos.span)
5155
val completionContext = Interactive.contextOfPath(tpdPath).withPhase(Phases.typerPhase)
@@ -571,7 +575,11 @@ object Completion:
571575
val tpe = asDefLikeType(tree.typeOpt.dealias)
572576
termRef.denot.asSingleDenotation.mapInfo(_ => tpe)
573577
}
574-
catch case NonFatal(_) => None
578+
catch case NonFatal(ex) =>
579+
logger.warning(
580+
s"Exception when trying to apply extension method:\n ${ex.getMessage()}\n${ex.getStackTrace().mkString("\n")}"
581+
)
582+
None
575583

576584
def extractMemberExtensionMethods(types: Seq[Type]): Seq[(TermRef, TermName)] =
577585
object DenotWithMatchingName:
@@ -675,7 +683,11 @@ object Completion:
675683

676684
interactiv.println(i"implicit conversion targets considered: ${conversions.toList}%, %")
677685
conversions
678-
} catch case NonFatal(_) => Set.empty
686+
} catch case NonFatal(ex) =>
687+
logger.warning(
688+
s"Exception when searching for implicit conversions:\n ${ex.getMessage()}\n${ex.getStackTrace().mkString("\n")}"
689+
)
690+
Set.empty
679691

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

0 commit comments

Comments
 (0)