diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala index 134781f7de19..9999311ac410 100644 --- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala @@ -1074,6 +1074,7 @@ object SymDenotations { case tp: Symbol => sourceOfSelf(tp.info) case tp: RefinedType => sourceOfSelf(tp.parent) case tp: AnnotatedType => sourceOfSelf(tp.parent) + case tp: ThisType => tp.cls } sourceOfSelf(selfType) case info: LazyType => diff --git a/tests/pos/i16437/def_1.scala b/tests/pos/i16437/def_1.scala new file mode 100644 index 000000000000..9f2135a963cd --- /dev/null +++ b/tests/pos/i16437/def_1.scala @@ -0,0 +1,9 @@ +class OU { + def dn: String = "" +} + +class Inventory() { + object NODES extends OU { nodes => + val x = nodes.dn + } +} diff --git a/tests/pos/i16437/use_2.scala b/tests/pos/i16437/use_2.scala new file mode 100644 index 000000000000..73135ea2a6af --- /dev/null +++ b/tests/pos/i16437/use_2.scala @@ -0,0 +1,2 @@ +@main def Test = + new Inventory().NODES.dn