Skip to content

Fix #2265: Make new symbols for inlined module proxies. #2269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions compiler/src/dotty/tools/dotc/typer/Inliner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
1 change: 1 addition & 0 deletions tests/run/inline-object.check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bar
14 changes: 14 additions & 0 deletions tests/run/inline-object.scala
Original file line number Diff line number Diff line change
@@ -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")
}