diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-08 13:32:28 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-08 13:32:53 +0200 |
commit | 10610cbc65cce2e5056b8606968c738532e55bfd (patch) | |
tree | a4a3b1917586c47d557eadb4fc3c18ee0d321219 | |
parent | f1d4e8494b2a345ed165ae75077b72fa7c4e6161 (diff) | |
download | dotty-10610cbc65cce2e5056b8606968c738532e55bfd.tar.gz dotty-10610cbc65cce2e5056b8606968c738532e55bfd.tar.bz2 dotty-10610cbc65cce2e5056b8606968c738532e55bfd.zip |
Make isTerm/isType not force the denotation of a symbols defined in this run.
See discussion in #544
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index f7d74d73e..14acf26f5 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -406,8 +406,12 @@ object Symbols { } /** Subclass tests and casts */ - final def isTerm(implicit ctx: Context): Boolean = lastDenot.isTerm - final def isType(implicit ctx: Context): Boolean = lastDenot.isType + final def isTerm(implicit ctx: Context): Boolean = + (if(isDefinedInCurrentRun) lastDenot else denot).isTerm + + final def isType(implicit ctx: Context): Boolean = + (if(isDefinedInCurrentRun) lastDenot else denot).isType + final def isClass: Boolean = isInstanceOf[ClassSymbol] final def asTerm(implicit ctx: Context): TermSymbol = { assert(isTerm, s"asTerm called on not-a-Term $this" ); asInstanceOf[TermSymbol] } |