diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-07 18:41:37 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-08 22:53:19 +0200 |
commit | ae69de4cb610c2b92fd51052cd32702dd3bd1e9f (patch) | |
tree | 6bf218c27f9194e877f3af4f479647b5272cfe47 /src | |
parent | 9d7f81103b423a51b021ab80884cfbc57bfb75f6 (diff) | |
download | scala-ae69de4cb610c2b92fd51052cd32702dd3bd1e9f.tar.gz scala-ae69de4cb610c2b92fd51052cd32702dd3bd1e9f.tar.bz2 scala-ae69de4cb610c2b92fd51052cd32702dd3bd1e9f.zip |
SI-7335 Add logging for a now-impossible* case in Symbol#exists.
* Impossible (to the best of my knowledge) because LowPriorityImplicits
is now defined in Predef.scala. Were I more sure, we could trip an
assertion here, rather than the devWarning.
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/internal/Symbols.scala | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 8ef2805529..4a7b25e6be 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -887,9 +887,23 @@ trait Symbols extends api.Symbols { self: SymbolTable => supersym == NoSymbol || supersym.isIncompleteIn(base) } - // Does not always work if the rawInfo is a SourcefileLoader, see comment - // in "def coreClassesFirst" in Global. - def exists = !isTopLevel || { rawInfo.load(this); rawInfo != NoType } + def exists: Boolean = !isTopLevel || { + val isSourceLoader = rawInfo match { + case sl: SymLoader => sl.fromSource + case _ => false + } + def warnIfSourceLoader() { + if (isSourceLoader) + // Predef is completed early due to its autoimport; we used to get here when type checking its + // parent LowPriorityImplicits. See comment in c5441dc for more elaboration. + // Since the fix for SI-7335 Predef parents must be defined in Predef.scala, and we should not + // get here anymore. + devWarning(s"calling Symbol#exists with sourcefile based symbol loader may give incorrect results."); + } + + rawInfo load this + rawInfo != NoType || { warnIfSourceLoader(); false } + } final def isInitialized: Boolean = validTo != NoPeriod |