aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Inliner.scala7
-rw-r--r--tests/pos/i1990a.scala20
2 files changed, 26 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala
index cfc0003c6..6cf69b97c 100644
--- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala
@@ -402,7 +402,12 @@ class Inliner(call: tpd.Tree, rhs: tpd.Tree)(implicit ctx: Context) {
def outerLevel(selfSym: Symbol): Int = classOf(selfSym).ownersIterator.length
// All needed this-proxies, sorted by nesting depth of the classes they represent (innermost first)
- val accessedSelfSyms = thisProxy.values.toList.map(_.symbol).sortBy(-outerLevel(_))
+ val accessedSelfSyms =
+ thisProxy.toList.sortBy {
+ case (cls, proxy) => -outerLevel(cls)
+ } map {
+ case (cls, proxy) => proxy.symbol
+ }
// Compute val-definitions for all this-proxies and append them to `bindingsBuf`
var lastSelf: Symbol = NoSymbol
diff --git a/tests/pos/i1990a.scala b/tests/pos/i1990a.scala
new file mode 100644
index 000000000..f6f95ee36
--- /dev/null
+++ b/tests/pos/i1990a.scala
@@ -0,0 +1,20 @@
+class A { self =>
+ class Foo {
+ inline def inlineMeth: Unit = {
+ println(self)
+ }
+ }
+}
+
+class C extends A {
+ class B extends A
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val c = new C
+ val b = new c.B
+
+ (new b.Foo).inlineMeth
+ }
+}