aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-24 13:20:01 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:10 +0200
commit0ad1cd816bc1537ad332addabb0ff6c293e3e0a0 (patch)
tree68ab44576e17d19fa6cca14a0f750266a638eb7f /compiler/src/dotty/tools/dotc/transform
parenta2731a8be2f3434218623c0b0ecd4078107f14a5 (diff)
downloaddotty-0ad1cd816bc1537ad332addabb0ff6c293e3e0a0.tar.gz
dotty-0ad1cd816bc1537ad332addabb0ff6c293e3e0a0.tar.bz2
dotty-0ad1cd816bc1537ad332addabb0ff6c293e3e0a0.zip
Add default getter names
Plus various bug fixes and filling in missing functionality
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala11
-rw-r--r--compiler/src/dotty/tools/dotc/transform/TreeChecker.scala4
2 files changed, 9 insertions, 6 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala b/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala
index 3a301167d..b6c28f570 100644
--- a/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala
+++ b/compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala
@@ -18,6 +18,7 @@ import util.Positions._
import Names._
import collection.mutable
import ResolveSuper._
+import config.Config
/** This phase adds super accessors and method overrides where
* linearization differs from Java's rule for default methods in interfaces.
@@ -95,10 +96,12 @@ object ResolveSuper {
var bcs = base.info.baseClasses.dropWhile(acc.owner != _).tail
var sym: Symbol = NoSymbol
val unexpandedAccName =
- if (acc.is(ExpandedName)) // Cannot use unexpandedName because of #765. t2183.scala would fail if we did.
- acc.name
- .drop(acc.name.indexOfSlice(nme.EXPAND_SEPARATOR ++ nme.SUPER_PREFIX))
- .drop(nme.EXPAND_SEPARATOR.length)
+ if (acc.is(ExpandedName))
+ if (Config.semanticNames) acc.name.unexpandedName
+ else // Cannot use unexpandedName because of #765. t2183.scala would fail if we did.
+ acc.name
+ .drop(acc.name.indexOfSlice(nme.EXPAND_SEPARATOR ++ nme.SUPER_PREFIX))
+ .drop(nme.EXPAND_SEPARATOR.length)
else acc.name
val SuperAccessorName(memberName) = unexpandedAccName: Name // dotty deviation: ": Name" needed otherwise pattern type is neither a subtype nor a supertype of selector type
ctx.debuglog(i"starting rebindsuper from $base of ${acc.showLocated}: ${acc.info} in $bcs, name = $memberName")
diff --git a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala
index ebb5b605b..199fac82b 100644
--- a/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala
+++ b/compiler/src/dotty/tools/dotc/transform/TreeChecker.scala
@@ -50,10 +50,10 @@ class TreeChecker extends Phase with SymTransformer {
private val seenModuleVals = collection.mutable.HashMap[String, Symbol]()
def isValidJVMName(name: Name) =
- !name.exists(c => c == '.' || c == ';' || c =='[' || c == '/')
+ !name.toString.exists(c => c == '.' || c == ';' || c =='[' || c == '/')
def isValidJVMMethodName(name: Name) =
- !name.exists(c => c == '.' || c == ';' || c =='[' || c == '/' || c == '<' || c == '>')
+ !name.toString.exists(c => c == '.' || c == ';' || c =='[' || c == '/' || c == '<' || c == '>')
def printError(str: String)(implicit ctx: Context) = {
ctx.echo(Console.RED + "[error] " + Console.WHITE + str)