summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-02-25 18:09:55 +0000
committerMartin Odersky <odersky@gmail.com>2006-02-25 18:09:55 +0000
commitb2793f349671f884ca38f17b6ef5209a0fbc555a (patch)
tree3b01dd545c4b3288436e25f8e0b4bceca5e79c9c /src/compiler
parent45371e87920d3a68dc5cc3c20d4408f6127700f1 (diff)
downloadscala-b2793f349671f884ca38f17b6ef5209a0fbc555a.tar.gz
scala-b2793f349671f884ca38f17b6ef5209a0fbc555a.tar.bz2
scala-b2793f349671f884ca38f17b6ef5209a0fbc555a.zip
Fixed bugs 536 and 537.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala17
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala3
3 files changed, 16 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index d9cecbe1e0..11cc204e1d 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -111,7 +111,7 @@ mixin class Symbols requires SymbolTable {
final def newOverloaded(pre: Type, alternatives: List[Symbol]): Symbol =
newValue(alternatives.head.pos, alternatives.head.name)
.setFlag(OVERLOADED)
- .setInfo(OverloadedType(pre, alternatives));
+ .setInfo(OverloadedType(pre, alternatives))
final def newErrorValue(name: Name) =
newValue(pos, name).setFlag(SYNTHETIC | IS_ERROR).setInfo(ErrorType);
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index d2092a1834..c420718ac5 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -190,11 +190,16 @@ mixin class Types requires SymbolTable {
def memberInfo(sym: Symbol): Type =
sym.info.asSeenFrom(this, sym.owner);
- /** The type of `sym', seen as a memeber of this type. */
+ /** The type of `sym', seen as a member of this type. */
def memberType(sym: Symbol): Type = {
- val result = sym.tpe.asSeenFrom(this, sym.owner);
- /*System.out.println("" + this + ".memberType(" + sym + ") = " + result);*/
- result
+ sym.tpe match {
+ case OverloadedType(pre, alts) =>
+ assert(this =:= pre);
+ sym.tpe
+ case _ =>
+ //System.out.println("" + this + ".memberType(" + sym +":" + sym.tpe +")");//DEBUG
+ sym.tpe.asSeenFrom(this, sym.owner)
+ }
}
/** Substitute types `to' for occurrences of references to symbols `from'
@@ -408,10 +413,11 @@ mixin class Types requires SymbolTable {
checkMalformedSwitch = savedCheckMalformedSwitch;
if (util.Statistics.enabled) findMemberMillis = findMemberMillis + System.currentTimeMillis() - startTime;
if (members == null) {
- if (util.Statistics.enabled) if (member == NoSymbol) noMemberCount = noMemberCount + 1;
+ if (util.Statistics.enabled) if (member == NoSymbol) noMemberCount = noMemberCount + 1;
member
} else {
if (util.Statistics.enabled) multMemberCount = multMemberCount + 1;
+ //val pre = if (this.symbol.isClass) this.symbol.thisType else this;
baseClasses.head.newOverloaded(this, members.toList)
}
}
@@ -1228,6 +1234,7 @@ mixin class Types requires SymbolTable {
if (symclazz == clazz && (pre.widen.symbol isSubClass symclazz))
pre.baseType(symclazz) match {
case TypeRef(_, basesym, baseargs) =>
+// System.out.println("instantiating " + sym + " from " + basesym + " with " + basesym.typeParams + " and " + baseargs);//DEBUG
if (basesym.typeParams.length != baseargs.length)
assert(false, "asSeenFrom(" + pre + "," + clazz + ")" + sym + " " + basesym + " " + baseargs); //debug
instParam(basesym.typeParams, baseargs);
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 580365c713..8ad57a5bad 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -330,6 +330,9 @@ abstract class Mixin extends InfoTransform {
private def postTransform(tree: Tree): Tree = {
val sym = tree.symbol;
+ if (tree.tpe.symbol.isImplClass &&
+ (tree.symbol == null || !tree.symbol.isImplClass))
+ tree.tpe = toInterface(tree.tpe);
tree match {
case Template(parents, body) =>
val parents1 = currentOwner.info.parents map (t => TypeTree(t) setPos tree.pos);