From 555db2576438b9f83480f0039c752575807de829 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 11 Feb 2014 17:33:40 +0100 Subject: 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`. --- src/reflect/scala/reflect/internal/Symbols.scala | 5 +++-- 1 file 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. */ -- cgit v1.2.3