aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-19 09:29:28 +0100
committerMartin Odersky <odersky@gmail.com>2017-02-19 09:29:41 +0100
commitc54e942ef6275fc0c61c051539a1b37f4e12123c (patch)
tree744cbe78aa878ccb9ca9c9ba150cdbe8a5116fb8 /compiler
parentdb295e8fb13c8490b96d84e8357a75550ebdebfd (diff)
downloaddotty-c54e942ef6275fc0c61c051539a1b37f4e12123c.tar.gz
dotty-c54e942ef6275fc0c61c051539a1b37f4e12123c.tar.bz2
dotty-c54e942ef6275fc0c61c051539a1b37f4e12123c.zip
Fix sorting of accessed this-proxies
They are sorted according to the nesting depth of the classes they represent. This is no necessarily the same as the nesting level of the symbols of the proxy classes. i1990a.scala shows an example where the two differ.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Inliner.scala7
1 files changed, 6 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