File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,8 @@ abstract class AccessProxies {
130130 val accessed = reference.symbol.asTerm
131131 var accessorClass = hostForAccessorOf(accessed : Symbol )
132132 if (accessorClass.exists) {
133+ if accessorClass.is(Package ) then
134+ accessorClass = ctx.owner.topLevelClass
133135 val accessorName = accessorNameKind(accessed.name)
134136 val accessorInfo =
135137 accessed.info.ensureMethodic.asSeenFrom(accessorClass.thisType, accessed.owner)
@@ -159,8 +161,9 @@ object AccessProxies {
159161 def hostForAccessorOf (accessed : Symbol )(implicit ctx : Context ): Symbol = {
160162 def recur (cls : Symbol ): Symbol =
161163 if (! cls.exists) NoSymbol
162- else if (cls.derivesFrom(accessed.owner) ||
163- cls.companionModule.moduleClass == accessed.owner) cls
164+ else if cls.derivesFrom(accessed.owner)
165+ || cls.companionModule.moduleClass == accessed.owner
166+ then cls
164167 else recur(cls.owner)
165168 recur(ctx.owner)
166169 }
Original file line number Diff line number Diff line change 1+ package foo {
2+ object A {
3+ inline def f (x : Int ) = B .f(x)
4+ }
5+
6+ private [foo] object B {
7+ def f (x : Int ) = x * 5
8+ }
9+ }
10+
11+ class Test {
12+ val x = foo.A .f(4 )
13+ }
You can’t perform that action at this time.
0 commit comments