diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-07-16 09:56:56 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-07-16 09:56:56 +0200 |
commit | 476434df55caae615e5b96423b5f66ad88cbe8ae (patch) | |
tree | 1ca4cb84be2554f167e9d9440e330c9827f41e69 | |
parent | fba4a10f26ebd5d1f0457c38ff292a366832cd4b (diff) | |
parent | 17d6a735dcfe679fb4d8f57b19946d15bb2559f8 (diff) | |
download | scala-476434df55caae615e5b96423b5f66ad88cbe8ae.tar.gz scala-476434df55caae615e5b96423b5f66ad88cbe8ae.tar.bz2 scala-476434df55caae615e5b96423b5f66ad88cbe8ae.zip |
Merge pull request #4630 from lrytz/t9392
SI-9392 Clarify the workaround comment and introduce a devWarning
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala index 7b238e56eb..9b4451d492 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala @@ -351,15 +351,15 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes { val isTopLevel = innerClassSym.rawowner.isPackageClass // impl classes are considered top-level, see comment in BTypes if (isTopLevel || considerAsTopLevelImplementationArtifact(innerClassSym)) None - else if (innerClassSym.rawowner.isTerm) - // SI-9392 An errant macro might leave a reference to a local class symbol that no longer exists in the tree, - // this avoids an assertion error in that case. AFAICT, we don't actually need the `NestedInfo` for all BTypes, - // only for ones that describe classes defined in the trees that reach the backend, so this is safe enough. - // - // TODO Can we avoid creating `NestedInfo` for each type that is referred to, and instead only create if for - // symbols of ClassDefs? + else if (innerClassSym.rawowner.isTerm) { + // This case should never be reached: the lambdalift phase mutates the rawowner field of all + // classes to be the enclosing class. SI-9392 shows an errant macro that leaves a reference + // to a local class symbol that no longer exists, which is not updated by lambdalift. + devWarning(innerClassSym.pos, + s"""The class symbol $innerClassSym with the term symbol ${innerClassSym.rawowner} as `rawowner` reached the backend. + |Most likely this indicates a stale reference to a non-existing class introduced by a macro, see SI-9392.""".stripMargin) None - else { + } else { // See comment in BTypes, when is a class marked static in the InnerClass table. val isStaticNestedClass = isOriginallyStaticOwner(innerClassSym.originalOwner) |