Skip to content

Commit 10610cb

Browse files
committed
Make isTerm/isType not force the denotation of a symbols defined in this run.
See discussion in scala#544
1 parent f1d4e84 commit 10610cb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,12 @@ object Symbols {
406406
}
407407

408408
/** Subclass tests and casts */
409-
final def isTerm(implicit ctx: Context): Boolean = lastDenot.isTerm
410-
final def isType(implicit ctx: Context): Boolean = lastDenot.isType
409+
final def isTerm(implicit ctx: Context): Boolean =
410+
(if(isDefinedInCurrentRun) lastDenot else denot).isTerm
411+
412+
final def isType(implicit ctx: Context): Boolean =
413+
(if(isDefinedInCurrentRun) lastDenot else denot).isType
414+
411415
final def isClass: Boolean = isInstanceOf[ClassSymbol]
412416

413417
final def asTerm(implicit ctx: Context): TermSymbol = { assert(isTerm, s"asTerm called on not-a-Term $this" ); asInstanceOf[TermSymbol] }

0 commit comments

Comments
 (0)