summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-02-11 17:33:40 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-12 13:20:32 +0100
commit555db2576438b9f83480f0039c752575807de829 (patch)
tree9113a6df6753f2a609f00de7de4d116dd2256117 /src/reflect
parent64ad11b49bd7630d596e950953a5b15d3abf1689 (diff)
downloadscala-555db2576438b9f83480f0039c752575807de829.tar.gz
scala-555db2576438b9f83480f0039c752575807de829.tar.bz2
scala-555db2576438b9f83480f0039c752575807de829.zip
SI-8263 Avoid SOE in logicallyEnclosingMember
We've started calling this method during higher-kinded subtyping to ensure that variances of higher order type params in overriding as soundly aligned. Turns out that running this over the expansion of the SBT task macro leads to a SOE due to a corrupt owner chain. I've fixed that in SBT (https://github.com/sbt/sbt/pull/1113), but we ought not crash like this. This commit considers NoSymbol to be its own enclosing member and logs a -Xdev warning. This is analagous to the handling of `NoSymbol.owner`.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 2969bd92de..81e78d4c5d 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -2047,9 +2047,10 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
* (or, for traits: `$init`) of `C`.
*
*/
- def logicallyEnclosingMember: Symbol =
+ final def logicallyEnclosingMember: Symbol =
if (isLocalDummy) enclClass.primaryConstructor
- else if (isMethod || isClass) this
+ else if (isMethod || isClass || this == NoSymbol) this
+ else if (this == NoSymbol) { devWarningDumpStack("NoSymbol.logicallyEnclosingMember", 15); this }
else owner.logicallyEnclosingMember
/** The top-level class containing this symbol. */