Skip to content

Commit

Permalink
SI-8263 Avoid SOE in logicallyEnclosingMember
Browse files Browse the repository at this point in the history
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 (sbt/sbt#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`.
  • Loading branch information
retronym committed Feb 12, 2014
1 parent 64ad11b commit 555db25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/reflect/scala/reflect/internal/Symbols.scala
Expand Up @@ -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. */
Expand Down

0 comments on commit 555db25

Please sign in to comment.