Skip to content

Commit 716d93d

Browse files
authored
Fix object selftype match error (#16441)
Fixes #16437
2 parents acbc9aa + 6e64a9b commit 716d93d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,7 @@ object SymDenotations {
10741074
case tp: Symbol => sourceOfSelf(tp.info)
10751075
case tp: RefinedType => sourceOfSelf(tp.parent)
10761076
case tp: AnnotatedType => sourceOfSelf(tp.parent)
1077+
case tp: ThisType => tp.cls
10771078
}
10781079
sourceOfSelf(selfType)
10791080
case info: LazyType =>

tests/pos/i16437/def_1.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class OU {
2+
def dn: String = ""
3+
}
4+
5+
class Inventory() {
6+
object NODES extends OU { nodes =>
7+
val x = nodes.dn
8+
}
9+
}

tests/pos/i16437/use_2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@main def Test =
2+
new Inventory().NODES.dn

0 commit comments

Comments
 (0)