summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-07-13 10:46:04 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-07-13 10:46:04 -0700
commit25d7c879b07fce088fa69f5548efedfeecbf537f (patch)
tree1bbbb6dfced74f1c97d507682e419cc204f3cdf5 /src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
parent216e09b3ead43039f2e34a135820ef098c3be74e (diff)
parentfc7cb9a91918cfdf7afe0600a87290ff71f88f12 (diff)
downloadscala-c65420c583b7463a6421a8f16270716fbb73b1e2.tar.gz
scala-c65420c583b7463a6421a8f16270716fbb73b1e2.tar.bz2
scala-c65420c583b7463a6421a8f16270716fbb73b1e2.zip
Merge pull request #4623 from retronym/ticket/9392v2.12.0-M2
SI-9392 Avoid crash in GenBCode for incoherent trees
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
index cf29c8090b..7b238e56eb 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
@@ -351,6 +351,14 @@ 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?
+ None
else {
// See comment in BTypes, when is a class marked static in the InnerClass table.
val isStaticNestedClass = isOriginallyStaticOwner(innerClassSym.originalOwner)