aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/NameOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-15 14:08:34 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-15 14:08:34 +0200
commit6545934f06f5c22ab4acacf28ca2206b898e021e (patch)
tree5fa34da1035989df64753e080a8da7af987d6191 /src/dotty/tools/dotc/core/NameOps.scala
parent98d7183067f6a48957988ba99d234f60ab0246be (diff)
downloaddotty-6545934f06f5c22ab4acacf28ca2206b898e021e.tar.gz
dotty-6545934f06f5c22ab4acacf28ca2206b898e021e.tar.bz2
dotty-6545934f06f5c22ab4acacf28ca2206b898e021e.zip
Fix #765 for super accessors
Partial fix of #765. Hack to make sure unexpandedName works for super accessor names.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/NameOps.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala
index b3b0982a4..4d2335bd9 100644
--- a/src/dotty/tools/dotc/core/NameOps.scala
+++ b/src/dotty/tools/dotc/core/NameOps.scala
@@ -184,7 +184,13 @@ object NameOps {
* an encoded name, e.g. super$$plus$eq. See #765.
*/
def unexpandedName: N = {
- val idx = name.lastIndexOfSlice(nme.EXPAND_SEPARATOR)
+ var idx = name.lastIndexOfSlice(nme.EXPAND_SEPARATOR)
+
+ // Hack to make super accessors from traits work. They would otherwise fail because of #765
+ // TODO: drop this once we have more robust name handling
+ if (name.slice(idx - FalseSuperLength, idx) == FalseSuper)
+ idx -= FalseSuper.length
+
if (idx < 0) name else (name drop (idx + nme.EXPAND_SEPARATOR.length)).asInstanceOf[N]
}
@@ -436,4 +442,7 @@ object NameOps {
name.dropRight(nme.LAZY_LOCAL.length)
}
}
+
+ private final val FalseSuper = "$$super".toTermName
+ private val FalseSuperLength = FalseSuper.length
}