diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 38a139be1502..cdc128143266 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -366,14 +366,11 @@ class Inliner(call: tpd.Tree, rhs: tpd.Tree)(implicit ctx: Context) { case tpe: ThisType if !ctx.owner.isContainedIn(tpe.cls) && !tpe.cls.is(Package) && !thisProxy.contains(tpe.cls) => - if (tpe.cls.isStaticOwner) - thisProxy(tpe.cls) = tpe.cls.sourceModule.termRef - else { - val proxyName = s"${tpe.cls.name}_this".toTermName - val proxyType = tpe.asSeenFrom(prefix.tpe, meth.owner) - thisProxy(tpe.cls) = newSym(proxyName, EmptyFlags, proxyType).termRef + val proxyName = s"${tpe.cls.name}_this".toTermName + val proxyType = tpe.asSeenFrom(prefix.tpe, meth.owner) + thisProxy(tpe.cls) = newSym(proxyName, EmptyFlags, proxyType).termRef + if (!tpe.cls.isStaticOwner) registerType(meth.owner.thisType) // make sure we have a base from which to outer-select - } case tpe: NamedType if tpe.symbol.is(Param) && tpe.symbol.owner == meth && !paramProxy.contains(tpe) => diff --git a/tests/run/inline-object.check b/tests/run/inline-object.check new file mode 100644 index 000000000000..5716ca5987cb --- /dev/null +++ b/tests/run/inline-object.check @@ -0,0 +1 @@ +bar diff --git a/tests/run/inline-object.scala b/tests/run/inline-object.scala new file mode 100644 index 000000000000..88a5777dd252 --- /dev/null +++ b/tests/run/inline-object.scala @@ -0,0 +1,14 @@ + +object Test { + def main(args: Array[String]): Unit = { + Foo.foo + } +} + +object Foo extends Bar { + inline def foo: Unit = bar +} + +class Bar { + def bar: Unit = println("bar") +}