aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 44629c036..bc253021f 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -744,7 +744,8 @@ object SymDenotations {
final def enclosingMethod(implicit ctx: Context): Symbol =
if (this is (Method, butNot = Label)) symbol
else if (this.isClass) primaryConstructor
- else owner.enclosingMethod
+ else if (this.exists) owner.enclosingMethod
+ else NoSymbol
/** The top-level class containing this denotation,
* except for a toplevel module, where its module class is returned.