summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala14
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala9
-rw-r--r--test/files/run/bug657.check1
-rw-r--r--test/files/run/bug657.scala51
4 files changed, 68 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index e36fffbff4..53f3515fbc 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -319,8 +319,16 @@ trait Types requires SymbolTable {
* by `owner'. Identity for all other types. */
def cloneInfo(owner: Symbol) = this
+ protected def objectPrefix = "object "
+ protected def packagePrefix = "package "
+
+ def trimPrefix(str: String) =
+ if (str.startsWith(objectPrefix)) str.substring(objectPrefix.length)
+ else if (str.startsWith(packagePrefix)) str.substring(packagePrefix.length)
+ else str
+
/** The string representation of this type used as a prefix */
- def prefixString = toString() + "#";
+ def prefixString = trimPrefix(toString()) + "#";
/** The string representation of this type, with singletypes explained */
def toLongString = {
@@ -891,9 +899,9 @@ trait Types requires SymbolTable {
val str = (pre.prefixString + sym.nameString +
(if (args.isEmpty) "" else args.mkString("[", ",", "]")))
if (sym.isPackageClass)
- "package "+str
+ packagePrefix+str
else if (sym.isModuleClass)
- "object "+str
+ objectPrefix+str
else if (sym.isAnonymousClass && sym.isInitialized)
sym.info.parents.mkString("", " with ", "{ ... }")
else if (sym.isRefinementClass && sym.isInitialized)
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 1049ad6473..82b111ace6 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -320,9 +320,10 @@ abstract class Mixin extends InfoTransform {
val rhs0 =
Apply(Select(Super(clazz, nme.EMPTY.toTypeName), stat.symbol.alias),
vparams map (vparam => Ident(vparam.symbol)));
- if (settings.debug.value) log("complete super acc " + stat.symbol + stat.symbol.locationString + " " + rhs0 + " " + stat.symbol.alias + stat.symbol.alias.locationString)//debug
- val rhs1 = postTransform(localTyper.typed(atPos(stat.pos)(rhs0), stat.symbol.tpe.resultType));
- copy.DefDef(stat, mods, name, tparams, List(vparams), tpt, rhs1)
+ val rhs1 = localTyper.typed(atPos(stat.pos)(rhs0), stat.symbol.tpe.resultType);
+ val rhs2 = atPhase(currentRun.mixinPhase)(transform(rhs1))
+ if (settings.debug.value) log("complete super acc " + stat.symbol + stat.symbol.locationString + " " + rhs1 + " " + stat.symbol.alias + stat.symbol.alias.locationString + "/" + stat.symbol.alias.owner.hasFlag(lateINTERFACE))//debug
+ copy.DefDef(stat, mods, name, tparams, List(vparams), tpt, rhs2)
case _ =>
stat
}
@@ -374,7 +375,7 @@ abstract class Mixin extends InfoTransform {
case Apply(Select(qual, _), args) =>
def staticCall(target: Symbol) = {
if (target == NoSymbol)
- assert(false, "" + sym + " " + sym.owner + " " + implClass(sym.owner) + " " + sym.owner.owner + atPhase(phase.prev)(sym.owner.owner.info.decls.toList));//debug
+ assert(false, "" + sym + ":" + sym.tpe + " " + sym.owner + " " + implClass(sym.owner) + " " + implClass(sym.owner).info.member(sym.name) + " " + atPhase(phase.prev)(implClass(sym.owner).info.member(sym.name).tpe) + " " + phase);//debug
localTyper.typed {
atPos(tree.pos) {
val qual1 =
diff --git a/test/files/run/bug657.check b/test/files/run/bug657.check
new file mode 100644
index 0000000000..b0aad4deb5
--- /dev/null
+++ b/test/files/run/bug657.check
@@ -0,0 +1 @@
+passed
diff --git a/test/files/run/bug657.scala b/test/files/run/bug657.scala
new file mode 100644
index 0000000000..931f62b1a5
--- /dev/null
+++ b/test/files/run/bug657.scala
@@ -0,0 +1,51 @@
+abstract class BaseList {
+ type Node <: NodeImpl;
+ implicit def convertNode(ni : NodeImpl) = ni.asInstanceOf[Node];
+ abstract class NodeImpl;
+}
+abstract class LinkedList extends BaseList {
+ type Node <: NodeImpl;
+ trait NodeImpl extends super.NodeImpl;
+}
+trait OffsetList extends LinkedList {
+ type Node <: NodeImpl;
+ trait NodeImpl extends super.NodeImpl;
+}
+
+trait PriorityTree extends BaseList {
+ type Node <: NodeImpl;
+ trait NodeImpl extends super.NodeImpl {
+ def chop : Node = this;
+ }
+}
+
+trait PrecedenceParser extends LinkedList with PriorityTree {
+ type Node <: NodeImpl;
+ trait NodeImpl extends super[LinkedList].NodeImpl with super[PriorityTree].NodeImpl;
+}
+
+trait Matcher extends PrecedenceParser {
+ type Node <: NodeImpl;
+ trait NodeImpl extends super.NodeImpl;
+
+ type Matchable <: Node with MatchableImpl;
+ implicit def convertMatchable(m : MatchableImpl) = m.asInstanceOf[Matchable];
+ trait MatchableImpl extends NodeImpl {
+ override def chop : Node = {
+ Console.println("passed"); super.chop;
+ }
+ }
+}
+
+class Test1 extends OffsetList with Matcher {
+ type Node = NodeImpl;
+ trait NodeImpl extends super[OffsetList].NodeImpl with super[Matcher].NodeImpl;
+ class MatchableImpl extends super.MatchableImpl with NodeImpl;
+ type Matchable = MatchableImpl;
+}
+
+object Test extends Application {
+ val test = new Test1;
+ val m = new test.MatchableImpl;
+ m.chop;
+}