Skip to content

Commit 96ad00a

Browse files
committed
Fix #2743: Fix hover problem
Also add an assert in isRef to track down a stackoverflow going infinitely often through this line. Hopefully the assert will track that down.
1 parent bf22702 commit 96ad00a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ object Types {
125125
def isRef(sym: Symbol)(implicit ctx: Context): Boolean = stripAnnots.stripTypeVar match {
126126
case this1: TypeRef =>
127127
this1.info match { // see comment in Namer#typeDefSig
128-
case TypeAlias(tp) => tp.isRef(sym)
128+
case TypeAlias(tp) => assert(tp ne this); tp.isRef(sym)
129129
case _ => this1.symbol eq sym
130130
}
131131
case this1: RefinedOrRecType => this1.parent.isRef(sym)

language-server/src/dotty/tools/languageserver/DottyLanguageServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ class DottyLanguageServer extends LanguageServer
297297
implicit val ctx = driver.currentCtx
298298

299299
val pos = sourcePosition(driver, uri, params.getPosition)
300-
val tp = Interactive.enclosingType(driver.openedTrees(uri), pos)
300+
val tp = Interactive.enclosingType(driver.openedTrees.getOrElse(uri, Nil), pos)
301301
val tpw = tp.widenTermRefExpr
302302

303303
if (tpw == NoType) new Hover

0 commit comments

Comments
 (0)