From bd80a187c3792a4891bec72e0b27b858a5a992ab Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 19 Feb 2017 21:58:50 +0100 Subject: Harden outer proxy computation of inlined code It turns out that we simply cannot do reliable outer path computation that fills in the right hand sides of this-proxies from the types of these proxies. As-seen-from logic can mangle the types of proxies enough to scramble the necessary information. What we now do instead is simply count: We record the number of outer accesses to an outer this in inlineable code, and do the same number of outer accesses when computing the proxy. --- compiler/src/dotty/tools/dotc/core/NameOps.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compiler/src/dotty/tools/dotc/core/NameOps.scala') diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala index cd3ae2a25..aac313892 100644 --- a/compiler/src/dotty/tools/dotc/core/NameOps.scala +++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala @@ -271,6 +271,13 @@ object NameOps { else -1 } + + /** The number of hops specified in an outer-select name */ + def outerSelectHops: Int = { + require(isOuterSelect) + name.dropRight(nme.OUTER_SELECT.length).toString.toInt + } + /** The name of the generic runtime operation corresponding to an array operation */ def genericArrayOp: TermName = name match { case nme.apply => nme.array_apply -- cgit v1.2.3